pip install is not installing executables in /usr/local/bin
26,339
Solution 1
I had to remove the pip
package that was installed by apt
.
sudo apt remove python-pip
And then install pip again according to instructions on their website - https://pip.pypa.io/en/stable/installing/.
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
Looks like pip
from Ubuntu's default repository is not same as one distributed by pypi.
Solution 2
Open a terminal and run:
pip uninstall git-review
sudo pip uninstall git-review
sudo pip install --prefix /usr/local git-review
git review --version
The last command should output something like git-review version 1.25.0
.
Related videos on Youtube
Author by
ronakg
Updated on September 18, 2022Comments
-
ronakg over 1 year
I recently setup a new Ubuntu 16.04.2 machine. I'm trying to install some python packages, but all the packages are getting installed at
/usr/local/lib/python2.7.10/bin
instead of/usr/bin
or/usr/local/bin
.Installing collected packages: git-review changing mode of /usr/local/lib/python2.7.10/bin/git-review to 755 Successfully installed git-review-1.25.0
What's the problem here?
-
Chai T. Rex over 7 yearsDoes running
git review
work? -
ronakg over 7 yearsNo, I had to manually invoke it from
/usr/local/lib/python2.7.10/bin/git-review
. -
Chai T. Rex over 7 years
/usr/bin
shouldn't be used because it's used only for dpkg/Apt packages. Doespip install --install-option="--prefix=/usr/local/bin" git-review
put it in/usr/local/bin
and have it working correctly? -
ronakg over 7 yearsNope. It still goes at the same location.
-
Chai T. Rex over 7 yearsOK, I found a slightly-different option that works here. Try my answer below.
-
-
ronakg over 7 yearsThat did work, but now I'm getting another error.
$ git review Traceback (most recent call last): File "/usr/local/bin/git-review", line 7, in <module> from git_review.cmd import main ImportError: No module named git_review.cmd
-
Chai T. Rex over 7 yearsSorry, I'm not seeing that, so I'm not sure how to fix it.
-
ronakg over 7 yearsActually I removed the installed pip using
sudo apt remove python-pip
and then reinstalled pip according to instructions here - pip.pypa.io/en/stable/installing -
Chai T. Rex over 7 yearsIts use is cautioned there:
Be cautious if you're using a Python install that's managed by your operating system or another package manager. get-pip.py does not coordinate with those tools, and may leave your system in an inconsistent state.
-
ronakg over 7 yearsYes exactly @chai-t-rex.
-
Chai T. Rex almost 6 yearsYou can do the last part without a temporary file with
sudo python <(wget -O- https://bootstrap.pypa.io/get-pip.py 2>/dev/null)
-
Jakobovski over 5 yearsOMG! Jesus christ ubuntu