Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between pip and conda?

I know pip is a package manager for python packages. However, I saw the installation on IPython's website use conda to install IPython.

Can I use pip to install IPython? Why should I use conda as another python package manager when I already have pip?

What is the difference between pip and conda?

like image 815
lazywei Avatar asked Jan 08 '14 11:01

lazywei


People also ask

Which is better pip or conda?

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

What is the difference between pip and Anaconda?

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.

Does conda use pip?

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.

Should I install packages with conda or pip?

Rather than running conda, pip and then conda again, a more reliable method is to create a new environment with the combined conda requirements and then run pip. According to the Anaconda for Practitioners Guide, many users rely on simply the “root” conda environment that is created by installing Anaconda (“base”).

What is the difference between Conda and pip 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.

Should I use conda-forge or pip or PyPI?

For general Python computing, pip and PyPI are usually fine, and the surrounding tooling tends to be better. For data science or scientific computing, however, Conda’s ability to package third-party libraries, and the centralized infrastructure provided by Conda-Forge, means setup of complex packages will often be easier.

What is the difference between Python and Conda?

Conda on the other hand can install Python packages as well as the Python interpreter directly. Another key difference between the two tools is that conda has the ability to create isolated environments that can contain different versions of Python and/or the packages installed in them.

What is the difference between Pip and PyPI?

Pip, which stands for P ip I nstalls P ackages, is Python's officially-sanctioned package manager, and is most commonly used to install packages published on the Python Package Index (PyPI). Both pip and PyPI are governed and supported by the Python Packaging Authority (PyPA).


2 Answers

Quoting from the Conda blog:

Having been involved in the python world for so long, we are all aware of pip, easy_install, and virtualenv, but these tools did not meet all of our specific requirements. The main problem is that they are focused around Python, neglecting non-Python library dependencies, such as HDF5, MKL, LLVM, etc., which do not have a setup.py in their source code and also do not install files into Python’s site-packages directory.

So Conda is a packaging tool and installer that aims to do more than what pip does; handle library dependencies outside of the Python packages as well as the Python packages themselves. Conda also creates a virtual environment, like virtualenv does.

As such, Conda should be compared to Buildout perhaps, another tool that lets you handle both Python and non-Python installation tasks.

Because Conda introduces a new packaging format, you cannot use pip and Conda interchangeably; pip cannot install the Conda package format. You can use the two tools side by side (by installing pip with conda install pip) but they do not interoperate either.

Since writing this answer, Anaconda has published a new page on Understanding Conda and Pip, which echoes this as well:

This highlights a key difference between conda and pip. 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. Conda on the other hand can install Python packages as well as the Python interpreter directly.

and further on

Occasionally a package is needed which is not available as a conda package but is available on PyPI and can be installed with pip. In these cases, it makes sense to try to use both conda and pip.

like image 50
Martijn Pieters Avatar answered Oct 23 '22 12:10

Martijn Pieters


Disclaimer: This answer describes the state of things as it was a decade ago, at that time pip did not support binary packages. Conda was specifically created to better support building and distributing binary packages, in particular data science libraries with C extensions. For reference, pip only gained widespread support for portable binary packages with wheels (pip 1.4 in 2013) and the manylinux1 specification (pip 8.1 in March 2016). See the more recent answer for more history.

Here is a short rundown:

pip

  • Python packages only.
  • Compiles everything from source. EDIT: pip now installs binary wheels, if they are available.
  • Blessed by the core Python community (i.e., Python 3.4+ includes code that automatically bootstraps pip).

conda

  • Python agnostic. The main focus of existing packages are for Python, and indeed Conda itself is written in Python, but you can also have Conda packages for C libraries, or R packages, or really anything.
  • Installs binaries. There is a tool called conda build that builds packages from source, but conda install itself installs things from already built Conda packages.
  • External. Conda is the package manager of Anaconda, the Python distribution provided by Continuum Analytics, but it can be used outside of Anaconda too. You can use it with an existing Python installation by pip installing it (though this is not recommended unless you have a good reason to use an existing installation).

In both cases:

  • Written in Python
  • Open source (Conda is BSD and pip is MIT)

The first two bullet points of Conda are really what make it advantageous over pip for many packages. Since pip installs from source, it can be painful to install things with it if you are unable to compile the source code (this is especially true on Windows, but it can even be true on Linux if the packages have some difficult C or FORTRAN library dependencies). Conda installs from binary, meaning that someone (e.g., Continuum) has already done the hard work of compiling the package, and so the installation is easy.

There are also some differences if you are interested in building your own packages. For instance, pip is built on top of setuptools, whereas Conda uses its own format, which has some advantages (like being static, and again, Python agnostic).

like image 31
asmeurer Avatar answered Oct 23 '22 12:10

asmeurer