Hello,
Trying to install a module fails with the following error:
/bin/sh: /bin/pip: No such file or directory
I am using MacOS and have installed python and python3 using homebrew.
Then installed pipenv using pip3.
which pip
returns:
/usr/local/bin/pip
and pip itself is found as a command.
However, if I use python -m pip --version
it points to the default MacOS python:
pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
I am unaware where it tries to resolve pip from and does not find it.
I am not sure if there is a problem with my $PATH paths or the issue is different.
Thank you for your time!
Try the fancy installation method
Second. Pipsi is the way to go for installing python cli utils
Thanks for the replies.
I first uninstalled and installed again python and python3 using homebrew and also re-installed pip.
Then I was able to successfully install pipenv using pipsi by the provided link for the fancy installation.
However, trying to install any module, I know get the following error:
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 7, in
from pipenv import cli
File "/usr/local/lib/python3.6/site-packages/pipenv/__init__.py", line 13, in
from .cli import cli
File "/usr/local/lib/python3.6/site-packages/pipenv/cli.py", line 11, in
import background
ModuleNotFoundError: No module named 'background'
Using pip3 I installed background and semver.
Now I am facing another issue:
ModuleNotFoundError: No module named 'piptools'
$ pip3 install piptools
Collecting piptools
Could not find a version that satisfies the requirement piptools (from versions: )
No matching distribution found for piptools
I believe there might be a root cause of the above since I am not sure if all those errors are expected.
Your help is much appreciated.
Typo in the pip-tools. Installed them and now I am back at square one with the initial error:
/bin/sh: /bin/pip: No such file or directory
Do you have PYTHONHOME
set or something?
No, I do not.
pip is available in terminal.
$ which pip
/usr/local/bin/pip
but it is only 'attached' to python2 and python3 but not the default python:
$ python -m pip
/usr/bin/python: No module named pip
Any ideas on what could be wrong?
Seems the root cause was that pew
was not working due to not set locale.
Setting it in .bash_profile
seems to resolve the issue.
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
Will further test and later update if this is solved.
馃挮鉁煃扳湪馃挮
We should check for this and add some pretty error message if it's not set.
@kennethreitz should pew check for this or should pipenv?
@erinxocon pew should.
$ hash -r
Reset your bash cache. It will solve the problem.
I was having an issue only on codebuild, and this solved it for me: https://github.com/pypa/pipenv/issues/1929
Maybe this will help newbies like me in the future.
I Following @nzagorchev comment:
add @nzagorchev script in your ~/.bash_profile
or ~/.zshrc
sudo vim ~/.bash_profile
or
sudo vim ~/.zshrc
if you're using zsh
then add the following script to the file
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
then run this command:
source ~/.bash_profile
or
source ~/.zshrc
if you're using zsh
then close your terminal and open it again.
after that, it works perfectly :)
Me funciono esta opcion
$pip install -U pip
$which pip
/usr/bin/pip
$hash -r
$which pip
/usr/local/bin/pip
Referencia: https://stackoverflow.com/questions/16237490/i-screwed-up-the-system-version-of-python-pip-on-ubuntu-12-10
Most helpful comment
Seems the root cause was that
pew
was not working due to not set locale.Setting it in
.bash_profile
seems to resolve the issue.Will further test and later update if this is solved.