Env¶
list envs¶
delete an env¶
The --all flag ensures that all files associated with the environment, including packages and cache, are removed.
conda deactivate
conda remove -n <env-name> # or
conda remove --name <env-name> --all
# by path if there is no env name
conda env remove --prefix c:\tmp\conda\my-env
# always good to run
conda clean --all # clean Up Conda Metadata, such as unused packages and caches
change default env location¶
Open or create a .condarc file in home directory ~/.condarc and add:
create env and install packages¶
https://stackoverflow.com/questions/66291897/conda-create-and-conda-install
option 1: create an environment, activate, install packages
conda create --name env_name python=3.10
conda activate env_name
conda install package_name another_package
option 2: create an environment with packages
create env¶
create env with exported env-file (not suggested)¶
The output can be used as the inputNote that the conda list --explicit command only lists packages installed via Conda, and it doesn't include packages installed using pip. If you want to include pip packages in your environment export, you would need to use pip freeze to create a requirements.txt file separately. Export Conda and pip Packages
Create a new environment using both files:
conda create --name my_new_environment --file environment_conda.txt
pip install -r environment_pip.txt
create env with env yml file¶
environment.yml will include both conda and pip packagesname: env-name
channels:
- https://conda.mini-forge.com/uat/linux-64/
dependencies:
- python
- pip
- pip:
- pypi-package-name
prefix: C:\Users\user\conda-envs\env-name
install package¶
install from local conda package¶
assume the conda package is: /home/user/dev/.build/linux-64/my-dev-package-0.1.1-py39_0.tar.bz2
why does not work???
conda activate dev-env \
&& conda install --yes --quiet -v --channel /home/user/dev/.build --no-update-deps my-dev-package=0.1.1=py39_0
conda install -n dev-env --yes --quiet -v \
--channel /home/user/dev/.build --no-update-deps my-dev-package=0.1.1=py39_0 python=3.9