Skip to main content

Overview

The conda create command creates a new conda environment with the specified packages. This is the primary way to create isolated Python environments for different projects.

Syntax

conda create [options] [package_spec ...]
To use the newly-created environment, use conda activate envname. This command requires either the -n NAME or -p PREFIX option unless --dry-run or --download-only is specified.

Target Environment Specification

-n, --name
string
Name of environment.
-p, --prefix
string
Full path to environment location (i.e. prefix).

Core Options

--clone
string
Create a new environment as a copy of an existing local environment.
When using --clone, you cannot specify additional packages or use the --file argument.
--file
string
Read package versions from the given file. Repeated file specifications can be passed (e.g. --file=file1 --file=file2).
--dev
boolean
Use sys.executable -m conda in wrapper scripts instead of CONDA_EXE. This is mainly for use during tests where we test new conda sources against old Python versions.

Channel Customization

-c, --channel
string
Additional channel to search for packages. These are URLs searched in the order they are given (including local directories using the ‘file://’ syntax or simply a path like ‘/home/conda/mychan’ or ’../mychan’).
--use-local
boolean
Use locally built packages. Identical to ‘-c local’.
-O, --override-channels
boolean
Do not search default or .condarc channels. Requires --channel.
--repodata-fn
string
Specify file name of repodata on the remote server where your channels are configured or within local backups.

Solver Mode Modifiers

--strict-channel-priority
boolean
Packages in lower priority channels are not considered if a package with the same name appears in a higher priority channel.
--no-channel-priority
boolean
Package version takes precedence over channel priority. Overrides the value given by conda config --show channel_priority.
--no-deps
boolean
Do not install, update, remove, or change dependencies. This WILL lead to broken environments and inconsistent behavior. Use at your own risk.
--only-deps
boolean
Only install dependencies.
--no-pin
boolean
Ignore pinned file.

Solver Backend

--solver
string
Choose which solver backend to use.

Platform Options

--platform, --subdir
string
Target platform/subdir for the environment (e.g., linux-64, osx-64, win-64).

Output and Prompt Options

--json
boolean
Report all output as json. Suitable for using conda programmatically.
-d, --dry-run
boolean
Only display what would have been done.
-y, --yes
boolean
Sets any confirmation values to ‘yes’ automatically. Users will not be asked to confirm any adding, deleting, backups, etc.
-v, --verbose
boolean
Can be used multiple times. Once for INFO, twice for DEBUG, three times for TRACE.
-q, --quiet
boolean
Do not display progress bar.
--download-only
boolean
Solve an environment and ensure package caches are populated, but exit prior to unlinking and linking packages into the prefix.

Networking Options

-C, --use-index-cache
boolean
Use cache of channel index files, even if it has expired.
-k, --insecure
boolean
Allow conda to perform “insecure” SSL connections and transfers. Equivalent to setting ‘ssl_verify’ to ‘false’.
--offline
boolean
Offline mode. Don’t connect to the Internet.

Examples

Create an environment with a specific package

conda create -n myenv sqlite
Creates a new environment called myenv with the sqlite package installed.

Create an environment with multiple packages

conda create -n datascience python=3.11 numpy pandas matplotlib
Creates an environment with Python 3.11 and several data science packages.

Create an environment from a file

conda create -n myenv --file requirements.txt
Creates an environment based on packages listed in requirements.txt.

Clone an existing environment

conda create -n env2 --clone /path/to/env1
Creates a new environment env2 as a copy of an existing environment env1.

Create an environment at a specific location

conda create -p /home/user/myenv python=3.11
Creates an environment at the specified path instead of in the default envs directory.

Create with specific channel

conda create -n myenv -c conda-forge python=3.11 scikit-learn
Creates an environment using packages from the conda-forge channel.

Common Use Cases

Use conda create to isolate dependencies for different projects:
conda create -n project1 python=3.11 flask
conda create -n project2 python=3.9 django
Each project has its own Python version and dependencies.
Create environments with different Python versions for testing:
conda create -n py39-test python=3.9 pytest
conda create -n py311-test python=3.11 pytest
Use environment.yml files for reproducibility:
conda create -n myenv --file environment.yml
Clone an environment before making major changes:
conda create -n myenv-backup --clone myenv

Build docs developers (and LLMs) love