Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use pip or conda to manage packages? [duplicate]

Tags:

python

pip

conda

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?

like image 492
amora Avatar asked Jan 20 '16 07:01

amora


People also ask

Should I use 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.

Is it bad to use pip in conda environment?

Once pip is used to install packages and software into a conda environment, conda will be “unaware” of these changes and may make modifications that would break the environment and result in errors.

Whats the difference between conda and pip?

The fundamental difference between pip and Conda packaging is what they put in packages. Pip packages are Python libraries like NumPy or matplotlib . Conda packages include Python libraries (NumPy or matplotlib ), C libraries ( libjpeg ), and executables (like C compilers, and even the Python interpreter itself).

Can I install packages with both pip and conda?

You can install pip in the current conda environment with the command conda install pip , as discussed in Using pip in an environment. If there are instances of pip installed both inside and outside the current conda environment, the instance of pip installed inside the current conda environment is used.


2 Answers

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).

like image 148
Pierre de Buyl Avatar answered Oct 09 '22 08:10

Pierre de Buyl


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?.

like image 33
serv-inc Avatar answered Oct 09 '22 09:10

serv-inc