Anaconda / Conda
env → environment
1. Create a new conda env
conda create -n env_name
2. Conda env with specific version of Python and some libraries
conda create -n env_name python=3.11 pandas matplotlib
3. Deactivate a conda env
conda deactivate
4. Remove a conda env
conda remove -n env_name --all
5. Export conda env to a YAML File
conda env export --name <env_name> > <filename>.yml
- Example:
conda env export --name llm > llm.yml
6. Recreate a new env from YAML File
conda env create -f <filename>.yml
- Example:
conda env create -f imppat_env.yml
The above command will take the YAML Filename as env name too. If you need a specific name, use
conda env create -f <filename>.yml -n <env_name>
- Example:
conda env create -f env_bkup.yml -n scraper
7. Skip prompts
Commands such as conda create may ask for permission, which can be accepted by typing y / yes in terminal, this can be bypassed by passing the -y flag
Run conda in normal command prompt
In Windows, Conda works in the Anaconda Prompt, but not in normal command prompt
This is because anaconda prompt runs an initialization script before opening the shell. Regular cmd.exe does not know where Conda is installed.
Open Anaconda Prompt and run:
conda init cmd.exe
Then close all terminals and reopen cmd.
Now run:
conda activate
By now all conda commands should work
Run a test command:
conda activate myenv