Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manage two pip versions in conda?

I am working with conda in Windows. I accidentally installed two versions of pip using python -m pip install --upgrade pip

Now when I run conda list from the base env:

two pip versions

While pip -version gives pip 10.0.0

If I create a new env with conda create --name py3 pip and run pip --version I get an ImportError, however python -m pip --version works:

pip ImportError

How can I resolve this?

like image 988
user2573644 Avatar asked Apr 17 '18 23:04

user2573644


People also ask

Can you combine pip and conda?

Whilst conda can not install files from GitHub directly, we can use conda to install pip, and (via pip) access GitHub. Whilst over 1,500 packages are available in the Anaconda repository, this is tiny compared to the over 150,000 packages available on PyPI.

Can conda install all pip packages?

Conda will work with any version of Python, however it is limited to Anaconda and Conda environments. Pip installs all package dependencies, regardless of whether they conflict with other packages already installed.

How do I install a specific version of pip?

To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1.


1 Answers

First of all I tried to replicate your issue and when I updated pip to 10.0.1 using python -m pip install --upgrade pip, the command pip --version seems to work for me. I suppose it was a bug on version 10.0.0. Now coming to the issue that multiple pip versions are showing up in conda list of base, the <pip> one is the incorrect one and must be removed.

You can uninstall one of the pip versions

pip uninstall pip

Now finally run

conda install pip -f

And violla! Everything is back to normal. Next time, you can update pip by using

conda update pip

It is a safer method to update.

Note:-

In this scenario we have also removed the pip from your python installation as well. If you want to use pip in cmd prompt then simply use easy_install pip~=10.0.1 in cmd prompt.

like image 110
Vedarth Sharma Avatar answered Oct 05 '22 11:10

Vedarth Sharma