Searene
Searene

Reputation: 27644

pip3: command not found but python3-pip is already installed

I can't use pip3 though python3-pip has already been installed. How to solve the problem?

sudo pip3 install virtualenv
sudo: pip3: command not found

sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pip is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.

Upvotes: 72

Views: 215477

Answers (10)

user4233921
user4233921

Reputation:

Same issue on Fedora 23. I had to reinstall python3-pip to generate the proper pip3 folders in /usr/bin/.

sudo dnf reinstall python3-pip

Upvotes: 8

Deepanshu Mehta
Deepanshu Mehta

Reputation: 1790

This is the generic solution for all type of issues like Package 'xyz' has no installation candidate or command not found but is already installed:

just run this command

rmadison <package_name>

eg: rmadison python3-pip

The above command will query the apt database.

if you were not able to run the above command: sudo apt install devscripts and then run rmadison command.

and to query for specific distro use | grep focal -> rmadison <package_name> | grep focal

Upvotes: 0

Amandeep
Amandeep

Reputation: 159

On Windows 10 install Python from Python.org Once installed add these two paths to PATH env variable C:\Users<your user>\AppData\Local\Programs\Python\Python38 C:\Users<your user>\AppData\Local\Programs\Python\Python38\Scripts

Open command prompt and following command should be working python --version pip --version

Upvotes: 0

mutluergoz
mutluergoz

Reputation: 11

For Kali, you must use this code after the update.

$sudo python3 get-pip.py

or if you write this, it also works but not supported anymore. So don't use:

$sudo python get-pip.py

Upvotes: 1

nightlytrails
nightlytrails

Reputation: 2682

Probably pip3 is installed in /usr/local/bin/ which is not in the PATH of the sudo (root) user. Use this instead

sudo /usr/local/bin/pip3 install virtualenv

Upvotes: 0

user2394284
user2394284

Reputation: 6038

You can use python3 -m pip as a synonym for pip3. That has saved me a couple of times.

Upvotes: 175

Mikhail Katulin
Mikhail Katulin

Reputation: 31

You can make symbolic link to you pip3:

sudo ln -s $(which pip3) /usr/bin/pip3

It helps me in RHEL 7.6

Upvotes: 3

Neville Lusimba
Neville Lusimba

Reputation: 887

There is no need to install virtualenv. Just create a workfolder and open your editor in it. Assuming you are using vscode,

$mkdir Directory && cd Directory
$code .

It is the best way to avoid breaking Ubuntu/linux dependencies by messing around with environments. In case anything goes wrong, you can always delete that folder and begin afresh. Otherwise, messing up with the ubuntu/linux python environments could mess up system apps/OS (including the terminal). Then you can press shift+P and type python:select interpreter. Choose any version above 3. After that you can do

$pip3 -v

It will display the pip version. You can then use it for installations as

$pip3 install Library

Upvotes: -2

Kumar
Kumar

Reputation: 1017

I had a similar issue. In my case, I had to uninstall and then reinstall pip3:

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

Upvotes: 71

Mox
Mox

Reputation: 2463

Run

locate pip3

it should give you a list of results like this

/<path>/pip3
/<path>/pip3.x

go to /usr/local/bin to make a symbolic link to where your pip3 is located

ln -s /<path>/pip3.x /usr/local/bin/pip3

Upvotes: 53

Related Questions