conda
A system-level, binary package and environment manager running on all major operating systems and platforms.
Top Related Projects
The Fast Cross-Platform Package Manager
The Python package installer
C++ Library Manager for Windows, Linux, and MacOS
🍺 The missing package manager for macOS (or Linux)
Python packaging and dependency management made easy
Simple Python version management
Quick Overview
Conda is an open-source package management system and environment management system that runs on Windows, macOS, and Linux. It quickly installs, runs, and updates packages and their dependencies. Conda easily creates, saves, loads, and switches between environments on your local computer.
Pros
- Cross-platform compatibility (Windows, macOS, Linux)
- Manages both Python and non-Python packages
- Allows for easy creation and management of isolated environments
- Integrates well with many data science and scientific computing tools
Cons
- Can be slower than some other package managers
- Occasional conflicts between conda and pip-installed packages
- Learning curve for users new to package management systems
- Large installation size compared to some alternatives
Code Examples
- Creating a new environment:
conda create --name myenv python=3.9
This command creates a new environment named "myenv" with Python 3.9 installed.
- Installing a package:
conda install numpy
This command installs the NumPy package in the current environment.
- Activating an environment:
conda activate myenv
This command activates the "myenv" environment.
- Listing installed packages:
conda list
This command displays a list of all packages installed in the current environment.
Getting Started
To get started with Conda:
- Download and install Miniconda or Anaconda from the official website.
- Open a terminal or command prompt.
- Create a new environment:
conda create --name myproject python=3.9
- Activate the environment:
conda activate myproject
- Install required packages:
conda install numpy pandas matplotlib
- Start using Conda in your projects!
For more detailed instructions and advanced usage, refer to the official Conda documentation.
Competitor Comparisons
The Fast Cross-Platform Package Manager
Pros of mamba
- Significantly faster package resolution and installation
- Written in C++, offering better performance than Python-based Conda
- Parallel downloads and multi-threaded solver for improved efficiency
Cons of mamba
- Smaller ecosystem and community compared to Conda
- May lack some advanced features or edge case handling of Conda
- Potential compatibility issues with certain Conda-specific workflows
Code comparison
Mamba:
mamba install numpy pandas
mamba env create -f environment.yml
mamba update --all
Conda:
conda install numpy pandas
conda env create -f environment.yml
conda update --all
The basic syntax for package management is very similar between mamba and conda. The main difference is replacing conda
with mamba
in the command. Mamba aims to be a drop-in replacement for most Conda commands, allowing users to easily switch between the two tools.
Both projects use YAML files for environment specifications, making it easy to share and reproduce environments across systems. The primary advantage of mamba lies in its performance improvements rather than significant changes in usage or syntax.
The Python package installer
Pros of pip
- Simpler and more lightweight package management
- Faster installation for Python-only packages
- More widely used in the Python community
Cons of pip
- Limited to Python packages only
- Lacks built-in environment management
- Can lead to dependency conflicts more easily
Code comparison
pip:
pip install package_name
pip list
pip freeze > requirements.txt
conda:
conda install package_name
conda list
conda env export > environment.yml
Summary
pip is a lightweight, Python-specific package manager that's widely used in the community. It's simpler and faster for Python-only packages but lacks built-in environment management.
conda is a more comprehensive package manager that handles multiple programming languages and includes environment management. It's better suited for complex scientific computing environments but can be slower and more resource-intensive.
The choice between pip and conda depends on your specific needs, with pip being ideal for Python-centric projects and conda excelling in multi-language scientific computing scenarios.
C++ Library Manager for Windows, Linux, and MacOS
Pros of vcpkg
- Focuses on C and C++ libraries, providing better support for native development
- Integrates well with CMake, making it easier to use in C++ projects
- Supports cross-compilation for various platforms and architectures
Cons of vcpkg
- Limited to C and C++ libraries, lacking support for other programming languages
- Smaller ecosystem compared to conda, with fewer available packages
- Steeper learning curve for developers not familiar with C++ build systems
Code Comparison
vcpkg:
find_package(CURL CONFIG REQUIRED)
target_link_libraries(main PRIVATE CURL::libcurl)
conda:
dependencies:
- curl
Summary
vcpkg is tailored for C/C++ development, offering strong integration with CMake and cross-compilation support. However, it has a narrower focus and smaller ecosystem compared to conda. conda provides a more versatile package management solution for multiple programming languages but may not offer the same level of native development support as vcpkg. The choice between the two depends on the specific project requirements and the primary programming language used.
🍺 The missing package manager for macOS (or Linux)
Pros of Homebrew
- Simpler and more intuitive command-line interface
- Faster installation and update processes
- Better integration with macOS system packages
Cons of Homebrew
- Limited to macOS and Linux, not cross-platform like Conda
- Less suitable for managing complex Python environments
- Fewer options for creating isolated environments
Code Comparison
Homebrew:
brew install python
brew upgrade python
Conda:
conda create -n myenv python
conda activate myenv
conda update python
Homebrew focuses on system-wide package management with a straightforward approach, while Conda provides more granular control over environments, especially for Python and data science projects. Homebrew's simplicity makes it popular for general-purpose package management on macOS, but Conda's cross-platform compatibility and ability to manage complex dependencies give it an edge for scientific computing and development environments.
Python packaging and dependency management made easy
Pros of Poetry
- Simpler and more intuitive dependency management
- Faster installation and resolution of dependencies
- Better handling of development dependencies and virtual environments
Cons of Poetry
- Limited support for non-Python packages and system-level dependencies
- Smaller ecosystem and community compared to Conda
- Less suitable for data science and scientific computing workflows
Code Comparison
Poetry:
[tool.poetry]
name = "my-project"
version = "0.1.0"
description = "A sample project"
[tool.poetry.dependencies]
python = "^3.9"
requests = "^2.25.1"
[tool.poetry.dev-dependencies]
pytest = "^6.2.3"
Conda:
name: my-environment
channels:
- defaults
dependencies:
- python=3.9
- requests=2.25.1
- pytest=6.2.3
Poetry focuses on Python-specific dependency management with a more modern, declarative approach. Conda, on the other hand, provides a broader package management system that can handle non-Python packages and is more suitable for complex scientific computing environments. Poetry excels in simplicity and speed for Python projects, while Conda offers greater flexibility and a larger ecosystem for diverse development needs.
Simple Python version management
Pros of pyenv
- Lightweight and focused solely on Python version management
- Allows easy switching between Python versions per project or globally
- Integrates well with other tools and doesn't impose a specific package management system
Cons of pyenv
- Doesn't handle package management, requiring additional tools like pip or poetry
- Limited to Python environments, unlike Conda's support for multiple languages
- May require more manual configuration for complex environments
Code Comparison
pyenv:
pyenv install 3.9.5
pyenv local 3.9.5
python --version
conda:
conda create -n myenv python=3.9.5
conda activate myenv
python --version
Key Differences
pyenv focuses exclusively on Python version management, offering a streamlined approach for developers working primarily with Python. It's ideal for projects requiring specific Python versions but doesn't handle package management.
Conda, on the other hand, provides a more comprehensive solution, managing both Python versions and packages. It supports multiple programming languages and offers robust environment management, making it suitable for complex scientific computing setups.
The choice between pyenv and conda depends on project requirements, with pyenv being simpler for Python-centric workflows and conda offering more extensive features for diverse development environments.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Conda is a cross-platform, language-agnostic binary package manager. It is a package manager used in conda distributions like Miniforge and the Anaconda Distribution, but it may be used for other systems as well. Conda makes environments first-class citizens, making it easy to create independent environments even for C libraries. The conda command line interface is written entirely in Python, and is BSD licensed open source.
Conda is enhanced by organizations, tools, and repositories created and managed by the amazing members of the conda community. Some of them can be found here.
Installation
To bootstrap a minimal distribution, use a minimal installer such as Miniconda or Miniforge.
Conda is also included in the Anaconda Distribution.
Updating conda
To update conda
to the newest version, use the following command:
$ conda update -n base conda
[!TIP] It is possible that
conda update
does not install the newest version if the existingconda
version is far behind the current release. In this case, updating needs to be done in stages.For example, to update from
conda 4.12
toconda 23.10.0
,conda 22.11.1
needs to be installed first:$ conda install -n base conda=22.11.1 $ conda update conda
Getting Started
If you install the Anaconda Distribution, you will already have hundreds of packages installed. You can see what packages are installed by running:
$ conda list
to see all the packages that are available, use:
$ conda search
and to install a package, use
$ conda install <package-name>
The real power of conda comes from its ability to manage environments. In conda, an environment can be thought of as a completely separate installation. Conda installs packages into environments efficiently using hard links by default when it is possible, so environments are space efficient, and take seconds to create.
The default environment, which conda
itself is installed into, is called base
.
To create another environment, use the conda create
command.
For instance, to create an environment with PyTorch, you would run:
$ conda create --name ml-project pytorch
This creates an environment called ml-project
with the latest version of PyTorch, and its dependencies.
We can now activate this environment:
$ conda activate ml-project
This puts the bin
directory of the ml-project
environment in the front of the PATH
,
and sets it as the default environment for all subsequent conda commands.
To go back to the base environment, use:
$ conda deactivate
Building Your Own Packages
You can easily build your own packages for conda, and upload them
to anaconda.org, a free service for hosting
packages for conda, as well as other package managers.
To build a package, create a recipe. Package building documentation is available
here.
See AnacondaRecipes for the recipes that make up the Anaconda Distribution and defaults
channel.
Conda-forge and Bioconda are community-driven conda-based distributions.
To upload to anaconda.org, create an account. Then, install the anaconda-client and login:
$ conda install anaconda-client
$ anaconda login
Then, after you build your recipe:
$ conda build <recipe-dir>
you will be prompted to upload to anaconda.org.
To add your anaconda.org channel, or other's channels, to conda so
that conda install
will find and install their packages, run:
$ conda config --add channels https://conda.anaconda.org/username
(replacing username
with the username of the person whose channel you want
to add).
Getting Help
Contributing
Contributions to conda are welcome. See the contributing documentation for instructions on setting up a development environment.
Top Related Projects
The Fast Cross-Platform Package Manager
The Python package installer
C++ Library Manager for Windows, Linux, and MacOS
🍺 The missing package manager for macOS (or Linux)
Python packaging and dependency management made easy
Simple Python version management
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot