How to fix 'zsh: command not found: airflow'? - installation

I am trying to install airflow in my python environment within a linux server and zsh shell. I was able to pip install successfully using the command:
pip --proxy http://xxxxx install --user --no-cache-dir -U --upgrade-strategy only-if-needed --force-reinstall apache-airflow
I can also import airflow from JupyterLab but when I tried airflow version or airflow initdb. It is prompting
zsh: command not found: airflow
Would appreciate any thoughts on this. Thanks!

I had to add the following line to my .zshrc.
export PATH=$PATH:/usr/local/Caskroom/miniconda/base/bin
I then ran source ~/.zshrc and Airflow worked.
This is a downside of installing miniconda with brew cask I suppose.

Related

Unable to create process using "c:\users\hp\anaconda3\python.exe"

C:\Users\HP\badminton_site\badminton>scrapy shell https://stackoverflow.com/questions/ask
Fatal error in launcher: Unable to create process using '"c:\users\hp\anaconda3\python.exe" "C:\Users\HP\Anaconda3\Scripts\scrapy.exe" shell https://stackoverflow.com/questions/ask: The system cannot find the file specified.
Why it is showing such error in anaconda prompt and command prompt?
Uninstall and reinstall the pip:
python -m pip uninstall pip
python -m pip install --upgrade pip
Update pip
python -m pip install -upgrade pip
i reinstalled the anaconda in another diretory and that worked for me

I cannot install aws cli on mac os with pip - awscli: command not found

I tried to follow this tutorial.
This is what I did in the console:
pip3 install --user --upgrade awscli
after that, when I write:
pip3 --version
I'm getting:
pip 9.0.1 from /Users/user/Library/Python/3.4/lib/python/site-packages (python 3.4)
then I wrote:
pip3 install --user --upgrade awscli
this command downloaded awscli and automatically added this:
# Setting PATH for Python 3.4
# The orginal version is saved in .profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH
to my .profile
Later on, just to be sure, I wrote:
source ~/.profile
and then when I type:
user$ aws
-bash: aws: command not found
I restarted the terminal with no luck also.
What's the problem here?
Here are the two steps to install AWS cli on mac OSX
FIRST
Offical version
brew install awscli
SECOND
Development version
brew install awscli --HEAD
When "pip3 install" is called with the "--user" option, it installs the aws executable in a user-specific location. This can be one of many possible locations, but the best way to find out where is with this command:
python3 -m site --user-base
On my system, this returned:
/Users/[myusername]/Library/Python/3.6
This directory has a "bin" subdirectory, and that is where the "aws" executable was located.
I figured this out from following:
pip3 install --help
https://docs.python.org/3/library/site.html#module-contents
Simple do these three steps:
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
brew install awscli should work
This is what worked for me, I experienced permission issues and had to create a local Frameworks folder first before running brew install. using macOS High Sierra
sudo mkdir /usr/local/Frameworks
sudo chown $(whoami):admin /usr/local/Frameworks
brew install awscli
To answer the original question about installing using pip:
sudo pip install --upgrade pip
sudo easy_install nose
sudo easy_install tornado
sudo easy_install six
sudo pip install --ignore-installed awscli
worked for me on Mojave
I had similar error, when trying to install awscli. I was following steps mentioned here by amazon [https://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html]
I use anaconda, so when I was using pip3 install awscli --upgrade --user
it installs awscli in /Users/username/.local/lib/python3.6/
So, I used following to update awscli to anaconda-
conda install -c conda-forge awscli
I have used the following commands to install awscli :
$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
$ unzip awscli-bundle.zip
$ ./awscli-bundle/install -b ~/bin/aws
check version using : /Users/xxx/bin/aws --version
configure using : /Users/xxx/bin/aws configure
Was facing a similar issue. Resolved it by installing python 3.9 using brew install.
brew install python#3.9
Then reinstall awscli
I followed the below steps and it works for MacOS 10.11
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
Unzip the package.
unzip awscli-bundle.zip
And instead of given command:
'sudo /usr/local/bin/python2.7 awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws'
which is broken due to pip, I think, I used the below command and it worked for me.
python3.6 ./awscli-bundle/install -b ~/bin/aws

zsh command cannot found pip

How can I use pip in oh-my-zsh? I was trying to install nltk through pip, but it told me zsh: command not found: pip. When I check plugins under .oh-my-zsh/custom/plugins, there is a folder named pip. I don't know what the problem is.
Edit:
$ echo $PATH
/home/xxx/bin:/usr/local/bin:/home/xxx/bin:/home/xxx/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$ type pip
pip is an alias for noglob pip
Maybe you have installed both python2 and python3. python3 may have been installed later.
You may try to use pip3 instead of pip.
First, input the command:
pip3 -V
If you see the version, the pip3 can be used.
Then you can input command line to install nltk:
pip3 install nltk
I got a way to help you use pip in zsh. We can use nano to edit files. In nano, ctrl+X to save and exit
In the ~ directory, input the command:
nano .bash_profile
You may see some codes like:
# Setting PATH for Python 3.5
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH
Copy them and paste them to the end of .zshrc file by using command:
nano .zshrc
Then input the command:
pip -V
If you see the version, pip can be used.
In case you do
which pip
and it doesn't show the path, just do
which pip3
This will print the path which is /usr/local/bin/pip3
Then do open ~/.zshrc or nano ~/.bash_profile.
Make alias for pip like:
alias pip=/usr/local/bin/pip3
N.B: You copy that line above and paste in your .zshrc file.
After do source ~/.zshrc and close .zshrc
For me it's working to do
python -m pip install [package_name]
instead of
pip install [package_name]
If you installed python3.x, you should run with pip3(not pip)
So you are using oh-my-zsh framework for zsh or Z shell.
First, try the command:
pip3 -V
If you get something like this below, that means you have the pip3 package already and must be having python3 as well.
pip 22.0.4 from /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip (python 3.10)
Then edit your .zprofile instead of .bashprofile as you are using zsh. This is the command.
nano ~/.zprofile
Then it should have the two alias like this.
# Setting PATH for Python 3.10
# The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.10/bin:${PATH}"
export PATH
alias python=python3
alias pip=pip3
Make sure you save it. Exit and Re-open you terminal. Type the command:
pip -V
It should have the same result as the pip3 -V like this:
❯ pip -V
pip 22.0.4 from /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip (python 3.10)
Then you can use pip or pip3 interchangeably for installing your nltk package like this.
pip install nltk
I'm on MacOS and use ZSH. It seems pip 2.7 can't be found, although it is installed. I believe my paths to "pip" are linked wrong (I also have python3 and pip3 installed via brew).
To get around the issue I created an alias. If you don't have an .aliases file, create one in your homedir. Then open the file:
nano ~/.aliases
and add:
## PIP for python2.7 ##
alias pip="python -m pip "
You need to tell ZSH to pick up the alias file (assuming you don't have this setup already). Open your .zshrc:
nano ~/.zshrc
The add the following near the bottom of the file:
[ -f "$HOME/.aliases" ] && source "$HOME/.aliases"
From the terminal, run:
source ~/.zshrc
Or quit your terminal and reopen it.
Now you can run:
pip install <command>
Edit your rc file:
vim ~/.zshrc
Find the config plugins and delete the pip entry.
In a new terminal:
which pip
This will show you the real path of pip
If you're running into this issue, it probably is due to versioning complications. Python 2 versus Python 3 on your OS may be resolving unexpectedly. Below is a quick workaround to get you to functioning behavior.
Try using the below for Python 2:
python -m pip install <command>
Try using the below for Python 3:
pip3 install <command>
In my case my OS was Ubuntu 20.04 and the pip doesn't come with python.
So, i've installed pip through the command
sudo apt install python3-pip
and I'm done.
To ensure run pip -V or pip3 -V
My pip script is missing for some reason, so I have to install it.
$ python -m ensurepip --upgrade
More methods can be found here:pip installation
You should consider upgrading.
Enter this in your terminal
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 -m pip install --upgrade pip
and then...
Type: pip -V

Getting "ImportError: No Module named yaml" error

Computer: MacBook Pro mid 2012, running El Capitan 10.11.4
Python version 2.7.10
I've been trying to install ansible from source, and I've run these two commands (following the steps on ansibles documentation):
git clone git://github.com/ansible/ansible.git --recursive
cd ./ansible
and then ran this
source ./hacking/env-setup
I've also already installed these packages
sudo pip install paramiko PyYAML Jinja2 httplib2 six
However, if I try and run ansible by typing it in the terminal, I get the following error.
Traceback (most recent call last):
File "/Users/[myusr]/rock/ansible/bin/ansible", line 81, in <module>
from ansible.cli.adhoc import AdHocCLI as mycli
File "/Users/[myusr]/rock/ansible/lib/ansible/cli/__init__.py", line 27, in <module>
import yaml
ImportError: No module named yaml
What should be done here?
Do you have yaml module installed? If not, try installing yaml using the following command:
sudo pip install pyyaml
Had the same issue. Got past it using #FranMowinckel's answer.
First I typed:
pip --version
it outputted python 3. But, when I tried:
sudo python -m pip install pyyaml
I got an error saying:
Error: No module named pip
So, finally running:
sudo easy_install pip
everything worked fine.
Go back and run:
sudo python -m pip install pyyaml
(you may have to run this with all the other modules as well)
Now you should finally be able to run your initial command which failed.
For python 3.6 you can install it with
pip3 install pyyaml
if there is a problem in importing, do
pip3 uninstall pyyaml
and then install it again:
pip3 install pyyaml
#bigdata2's answer is correct but it might also happen that there's a conflict with python 3. So, check pip version (pip --version) and if it outputs python 3 then:
sudo python -m pip install pyyaml
So it gets installed for the same version as python.
I had this problem because I installed it with
sudo pip install pyyaml --upgrade
instead of
sudo -H pip install pyyaml --upgrade
Uninstalling and re-installing pyyaml fixed the problem for me.
This should work:
sudo pip install pyyaml
Try this
pip install ruamel.yaml

IPython command not found Terminal OSX. Pip installed

Using Python 2.7 installed via homebrew. I then used pip to install IPython. So, IPython seems to be installed under:
/usr/local/lib/python2.7/site-packages/
I think this is true because there is a IPython directory and ipython egg.
However, when I type ipython in the terminal I get:
-bash: ipython: command not found
I do not understand why this ONLY happens with IPython and not with python? Also, how do I fix this? What path should I add in .bashrc? And how should I add?
Currently, my .bashrc reads:
PATH=$PATH:/usr/local/bin/
Thanks!
I had this issue too, the following worked for me and seems like a clean simple solution:
pip uninstall ipython
pip install ipython
I'm running mavericks and latest pip
Check IPython whether is installed by below command:
$python -m IPython
If you got this result as above picture.
Then run this command on terminal and add into ~/.bash_profile file
$alias ipython='python -m IPython'
So try run "ipython" again on terminal. It works fine for me.
Reference topics:
ipython on MacOS 10.10 - command not found
iPython installed but not found
Create .pydistutils.cfg in your homedir with following content:
[global]
verbose=1
[install]
install-scripts=$HOME/bin
[easy_install]
install-scripts=$HOME/bin
And then: pip install -U --user ipython. Of course $HOME/bin must be in your $PATH. Packages are going to be installed in $HOME/Library/Python, so user only, not system wide.
Try run brew install ipython:
then run xcode-select --install;
run brew install git,
If you got this result as above picture. Refer to enter link description here
At last, run brew install ipython
I use pip3 install ipython is OK.
maybe ipython rely on python3
After trying to a number of solutions like above with out joy, when I restarted my terminal, Ipython command launched. Don't forgot to restart your terminal after all the fiddling!
P.S. I think the brew install Ipython did it ... but can't be sure.
For me the only thing that helped was:
python -m pip install --upgrade pip
Upgrading pip did the work and all the installations started working properly!
Give it a try.

Resources