Difference between conda and pip installs within a conda environment

故事扮演 提交于 2019-12-05 13:16:09

For my understanding of Conda that, it manages for you all the dependencies. For example if you have a package (like pandas) that requires another package (like numpy), it will download both (after warning you).

Where conda is becoming handy is that sometimes a specific package requires a specific version of another one (4.3 or later for example) and they can be conflicts between the packages. The requirements and conflicts define a mathematical problem that can be solved thanks to a SAT solver.

You can find informations and link about that here: https://www.continuum.io/blog/developer/new-advances-conda-0

So each time you are installing a new package, it will upgrade (or sometimes downgrade if conflicts) other packages to ensure the functionning of each package. Personnaly, I go with conda and use pip only when the package is not managed by conda

Another link if you are interested by conda: https://jakevdp.github.io/blog/2016/08/25/conda-myths-and-misconceptions/

About pip3, it is the naming used when you have both Python 2 and Python 3 installed, to avoid conflicts in the command. In a python 3 environment, the command pip will be equivalent to pip3.

For the behavior of pip, I can confirm that the installation is done only in the active environment and is not available to the other ones

The difference is that conda will know about the new environment it created but pip will not. You need to install pip inside the environment.

If you create a new environment and activate it: e.g.

conda create -n env_name
source activate env_name

Then install pip using conda:

conda install pip

(gotcha warning) if you run which pip this should give the path to the pip installation in the new conda environment (something like this):

/anaconda3/envs/env_name/bin/pip

however, just running pip install new_package still does not seem to work, you need to explicitly reference the full path (e.g. Tom Roth's blog post) when installing pip packages inside a conda environment

/anaconda3/envs/env_name/bin/pip install new_package

Hope that helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!