Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the effect of using pip to install python packages on anaconda?

I have installed a fresh anaconda v4.4. I realized that python packages can be installed using both conda and pip. What is the effect of using pip to install python packages instead of conda when using anaconda? Will the pip-installed libraries cease to function? I am using python v3

EDIT: I don't think the question is a duplicate of What is the difference between pip and conda? That question explains the difference between pip and conda but does not talk about the effect of using pip when conda can be used.

like image 339
user3848207 Avatar asked Aug 28 '17 11:08

user3848207


People also ask

Should I install packages with pip or conda?

It's fully recommended to use pip inside of conda. It's better to install using conda, but for any packages that don't have a conda build, it's perfectly acceptable to use pip.

Can you use pip install with Anaconda?

Both pip and conda are included in Anaconda and Miniconda, so you do not need to install them separately. Conda environments replace virtualenv, so there is no need to activate a virtualenv before using pip. It is possible to have pip installed outside a conda environment or inside a conda environment.

What is the difference between pip install and conda install?

Pip installs Python packages whereas conda installs packages which may contain software written in any language. For example, before using pip, a Python interpreter must be installed via a system package manager or by downloading and running an installer.

Where does pip install packages in Anaconda?

This will install pip to your venv directory. Find your anaconda directory, and find the actual venv folder. It should be somewhere like /anaconda/envs/venv_name/ . Install new packages by doing /anaconda/envs/venv_name/bin/pip install package_name .


1 Answers

Everything might keep working if you use pip to install vs conda. However, Conda cannot manage dependencies that pip has installed - it cannot upgrade them, or remove them. More importantly, conda will install a package even if its already been installed with pip! Try this test:

conda create -n testenv python=3
conda activate testenv
pip install numpy
conda install scipy

You will see from the third command that conda will want to re-install NumPy, even though it has already been installed with pip. This can cause problems if there are C libraries whose linking is different, or something like that. In general, whenever possible, use conda to install packages into conda environments.

like image 125
darthbith Avatar answered Oct 16 '22 14:10

darthbith