вторник, 21 ноември 2023 г.

Activate and update a missing conda environment

I use conda to manage my python packages and libraries because otherwise, system updates break everything way too often. Recently, I had two problems with it:

1. After one of the system updates, conda got messed up and I copied the files from my backup. So the names of the conda environments disappeared.

1. To fix the names if you installed your environments in a new directory, you can use:

$conda config --show envs_dirs

this shows where your default directories are and then to add another path, use (link):

$conda config --append envs_dirs /home/<user>/anaconda3/envs

or if you want to keep your default dir (which I didn't care about):
$conda config --prepend envs_dirs /home/<user>/anaconda3/envs)
This at least added my old environments to the environment.txt

You can list the path to all environments -

$conda env list

And then, if you activate with either

$conda activate NAMEENV

or, if the short name is not available, you can do it with the full path:

$conda activate /home/user/anaconda3/envs/NAMEENV
 

Other imporant files and command:

$cat  /home/denijane/.condarc

$conda info

$conda info -e

2. I was getting a problem in jupyter with one of my packages
libstdc++.so.6: version `GLIBCXX_3.4.32' not found
This was solved by:

$conda activate /home/user/anaconda3/envs/NAMEENV

$conda update --all

which updated all the packages and fixed their broken dependencies. I tried with "conda install libgcc" but conda wouldn't install it.

I also tried to modify the PATH

$export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/path/to/conda/env/lib 

because I thought the file is there but it cannot find it, ut again, but this didn't work and in the end I had to do the "update --all"