zsh: no matches found: uvicorn[standard] - fastapi

I am following the example to install unvicorn:
https://www.uvicorn.org/
by doing:
pip install uvicorn[standard]
But received the following error:
% pip install uvicorn[standard]
zsh: no matches found: uvicorn[standard]
However this works:
% pip install uvicorn
I am on MacPro with Python 3.7.

You need to use single quotes.
pip install 'uvicorn[standard]'

zsh uses square brackets for globbing / pattern matching.
So, if you need to pass literal square brackets as an argument to a command, you either need to escape them or quote the argument like this:
pip install 'uvicorn[standard]'
If you want to disable globbing for the pip command permanently, you can do so by adding this to your ~/.zshrc:
alias pip='noglob pip'

For zsh you can configure it to just run the command without trying to do any glob expansion when there are no files to match:
unsetopt nomatch

Related

ZSH Couldn't Auto Complete Suggestion

I'm running the latest Fedora with GNOME version 43.2. I've installed ZSH and oh-my-zsh on my system. When I tried to type "sudo dnf remove auda" and hit the tab button for autocompletion, I received the following suggestion from ZSH. In other word, hitting TAB after auda will append the zsh: sqlite3 as you see below.
# Attempting to remove audacious
sudo dnf remove audazsh: sqlite3: command not found...
Install pacsudo dnf remove auda
# Another example trying to remove Gimp
sudo dnf remove gizsh: sqlite3: command not found...
Install pacsudo dnf remove gi
It seems any command ZSH and oh-my-zsh with auto-suggestion plugin will work just fine but not the application name itself.
Anyone run into this issue? It's quite annoying. I'd rather it not suggest anything instead of appending gibberish to the command.

Alias for JDK is not working in ZSH but works in bash

The following aliases are working in bash but not in ZSH:
# Different installed version of JDK
export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8)
export JAVA_11_HOME=$(/usr/libexec/java_home -v11)
alias java8='export JAVA_HOME=$JAVA_8_HOME'
alias java11='export JAVA_HOME=$JAVA_11_HOME'
# default to Java 11
java11
I only get the following error:
zsh: command not found: java8
I can change the JDK version if I do it like this:
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
But the alias java8 or java11 are not recognised.
I'm assuming these all appear in your .bashrc file. You need to add them to .zshrc for zsh to define them.

How to hide terminal warning when Oh-my-ZSH plugin can't access external app

I've been using oh-my-zsh for a while and it's working great. I'd like to use the command-line fuzzy finder plugin so I enabled it in .zshrc:
plugins=(fzf)
However if "fzf" is not installed I get a warning when opening my terminal window:
[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.
Please add export FZF_BASE=/path/to/fzf/install/dir to your .zshrc
Is there a way to hide that warning message? When I install fzf with "sudo dnf install fzf" the warning dissapears, but maybe I want to clone my dotfiles on a different computer where it is not available and it's not that important to be there.
you should first install fzf, in Mac and i use the following command to install brew install fzf
You need to have fzf installed to use this plugin; otherwise remove it. It won't do anything without first installing fzf. Sudo apt install fzf
You can put the plugins= line inside an if statement that checks for the presence of fzf in your path. For example:
if [[ -n $(command -v fzf) ]] ; then
echo "fzf found, loading oh-my-zsh fzf plugin"
plugins=(vi-mode fzf)
else
echo "no fzf was found in the path"
plugins=(vi-mode)
fi
command -v is similar to which, but is superior for this context as explained in this answer.
The -n makes the [[ ]] evaluate as true whenever the $() produces a non-empty output.
For me, it was also very important that brew itself was in Path of ~/.zshenv like so:
export PATH=/opt/homebrew/bin:$PATH
Installed FZF with brew on an M1 Mac.
Otherwise, the error occurs:
[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.
Please add `export FZF_BASE=/path/to/fzf/install/dir` to your .zshrc
When you install fzf by using brew, it needs to be set brew env.
You can solve to set PATH for fzf before the line of plugins=(fzf) in .zshrc file.
But, I recommand creating "$HOME/.zprofile" as following.
For m1 Mac.
# Set PATH, MANPATH, etc., for Homebrew.
eval "$(/opt/homebrew/bin/brew shellenv)"
For, intel Mac
# Set PATH, MANPATH, etc., for Homebrew.
eval "$(/usr/local/bin/brew shellenv)"

OSX. pytest-xdist error in zsh terminal: zsh: no matches found: 3*popen

I am using ZSH + iterm as a command line tool.
When I am trying to run pytest tests with xdist plugin in several subprocesses I get an error: no matches found: 3*popen
Execution command: pytest --tx 3*popen --dist=load
Additional info:
OS version: OSX 10.13.2
Pytest: 3.4.0
Terminal: Iterm + ZSH
Try quoting *. For example:
pytest --tx 3\*popen --dist=load
or
pytest --tx '3*popen' --dist=load
By default zsh prints an error if it cannot match a filename pattern (while bash would just leave the pattern unchanged). Quoting glob operators, like *, prevents their evaluation, allowing to use them verbatim.
It would also be possible to make zsh behave like bash by disabling the NOMATCH option with setopt no_nomatch. Personally, I would recommend against it, as it could lead to unexpected results in case there are actually matching file names.

zsh is not finding my php executable

I'm using zsh on my Ubuntu VPS.
When I try to find version
php -v
zsh: command not found: php
and my php executable somehow got into
whereis php
php: /usr/share/php
How can I point it to right path?
export PATH=$PATH:/usr/share/php/bin
Add this to your .zshrc (assuming /usr/share/php/bin is the directory in which the php binary lives).
Ho you have to over write all commands to zsh
try this
PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH
Just reinstall PHP and overwrite any previous installation with this:
brew link --overwrite php

Resources