Pip3 is actually running python2?
5,193
Did u try - sudo -H python3 -m pip install ..
?
Doing python3 -m pip
will explicitly invoke python3's pip.
Sorry for posting this as answer. I don't have enough reputation to put a comment.
Related videos on Youtube
![Błażej Michalik](https://i.stack.imgur.com/kK9KC.jpg?s=256&g=1)
Author by
Błażej Michalik
Updated on September 18, 2022Comments
-
Błażej Michalik almost 2 years
Could someone please kindly explain to me, why installing
python3-pip
package withapt
installspip3
for... python 2?$ pip3 --version pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7) $ which pip3 | xargs head -n 1 #!/usr/bin/python $ ls /usr/bin/python lrwxrwxrwx 1 root root 9 maj 18 2016 /usr/bin/python -> python2.7
I don't know if this should be troubling me this much, but to be in line with XY problem solving: I'm asking because due to this particular setup, many pip3 installs fail - for example, after
sudo -H pip3 install docker-compose
:$ docker-compose Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 7, in <module> from compose.cli.main import main File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 20, in <module> from ..bundle import get_image_digests File "/usr/local/lib/python2.7/dist-packages/compose/bundle.py", line 14, in <module> from .service import format_environment File "/usr/local/lib/python2.7/dist-packages/compose/service.py", line 14, in <module> from docker.utils import LogConfig ImportError: cannot import name LogConfig
I'm running Ubuntu GNOME 16.04
-
muru over 7 yearsI don't know where you got
pip3
from, butpython3-pip
contains this as/usr/bin/pip3
: paste.ubuntu.com/23667201 Download from packages.ubuntu.com/xenial/all/python3-pip/download and see for yourself. Further, why do you have anything Python-related in/usr/local
at all? It looks like you install Python from source and messed up. -
Błażej Michalik over 7 years@muru The package landed inside
/usr/local
after clean reinstall of both the pip and package itself. I have no idea why that happened.python3-pip
package came frompl.archive.ubuntu.com_ubuntu_dists_xenial_universe_binary-amd64_Packages
(as inpool/universe/p/python-pip/python3-pip_8.1.1-2ubuntu0.4_all.deb
). -
muru over 7 yearssorry, but packages from official repos never install anything in
/usr/local
. -
Błażej Michalik over 7 years@muru The
/usr/local/
one is not the one from official repo.python3-pip
is,pip3
actually installed it there. For some reason. I reinstalled that withpython3 -m pip install
and it worked as expected. At this point I am afraid to even ask why. -
Pablo Bianchi almost 6 yearsI fixed
docker-compose
Python issue withsudo -H pip install --upgrade docker-py
.
-
-
Błażej Michalik over 7 yearsI know about the command, but the
pip3
thing got me by surprise. By now I'm not sure about the state of any python dependency I installed with pip3, and that makes me kinda nervous. I really wanted to just know why anyone would want that...