71

I am testing a Python3 program in several computers. To do that, I need to install a library of Python with pip3.

So first, I was installing python3-pip in each computer (everyone is running Kubuntu OS). Everything was OK, and then I installed the package I needed with pip3, and I managed to do that except for one computer.

In that computer, python3-pip was apparently installed succesfully, but when I look for the package, I get this error (the translation is homemade):

Command «pip3» was not found, maybe you wanted to say:
 The command «pip» from the package «python-pip» (universe)
pip3: command not found

EDIT

Results of dpkg -L python3-pip:

/.
/usr
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/pip-3.2.1.gz
/usr/share/doc
/usr/share/doc/python3-pip
/usr/share/doc/python3-pip/changelog.Debian.gz
/usr/share/doc/python3-pip/copyright
/usr/bin
/usr/bin/pip-3.2
/usr/lib
/usr/lib/python3
/usr/lib/python3/dist-packages
/usr/lib/python3/dist-packages/pip
/usr/lib/python3/dist-packages/pip/log.py
/usr/lib/python3/dist-packages/pip/commands
/usr/lib/python3/dist-packages/pip/commands/unzip.py
/usr/lib/python3/dist-packages/pip/commands/zip.py
/usr/lib/python3/dist-packages/pip/commands/install.py
/usr/lib/python3/dist-packages/pip/commands/completion.py
/usr/lib/python3/dist-packages/pip/commands/uninstall.py
/usr/lib/python3/dist-packages/pip/commands/search.py
/usr/lib/python3/dist-packages/pip/commands/freeze.py
/usr/lib/python3/dist-packages/pip/commands/__init__.py
/usr/lib/python3/dist-packages/pip/commands/help.py
/usr/lib/python3/dist-packages/pip/commands/bundle.py
/usr/lib/python3/dist-packages/pip/_pkgutil.py
/usr/lib/python3/dist-packages/pip/util.py
/usr/lib/python3/dist-packages/pip/status_codes.py
/usr/lib/python3/dist-packages/pip/vcs
/usr/lib/python3/dist-packages/pip/vcs/__init__.py
/usr/lib/python3/dist-packages/pip/vcs/mercurial.py
/usr/lib/python3/dist-packages/pip/vcs/git.py
/usr/lib/python3/dist-packages/pip/vcs/bazaar.py
/usr/lib/python3/dist-packages/pip/vcs/subversion.py
/usr/lib/python3/dist-packages/pip/baseparser.py
/usr/lib/python3/dist-packages/pip/exceptions.py
/usr/lib/python3/dist-packages/pip/index.py
/usr/lib/python3/dist-packages/pip/basecommand.py
/usr/lib/python3/dist-packages/pip/req.py
/usr/lib/python3/dist-packages/pip/locations.py
/usr/lib/python3/dist-packages/pip/__init__.py
/usr/lib/python3/dist-packages/pip/runner.py
/usr/lib/python3/dist-packages/pip/backwardcompat.py
/usr/lib/python3/dist-packages/pip/download.py
/usr/lib/python3/dist-packages/pip-1.1.egg-info
/usr/lib/python3/dist-packages/pip-1.1.egg-info/SOURCES.txt
/usr/lib/python3/dist-packages/pip-1.1.egg-info/not-zip-safe
/usr/lib/python3/dist-packages/pip-1.1.egg-info/top_level.txt
/usr/lib/python3/dist-packages/pip-1.1.egg-info/PKG-INFO
/usr/lib/python3/dist-packages/pip-1.1.egg-info/entry_points.txt
/usr/lib/python3/dist-packages/pip-1.1.egg-info/dependency_links.txt
galoget
  • 393
  • 2
  • 10
forvas
  • 883
  • 1
  • 7
  • 16
  • Could you maybe accept the answer, if it was helpful? This marks the question as resolved and will help future users. – MERose Nov 08 '16 at 16:00

4 Answers4

98

