What is the difference between pip and conda?

后端 未结 12 1101
名媛妹妹
名媛妹妹 2020-11-22 08:27

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

Ca

相关标签:
12条回答
  • 2020-11-22 08:41

    pip is for Python only

    conda is only for Anaconda + other scientific packages like R dependencies etc. NOT everyone needs Anaconda that already comes with Python. Anaconda is mostly for those who do Machine learning/deep learning etc. Casual Python dev won't run Anaconda on his laptop.

    0 讨论(0)
  • 2020-11-22 08:46

    pip is a package manager.

    conda is both a package manager and an environment manager.

    Detail:

    References

    • Understanding Conda and Pip
    0 讨论(0)
  • 2020-11-22 08:47

    To answer the original question,
    For installing packages, PIP and Conda are different ways to accomplish the same thing. Both are standard applications to install packages. The main difference is the source of the package files.

    • PIP/PyPI will have more "experimental" packages, or newer, less common, versions of packages
    • Conda will typically have more well established packages or versions

    An important cautionary side note: If you use both sources (pip and conda) to install packages in the same environment, this may cause issues later.

    • Recreate the environment will be more difficult
    • Fix package incompatibilities becomes more complicated

    Best practice is to select one application, PIP or Conda, to install packages, and use that application to install any packages you need. However, there are many exceptions or reasons to still use pip from within a conda environment, and vice versa. For example:

    • When there are packages you need that only exist on one, and the other doesn't have them.
    • You need a certain version that is only available in one environment
    0 讨论(0)
  • 2020-11-22 08:49

    The other answers give a fair description of the details, but I want to highlight some high-level points.

    pip is a package manager that facilitates installation, upgrade, and uninstallation of python packages. It also works with virtual python environments.

    conda is a package manager for any software (installation, upgrade and uninstallation). It also works with virtual system environments.

    One of the goals with the design of conda is to facilitate package management for the entire software stack required by users, of which one or more python versions may only be a small part. This includes low-level libraries, such as linear algebra, compilers, such as mingw on Windows, editors, version control tools like Hg and Git, or whatever else requires distribution and management.

    For version management, pip allows you to switch between and manage multiple python environments.

    Conda allows you to switch between and manage multiple general purpose environments across which multiple other things can vary in version number, like C-libraries, or compilers, or test-suites, or database engines and so on.

    Conda is not Windows-centric, but on Windows it is by far the superior solution currently available when complex scientific packages requiring compilation are required to be installed and managed.

    I want to weep when I think of how much time I have lost trying to compile many of these packages via pip on Windows, or debug failed pip install sessions when compilation was required.

    As a final point, Continuum Analytics also hosts (free) binstar.org (now called anaconda.org) to allow regular package developers to create their own custom (built!) software stacks that their package-users will be able to conda install from.

    0 讨论(0)
  • 2020-11-22 08:50

    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.

    0 讨论(0)
  • 2020-11-22 08:50

    Not to confuse you further, but you can also use pip within your conda environment, which validates the general vs. python specific managers comments above.

    conda install -n testenv pip
    source activate testenv
    pip <pip command>
    

    you can also add pip to default packages of any environment so it is present each time so you don't have to follow the above snippet.

    0 讨论(0)
提交回复
热议问题