diff --git a/source/discussions/index.rst b/source/discussions/index.rst index 1f5ff1f2b..a27ab38aa 100644 --- a/source/discussions/index.rst +++ b/source/discussions/index.rst @@ -11,6 +11,7 @@ specific topic. If you're just trying to get stuff done, see versioning deploying-python-applications pip-vs-easy-install + pip-and-conda-comparison install-requires-vs-requirements distribution-package-vs-import-package package-formats diff --git a/source/discussions/pip-and-conda-comparison.rst b/source/discussions/pip-and-conda-comparison.rst new file mode 100644 index 000000000..7f71e23f1 --- /dev/null +++ b/source/discussions/pip-and-conda-comparison.rst @@ -0,0 +1,62 @@ +.. _`Pip and Conda Comparison`: + +======================== +Pip and Conda Comparison +======================== + +Pip is a package manager for Python, while Conda is a package manager and an +environment manager. Conda packages are not only for Python but also for other +systems. With Pip, you can only install Python packages, whereas with Conda, you +can install Python packages as well as packages for Rust, C++, and other +languages. + +Pip is heavily used in the Python ecosystem and in any type of Python project. +Conda, on the other hand, is mainly used in data science, AI, and related +projects. + +Type, Source, and Other Info of Packages +======================================== + +As Pip is a package manager specific to Python, it can only install Python +packages. It can install, uninstall, and list Python packages, among other +things. It can install packages from PyPI, VCS (GitHub), distributions (sdist, +wheels), and local projects. Pip is installed by default if you install Python +through the source or the official installer from python.org. Python packages +can be in source form (sdist) or binary form (wheel). Generally, installing +wheels is faster because there is no need for compilation. + +Conda, on the other hand, can install not only Python packages but also packages +and libraries for other languages, such as Rust and C++. Additionally, it can +install Python and Pip. Conda installs and manages packages from the Anaconda +repository and Anaconda Cloud. Conda packages are binary, so there is no need +for compilation, making them faster for packages that would otherwise require +compilation. + +Virtual Environment +=================== + +Pip is not a virtual environment manager. Therefore, ``venv`` or ``virtualenv`` is +used to create isolated environments when working with Pip. + +Conda, however, is a virtual environment manager too. It can create different +isolated environments for different projects without any external tools. + +Dependency Resolution +===================== + +While both Pip and Conda manage dependencies, Conda does a better job at +dependency resolution by using a satisfiability solver. + +With Pip, it is possible to have a broken environment because the version of a +dependency needed by one package does not match the version of the same +dependency needed by a different package. + +Availability of Packages +======================== + +The Conda repository has a limited number of Python packages compared to PyPI, +which is no surprise since PyPI is focused only on Python. As a result, many +Python packages can only be installed via Pip using the PyPI index. + +However, you can use Conda and Pip together, such as using Conda as a virtual +environment manager and Pip as a Python package manager. diff --git a/source/guides/tool-recommendations.rst b/source/guides/tool-recommendations.rst index 1ba36ed61..239f0ff2e 100644 --- a/source/guides/tool-recommendations.rst +++ b/source/guides/tool-recommendations.rst @@ -42,7 +42,13 @@ making use of the same Python interpreter (especially on Linux). For scientific software specifically, consider :ref:`Conda` or :ref:`Spack`. -.. todo:: Write a "pip vs. Conda" comparison, here or in a new discussion. +.. note:: + + Pip manages Python packages, while Conda manages packages for multiple + languages and environments. Conda excels at dependency management and creating + isolated environments, but has limited Python packages. Pip is widely used, + but struggles with dependencies and virtual environments. Using both together + can leverage their strengths. See (:ref:`Pip and Conda Comparison`). Do **not** use ``easy_install`` (part of :ref:`setuptools`), which is deprecated in favor of pip (see :ref:`pip vs easy_install` for details). Likewise, do