One of three things will likely fix it:

  1. In case python3-pip did not install correctly, re-install it:

    This is used for Debian-based distros like Ubuntu, Mint:

    sudo apt-get remove python3-pip; sudo apt-get install python3-pip
    

    If using Fedora, CentOS, RHEL, please use:

    sudo dnf reinstall python3-pip
    
  2. Try using the command python3-pip instead (works on Fedora; I don't have a copy of Kubuntu to try it on).

  3. Just a wild guess...check pip --version. There is a slight possibility that after installing python3-pip the new pip would replace the old pip (perhaps via alternatives?)

EDIT
Now that the output of dpkg -L python3-pip has been added to the question, I can provide the answer.

The correct command name to use is: pip-3.2.

galoget
  • 393
  • 2
  • 10
BenjiWiebe
  • 8,854
  • 11
  • 42
  • 65
  • 2
    It's not possible to reinstall python-pip3 (in Fedora at least), since dnf depends on it. In my case, I have python-pip3 installed, it should have installed /usr/bin/pip3, but didn't. `rpm -ql python3-pip|grep bin/pip3` shows `/usr/bin/pip3 /usr/bin/pip3.5`, but `ls /usr/bin|grep pip3` doesn't find them. – dfarrell07 Jan 03 '17 at 17:54
  • 2
    @dfarrell07 Wrong. You are not allowed to `dnf remove` it, since `dnf` depends on it. However, you are allowed to `dnf reinstall` it, which is what is needed anyways. `dnf` (and `yum` before it) is smart enough to know that reinstalling a needed package is OK even if removing it isn't. – BenjiWiebe Jan 31 '17 at 05:38
  • That wasn't in your answer, but I updated it to make it clear. – dfarrell07 Feb 01 '17 at 15:08
  • 1
    should based on the python version, such as python 3.6, `pip-3.6` – Xin Meng Nov 21 '18 at 17:09
  • @XinMeng Correct. I was pointing out that the command name from the `dpkg` output is `pip-3.2`. Obviously the `dpkg` output will be different for a different version of `pip`. – BenjiWiebe Nov 30 '18 at 03:55
  • I had `python3-pip` installed and was able to use `pip3` to install the packages, I cant directly answer this question but hopefully this comment will help others – Rodrigo Graça Apr 01 '20 at 14:58
  • This is the right answer but not that helpful, because many utilities/scripts out there will attempt to execute "pip3", not "pip-3.6" etc. You can't go and fix all those third-party scripts. My suggestion, after installing python3-pip, check the binary path and then link it -- e.g. `sudo ln -s /usr/bin/pip-3.6 /usr/bin/pip3`. – Elliot Nelson Sep 24 '20 at 23:46
5

I ran into this problem and found the solution. The python3-pip package installed a pip-3.2 binary.

Executing pip-3.2 --version shows:

pip 1.1 from /usr/lib/python3/dist-packages (python 3.2)

Whereas python3-pip gives the command not found message.

I tested it on a "clean" download from here: https://sourceforge.net/projects/rpiqemuwindows/

I checked for pip-3.2 before installing python3-pip and then after.

galoget
  • 393
  • 2
  • 10
Joseph Alway
  • 51
  • 1
  • 1
0

If you have several Python versions installed, you might get:

bash: pip3: command not found...
Packages providing this file are:
'python36'
'python39-pip'
'python38-pip'

Listing the installed pips shows why:

$ ls -l /usr/bin | grep pip.*3

pip-3.6 -> ./pip3.6
pip3.6
pip-3.9 -> ./pip3.9
pip3.9

Resetting pip3 link could resolve it:

$ sudo ln -s /usr/bin/pip3.9 /usr/bin/pip3
$ pip3

Usage:   
  pip3 <command> [options]
Noam Manos
  • 1,804
  • 1
  • 20
  • 20
-3

You can use use easy_install:

apt-get install python3-setuptools
easy_install3 pip
Stephen Rauch
  • 3,091
  • 10
  • 23
  • 26