Skip to main content

Python Common Issues

  1. Do not install packages on the login nodes or inside a Jupyter Notebook. It has to be done in a terminal/shell:

    $ interactive -t 30 -p htc
    $ ml mamba
  2. Avoid installing any packages in the base environment. If (base) shows in your prompt, deactivate this environment.

    (base) [rcsparky@login01:~]$
    (base) [rcsparky@login01:~]$ source deactivate
    [rcsparky@login01:~]$
  3. Improper use of the conda commands will inject some code into your ~/.bashrc file, which will cause problems. To remove these lines:

    $ remove_conda_from_bashrc
    $ source ~/.bashrc
  4. Running pip install outside of a mamba environment (or with --user) installs packages into ~/.local/lib/python3*, which are then loaded by every Python environment and often break them. To check for such folders and disable them reversibly (see Deleting conflicting packages):

    $ cd ~/.local/lib
    $ ls
    $ mv python3.11 python3.11.old # repeat for each python3.* directory listed
    $ mamba clean --all
  5. How to remove an env safely:

    $ interactive -t 60 -p htc
    $ module load mamba/latest
    $ mamba remove -n ENV_NAME --all
    $ mamba clean --all
    $ cd ~/.conda/envs
    $ ls
    $ rm -rf ENV_NAME