This post is to summarize the procedures to create an Anaconda python environment in Windows and Linux systems. Tested on Jan. 08, 2022 with Windows 10 21H2, and on Jan. 29, 2022 with Imperial cluster cx3. Imperial cluster instructions updated Jun. 20, 2022.
Windows system
Anaconda 3has been integrated into a application with GUI. After installing Anaconda 3, launch the ‘Anaconda Prompt(Anaconda3)’ application, which is the command line of the software, and setup everything (see below). It is also accessible to available environments / packages through Anaconda Navigator(Anaconda3) with a GUI.
Load and Install Anaconda3 on Imperial cluster
The python environment loaded on the cluster is only used for testing proposes. Any demanding jobs are required to run on Anaconda environments. To load Anaconda3, use the command below:
1
$ module load anaconda3/personal
Note: The access to the module ‘anaconda3’ is restricted. The personal edition is recommended.
After the module is correctly loaded, using the command below will automatically install anaconda3 to your home directory: ${HOME}/anaconda3/
1
$ anaconda-setup
Alternatively, copying the corresponding shell script into your work directory enables you to make modifications. Then execute the script in your work directory:
1
2
3
4
$ which anaconda-setup
/apps/anaconda3/2019.10/anaconda-setup
$ cp /apps/anaconda3/2019.10/anaconda-setup ./
$ ./anaconda-setup
It takes roughly 1 hr to setup everything. Have a cup of tea.
Afterwards, anaconda needs to be initialized. Use the command below to initialize and activate conda
commands. The source
command should be executed every time the user logs in.
1
2
$ ./anaconda3/bin/conda init
$ source ~/.bashrc
Create & setup a python environment
Command list
- Create a new environment
- The ‘base’ environment is the default environment of Anaconda python, corresponding to the interpreter in the install root. The following command is used to create a python 3.6 environment named as ‘py36ase’.
The interpreter of the created environment is saved in the subfolder of install root: ‘env/py36ase’
1
$ conda create -n py36ase python=3.6
List installed packages/environments
1
2
3
$ conda list
$ conda env list
$ conda info -e
Check available updates
To update anaconda, do it in the base environment.
1
$ conda update conda
Substituting conda
with the specific package name can update the package in a specific environment.
Enter/exist a specific environment
1
2
$ conda activate env_name
$ conda deactivate
Install/uninstall packages for a specific environment
1
2
$ conda install -n env_name package_name
$ conda remove -n env_name package_name
Completely remove an environment
1
$ conda remove -n env_name --all
Package specific issues
- Atomic simulation environment (ASE) not available
- ASE cannot be automatically located with the
conda install
command, though it is listed in Anaconda3 packages repository. Use the command (provided in the link) to install it:
1
$ conda install -c rmg ase