Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pip and conda comparison #1794

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/discussions/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
62 changes: 62 additions & 0 deletions source/discussions/pip-and-conda-comparison.rst
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 7 additions & 1 deletion source/guides/tool-recommendations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down