Installing pip3

6,089

Try python3 -m pip3 install pip.

You may be trying to use Python2 to run pip3 and that's why you're seeing the error.

Share:
6,089
thegreatcoder
Author by

thegreatcoder

Updated on September 18, 2022

Comments

  • thegreatcoder
    thegreatcoder over 1 year

    I had followed the instructions here to install pip3; I need it to install other python3 packages. I don't remember if I installed pip3 a long time before. After running sudo apt install python3-pip, I get the following as the output,

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    python3-pip is already the newest version (8.1.1-2ubuntu0.4).
    The following packages were automatically installed and are no longer required:
      gyp libavdevice-ffmpeg56 libjs-inherits libjs-node-uuid libuv1-dev
      linux-headers-4.13.0-37 linux-headers-4.13.0-37-generic
      linux-headers-4.13.0-38 linux-headers-4.13.0-38-generic
      linux-headers-4.13.0-39 linux-headers-4.13.0-39-generic
      linux-headers-4.13.0-41 linux-headers-4.13.0-41-generic
      linux-headers-4.13.0-43 linux-headers-4.13.0-43-generic
      linux-headers-4.13.0-45 linux-headers-4.13.0-45-generic
      linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic
      linux-image-4.13.0-37-generic linux-image-4.13.0-38-generic
      linux-image-4.13.0-39-generic linux-image-4.13.0-41-generic
      linux-image-4.13.0-43-generic linux-image-4.13.0-45-generic
      linux-image-4.15.0-29-generic linux-image-extra-4.13.0-37-generic
      linux-image-extra-4.13.0-38-generic linux-image-extra-4.13.0-39-generic
      linux-image-extra-4.13.0-41-generic linux-image-extra-4.13.0-43-generic
      linux-image-extra-4.13.0-45-generic linux-modules-4.15.0-29-generic
      linux-modules-extra-4.15.0-30-generic linux-signed-image-4.13.0-37-generic
      linux-signed-image-4.13.0-38-generic linux-signed-image-4.13.0-39-generic
      linux-signed-image-4.13.0-41-generic linux-signed-image-4.13.0-43-generic
      linux-signed-image-4.13.0-45-generic
    Use 'sudo apt autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 236 not upgraded.
    

    However, When I type which pip3, I do not get any output. Again, When I typed pip3 -V, I get the following response:

    The program 'pip3' is currently not installed. You can install it by typing:
    sudo apt install python3-pip
    

    I tried dpkg -L python3-pip and got the following as the output:

    /.
    /usr
    /usr/lib
    /usr/lib/python3
    /usr/lib/python3/dist-packages
    /usr/lib/python3/dist-packages/pip-8.1.1.egg-info
    /usr/lib/python3/dist-packages/pip-8.1.1.egg-info/PKG-INFO
    /usr/lib/python3/dist-packages/pip-8.1.1.egg-info/dependency_links.txt
    /usr/lib/python3/dist-packages/pip-8.1.1.egg-info/not-zip-safe
    /usr/lib/python3/dist-packages/pip-8.1.1.egg-info/requires.txt
    /usr/lib/python3/dist-packages/pip-8.1.1.egg-info/entry_points.txt
    /usr/lib/python3/dist-packages/pip-8.1.1.egg-info/top_level.txt
    /usr/lib/python3/dist-packages/pip
    /usr/lib/python3/dist-packages/pip/baseparser.py
    /usr/lib/python3/dist-packages/pip/__main__.py
    /usr/lib/python3/dist-packages/pip/req
    /usr/lib/python3/dist-packages/pip/req/req_set.py
    /usr/lib/python3/dist-packages/pip/req/req_install.py
    /usr/lib/python3/dist-packages/pip/req/__init__.py
    /usr/lib/python3/dist-packages/pip/req/req_file.py
    /usr/lib/python3/dist-packages/pip/req/req_uninstall.py
    /usr/lib/python3/dist-packages/pip/index.py
    /usr/lib/python3/dist-packages/pip/status_codes.py
    /usr/lib/python3/dist-packages/pip/utils
    /usr/lib/python3/dist-packages/pip/utils/setuptools_build.py
    /usr/lib/python3/dist-packages/pip/utils/appdirs.py
    /usr/lib/python3/dist-packages/pip/utils/outdated.py
    /usr/lib/python3/dist-packages/pip/utils/ui.py
    /usr/lib/python3/dist-packages/pip/utils/logging.py
    /usr/lib/python3/dist-packages/pip/utils/encoding.py
    /usr/lib/python3/dist-packages/pip/utils/deprecation.py
    /usr/lib/python3/dist-packages/pip/utils/__init__.py
    /usr/lib/python3/dist-packages/pip/utils/filesystem.py
    /usr/lib/python3/dist-packages/pip/utils/hashes.py
    /usr/lib/python3/dist-packages/pip/utils/build.py
    /usr/lib/python3/dist-packages/pip/compat
    /usr/lib/python3/dist-packages/pip/compat/dictconfig.py
    /usr/lib/python3/dist-packages/pip/compat/__init__.py
    /usr/lib/python3/dist-packages/pip/compat/ordereddict.py
    /usr/lib/python3/dist-packages/pip/models
    /usr/lib/python3/dist-packages/pip/models/index.py
    /usr/lib/python3/dist-packages/pip/models/__init__.py
    /usr/lib/python3/dist-packages/pip/vcs
    /usr/lib/python3/dist-packages/pip/vcs/bazaar.py
    /usr/lib/python3/dist-packages/pip/vcs/subversion.py
    /usr/lib/python3/dist-packages/pip/vcs/mercurial.py
    /usr/lib/python3/dist-packages/pip/vcs/__init__.py
    /usr/lib/python3/dist-packages/pip/vcs/git.py
    /usr/lib/python3/dist-packages/pip/cmdoptions.py
    /usr/lib/python3/dist-packages/pip/basecommand.py
    /usr/lib/python3/dist-packages/pip/commands
    /usr/lib/python3/dist-packages/pip/commands/completion.py
    /usr/lib/python3/dist-packages/pip/commands/install.py
    /usr/lib/python3/dist-packages/pip/commands/hash.py
    /usr/lib/python3/dist-packages/pip/commands/uninstall.py
    /usr/lib/python3/dist-packages/pip/commands/__init__.py
    /usr/lib/python3/dist-packages/pip/commands/list.py
    /usr/lib/python3/dist-packages/pip/commands/search.py
    /usr/lib/python3/dist-packages/pip/commands/show.py
    /usr/lib/python3/dist-packages/pip/commands/download.py
    /usr/lib/python3/dist-packages/pip/commands/wheel.py
    /usr/lib/python3/dist-packages/pip/commands/freeze.py
    /usr/lib/python3/dist-packages/pip/commands/help.py
    /usr/lib/python3/dist-packages/pip/_vendor
    /usr/lib/python3/dist-packages/pip/_vendor/__init__.py
    /usr/lib/python3/dist-packages/pip/operations
    /usr/lib/python3/dist-packages/pip/operations/__init__.py
    /usr/lib/python3/dist-packages/pip/operations/freeze.py
    /usr/lib/python3/dist-packages/pip/__init__.py
    /usr/lib/python3/dist-packages/pip/locations.py
    /usr/lib/python3/dist-packages/pip/pep425tags.py
    /usr/lib/python3/dist-packages/pip/exceptions.py
    /usr/lib/python3/dist-packages/pip/download.py
    /usr/lib/python3/dist-packages/pip/wheel.py
    /usr/share
    /usr/share/man
    /usr/share/man/man1
    /usr/share/man/man1/pip3.1.gz
    /usr/share/doc
    /usr/share/doc/python3-pip
    /usr/share/doc/python3-pip/copyright
    /usr/bin
    /usr/bin/pip3
    /usr/share/doc/python3-pip/changelog.Debian.gz
    

    which implies that pip3 has been installed.

    How do I resolve this issue?

    Some more details: I have python 2.7 and python 3 installed in /usr/local/lib/. The python 2.7 has the following pip installations:

    /usr/local/lib/python2.7/dist-packages/pip
    /usr/local/lib/python2.7/dist-packages/pip-10.0.0.dist-info
    /usr/local/lib/python2.7/dist-packages/pip-18.0.dist-info
    

    while there is no pip3 installation in /usr/local/lib/python3.5/. There is only a pip installation in python3.

    How do I resolve this issue?

    • Ravexina
      Ravexina over 5 years
      what is the output of echo $PATH?
    • thegreatcoder
      thegreatcoder over 5 years
      /home/shuba/.local/share/umake/bin:/home/shuba/bin:/home/shu‌​ba/.local/bin:/usr/l‌​ocal/sbin:/usr/local‌​/bin:/usr/sbin:/usr/‌​bin:/sbin:/bin:/usr/‌​games:/usr/local/gam‌​es:/snap/bin:/usr/li‌​b/jvm/java-8-oracle/‌​bin:/usr/lib/jvm/jav‌​a-8-oracle/db/bin:/u‌​sr/lib/jvm/java-8-or‌​acle/jre/bin
    • Ravexina
      Ravexina over 5 years
      Everything seems okay in your PATH, what happens if you run pip like this: /usr/bin/pip3 -V ?
    • thegreatcoder
      thegreatcoder over 5 years
      I get this: /usr/bin/pip3 -V bash: /usr/bin/pip3: No such file or directory
    • Ravexina
      Ravexina over 5 years
      run: sudo apt install --reinstall python3-pip it might help.
    • thegreatcoder
      thegreatcoder over 5 years
      After running it, I get the output for which pip3 as usr/bin/pip3 However, if I type pip3 -v, I get this: [link] (pastebin.com/kbUECtCF)
    • thegreatcoder
      thegreatcoder over 5 years
      How do I fix this issue?
    • Ravexina
      Ravexina over 5 years
      I'm not sure what can be the cause of issue at all. but try installing: sudo apt install python3-dev
    • thegreatcoder
      thegreatcoder over 5 years
      I got the following output: pastebin.com/RyyDy4r4