Run pip for python3 on Fedora

20

7

I can't run pip for python3 (3.4) on Fedora 22. Pip for python2.7 is installed on system by default and works fine. I install package python3-pip but can't run it.

pip3, pip-3.4, python3-pip, python3 pip

The above commands don't work for me and show error 'command not found'.

I try delete pip for python2.7 but it's so important for system and I can't do that.

How can I run pip3?

Denis Savenko

Posted 2015-07-16T12:39:56.603

Reputation: 303

You can easily check the name of the command by seeing what files a package contains: rpm -ql python3-pip – Tomas Tomecek – 2019-02-19T14:37:08.253

Answers

35

If it is properly installed you can run python3 -m pip to run pip for Python 3.

Installing pip for Python 3 is done with dnf install python3-pip. This should create the script /usr/bin/pip3. Using pip to upgrade pip itself (like it suggests, because the shipped version is older) overwrites the scripts and should not be done.

If you want to use the newest version of pip and and upgrade packages given by the fedora-repo to the ones from PyPI, I recommend using a virtual environment.

burny

Posted 2015-07-16T12:39:56.603

Reputation: 466

Actually, this works from what I can tell. – Journeyman Geek – 2015-07-19T06:11:10.593

I don't know why @DavidPostill write it. This is good solution for this answer. – Denis Savenko – 2015-07-20T05:38:44.880

I do this in F21 still get bash: pip3: command not found... – dashesy – 2015-08-22T19:45:55.253

31

I could not run pip3 though my system showed python3-pip as already being installed and I'm using Fedora 22. What I did to get around this was re-install python3-pip like so:

dnf reinstall python3-pip

Doing the above adds the following entries in your /usr/bin folder:

  • /usr/bin/pip3.4
  • /usr/bin/pip3

You'll need to be have sudo rights to run the above command. Now I'm able to just call pip3 right from my CLI.

Karthic Raghupathi

Posted 2015-07-16T12:39:56.603

Reputation: 441

5Yep, something seems to be broken in Fedora 22 or some update path to it. The exact same happened for me and this solution fixed it. – Jonathon Reinhart – 2016-01-22T22:22:43.567

4Same on Fedora 23. – Chris Townsend – 2016-04-19T12:03:04.727

1I was also missing the /usr/bin/ pip3 folders on Fedora 23. reinstall fixed it for me as well. Thanks. – roflmyeggo – 2016-04-30T16:53:24.523

3Same on Fedora 25. – icc97 – 2017-03-05T17:23:58.833

0

@bumy's fix worked for me ... but I was annoyed that despite having python3-pip installed on my newly installed Fedora 22, /usr/bin/pip3 wasn't present.

So I copied /usr/bin/pip (the Python2.7 version) to /usr/bin/pip3 and modified the first line to be #!/usr/bin/python3

Now I can use pip3 as god intended ...

mjbright

Posted 2015-07-16T12:39:56.603

Reputation: 11

2

See Karthic Raghupathi's answer for a better solution.

– Jonathon Reinhart – 2016-01-22T22:34:04.743

1Don't manually copy, binaries/executables that are installed by package managers. Can have files with wrong permissions which can break updates etc – lxx – 2016-06-23T05:20:25.707