Install python packages in virtual Conda environment

Hi all,

I’m trying to install two python packages (CPyS and tempest-extremes) on (/scratch/gb02/cj0591/).

CPyS can be simply installed by pip, however, tempest-extremes needs to be installed by conda. In this case, I am struggling in create my own conda environment, and get these two package installed.

Regards,
Chenhui

Hi,

I’m assuming you are using Gadi? If yes, then you should be able to follow the guide from UNSW here. If you have problems, let me know.

Hi @lachlanswhyborn,

Yes, I am using Gadi and thanks for sending the guide. I successfully created my own conda environment under /scratch/gb02/cj0591, and installed CPyS.

However, I failed to install tempest-extremes:

I tried
conda install -c conda-forge tempest-extremes

Sorry, seems that the particular page I linked is a bit out of date- they have recently moved to Github blogs. Here is their piece on custom python environments.

The gist of it is:

  • Load the hh5 conda environment via module
  • Use a virtual environment by python3 -m venv <env_name> --system-site-packages && source <env_name>/bin/activate
  • Install package via pip pip install <package>

Alternatively, you can skip the virtual environment creation and just call
pip install --user <package>.

I followed the instruction to create the environment (myenv2) and activate it and installed CPyS. However, I still couldn’t install tempest-ctremes (see errors below)

conda install will install into the active environment, which is trying to install into the shared environment you don’t have write permissions to. Use conda create instead to create a new environment e.g. to create one named named tempest:

conda create -n tempest -c conda-forge tempest-extremes

You will then need to conda activate the environment to use it.

Thanks! I installed it successfully.