conda create requirements.txt code example

Example 1: create requirements.txt conda

pip freeze > requirements.txt

# OR

conda list -e > requirements.txt

Example 2: conda create environment based on requirements.txt

# using pip
pip install -r requirements.txt

# using Conda
conda create --name <env_name> --file requirements.txt

Example 3: conda create environment based on requirements.txt

pip freeze > requirements.txt

Example 4: output requirements conda

conda activate <env>
conda install pip
pip freeze > requirements.txt