Use pip or conda to manage packages?

2019-04-06 16:06发布

I have been doing machine-learning for quite a long time using matlab and have recently switched to python and for installing certain packages used its package manager pip and successfully installed many packages. A few days ago I started using conda and all my previously installed packages are getting overridden.

I really want to know the difference between pip and conda and what happens if I use pip to install packages instead of conda?

标签: python pip conda
3条回答
手持菜刀,她持情操
2楼-- · 2019-04-06 16:38

I really want to know the difference between pip and conda

See What is the difference between pip and conda?

and what happens if I use pip to install packages instead of conda?

Pip in general (except for using virtualenv) installs packages either for the whole system (as root/maybe as Administrator), or for the user. Conda installs packages inside its own little world/directory, where they need to be activated, overriding pip's packages, as you already noted.

As a solution, you could install packages via your system first, pip second, and conda thirdly.

So use the system package if it's all that is needed. If that is too old f.ex., you could use pip install.

If you need a specific package, maybe only for one project, or if you need to share the project with someone else, conda seems more appropriate. See also What is the advantage of Pip over Anaconda?.

查看更多
欢心
3楼-- · 2019-04-06 16:44

Hopefully somebody more knowledgeable can expand, but it looks like Conda is a non-PIP compatible deployment tool for both Python and non-python tools/packages alike. Conda handles its own virtual installation of Python and packages as well as non-python dependencies.

PIP on the other hand is a Python-specific deployment utility; it is not aware of Conda, and Conda is not aware of PIP.

Knowing the above, it would make sense that Conda would be unaware of your previously deployed PIP packages, since the two are not compatible.

Fortunately, because the two systems are separated you should be able to revive your PIP environment should you decide that Conda is not worth switching to. Otherwise, you could try the matlib installation on Conda to mimic what you had setup on PIP:

conda install -c https://conda.anaconda.org/ioos matlab_kernel

Additional reading:

What is the difference between pip and conda?

https://conda.anaconda.org/menpo/channel/matlab

查看更多
家丑人穷心不美
4楼-- · 2019-04-06 17:02

pip and conda have common points and differences. It is hard to explain better than what Jake VanderPlas did here: https://jakevdp.github.io/blog/2016/08/25/conda-myths-and-misconceptions/

For your usecase, it would be best anyway to wipe your earlier pip-installed packages and to rely only on conda. If this is not possible due to the non-availability of packages in conda, you can install pip in conda and then use conda install pip. (from the link above).

查看更多
登录 后发表回答