What is the difference between pip and conda?

后端 未结 12 1093
名媛妹妹
名媛妹妹 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:54

    Quoting from Conda: Myths and Misconceptions (a comprehensive description):

    ...

    Myth #3: Conda and pip are direct competitors

    Reality: Conda and pip serve different purposes, and only directly compete in a small subset of tasks: namely installing Python packages in isolated environments.

    Pip, which stands for Pip Installs Packages, 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).

    In short, pip is a general-purpose manager for Python packages; conda is a language-agnostic cross-platform environment manager. For the user, the most salient distinction is probably this: pip installs python packages within any environment; conda installs any package within conda environments. If all you are doing is installing Python packages within an isolated environment, conda and pip+virtualenv are mostly interchangeable, modulo some difference in dependency handling and package availability. By isolated environment I mean a conda-env or virtualenv, in which you can install packages without modifying your system Python installation.

    Even setting aside Myth #2, if we focus on just installation of Python packages, conda and pip serve different audiences and different purposes. If you want to, say, manage Python packages within an existing system Python installation, conda can't help you: by design, it can only install packages within conda environments. If you want to, say, work with the many Python packages which rely on external dependencies (NumPy, SciPy, and Matplotlib are common examples), while tracking those dependencies in a meaningful way, pip can't help you: by design, it manages Python packages and only Python packages.

    Conda and pip are not competitors, but rather tools focused on different groups of users and patterns of use.

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

    For WINDOWS users

    "standard" packaging tools situation is improving recently:

    • on pypi itself, there are now 48% of wheel packages as of sept. 11th 2015 (up from 38% in may 2015 , 24% in sept. 2014),

    • the wheel format is now supported out-of-the-box per latest python 2.7.9,

    "standard"+"tweaks" packaging tools situation is improving also:

    • you can find nearly all scientific packages on wheel format at http://www.lfd.uci.edu/~gohlke/pythonlibs,

    • the mingwpy project may bring one day a 'compilation' package to windows users, allowing to install everything from source when needed.

    "Conda" packaging remains better for the market it serves, and highlights areas where the "standard" should improve.

    (also, the dependency specification multiple-effort, in standard wheel system and in conda system, or buildout, is not very pythonic, it would be nice if all these packaging 'core' techniques could converge, via a sort of PEP)

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

    Can I use pip to install iPython?

    Sure, both (first approach on page)

    pip install ipython
    

    and (third approach, second is conda)

    You can manually download IPython from GitHub or PyPI. To install one of these versions, unpack it and run the following from the top-level source directory using the Terminal:

    pip install .
    

    are officially recommended ways to install.

    Why should I use conda as another python package manager when I already have pip?

    As said here:

    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.

    Conda surpasses pip in (YMMV)

    • projects that use non-python tools
    • sharing with colleagues
    • switching between versions
    • switching between projects with different library versions

    What is the difference between pip and conda?

    That is extensively answered by everyone else.

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

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

    0 讨论(0)
  • 2020-11-22 09:05

    Quote from Conda for Data Science article onto Continuum's website:

    Conda vs pip

    Python programmers are probably familiar with pip to download packages from PyPI and manage their requirements. Although, both conda and pip are package managers, they are very different:

    • Pip is specific for Python packages and conda is language-agnostic, which means we can use conda to manage packages from any language Pip compiles from source and conda installs binaries, removing the burden of compilation
    • Conda creates language-agnostic environments natively whereas pip relies on virtualenv to manage only Python environments Though it is recommended to always use conda packages, conda also includes pip, so you don’t have to choose between the two. For example, to install a python package that does not have a conda package, but is available through pip, just run, for example:
    conda install pip
    pip install gensim
    
    0 讨论(0)
  • 2020-11-22 09:08

    I may have found one further difference of a minor nature. I have my python environments under /usr rather than /home or whatever. In order to install to it, I would have to use sudo install pip. For me, the undesired side effect of sudo install pip was slightly different than what are widely reported elsewhere: after doing so, I had to run python with sudo in order to import any of the sudo-installed packages. I gave up on that and eventually found I could use sudo conda to install packages to an environment under /usr which then imported normally without needing sudo permission for python. I even used sudo conda to fix a broken pip rather than using sudo pip uninstall pip or sudo pip --upgrade install pip.

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