TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/conda/conda/llms.txt
Use this file to discover all available pages before exploring further.
conda run command allows you to run executables within a specified conda environment without manually activating it first.
Syntax
Arguments
EXECUTABLE [ARGS ...]
Executable name with additional arguments to be passed to the executable on invocation.
Use -- to separate conda options from the executable’s options:
Options
-n, --name NAME
Name of the environment to run the command in.
-p, --prefix PREFIX
Full path to the environment prefix to run the command in.
--cwd DIRECTORY
Current working directory for the command to run in. Defaults to the user’s current working directory if not specified.
-v, --verbose
Use once for detailed output, twice for even more detailed output.
-s, --no-capture-output / --live-stream
Don’t capture stdout/stderr (standard out/standard error). By default, conda run captures output and displays it after the command completes. This flag streams output in real-time.
--debug-wrapper-scripts
When set, where implemented, the shell wrapper scripts will use the echo command to print debugging information to stderr (standard error).
--dev
(Deprecated in 26.9, will be removed in 27.3)
Sets CONDA_EXE to python -m conda, assuming the current working directory contains the root of conda development sources. This is mainly for use during tests where we test new conda sources against old Python versions.
Common Use Cases
Run a Python script in a specific environment
Check Python version in an environment
Run command with arguments that start with dashes
Use-- to separate conda options from the executable’s options:
Run command in specific directory
Stream output in real-time
By default, conda run captures and displays output after completion. For long-running processes:Run command with environment prefix
If you prefer to specify the full path:How It Works
When you runconda run:
- Conda creates a temporary shell wrapper script
- The script sets up the environment (similar to activation)
- The command is executed within that environment
- Output is captured (unless
--no-capture-outputis used) - The wrapper script is cleaned up after execution
- The exit code of the command is returned
conda run is useful for:- Running commands in environments without manual activation
- Scripting and automation
- CI/CD pipelines
- Running one-off commands in different environments
Exit Codes
The exit code ofconda run matches the exit code of the executed command. If the command fails, conda run will also fail with the same exit code.