Force conda full reinstall tljh

Hi Community, I am new to The Littlest Jupyter Hub (tljh) and while playing around, I accidentally removed, as admin (smart!), the conda executable from the bin folder. So when a user tries to run conda it returns:

$ conda
bash: /opt/tljh/user/bin/conda: No such file or directory

And as admin consequently:

# conda
conda: command not found

I tried to reinstall conda ontop of it using the -u option and providing /opt/tljh/user/ as path, but I was unsuccessful, despite the prior installation is recognized.

# bash Anaconda3-2022.05-Linux-x86_64.sh -u
[/root/anaconda3] >>> /opt/tljh/user/
PREFIX=/opt/tljh/user
Unpacking payload ...
Collecting package metadata (current_repodata.json): done                                                                                                                                                                                                                                      
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: - 
Found conflicts! Looking for incompatible packages.
[...]
Your installed version is: 2.27

In fact after this command a conda.exe appears (?) but no bin/conda

Any idea how to fix this without having to reinstall tljh (which would not be an option)?

I can install it in a new directory (e.g. the default one root/anaconda3) and it works for the admin, but then the other users still get the error because it looks for a different directory.

$ conda
bash: /opt/tljh/user/bin/conda: No such file or directory

constructor-built installers like that one accept a -f (force) flag which will overwrite anything it finds.

Combined with with -b(atch) and -p(ath), it works unattended, which is great for scripting.

bash Installer.sh -fbp /path/you/want

As an aside: running conda as root is basically never the right play: I typically ensure the path exists, and is owned by less-privileged user, and then run as the user, as there is always the chance for arbitrary code execution during package install. If you only want a privileged user to see it later, you can chown it after the fact.

3 Likes

I tried with the -fbp options but the result did not change significantly, and it seems to fail.
Here the output: PREFIX=/opt/tljh/user
It seems like it cannot resolve conflicts despite the forcing and still generates a conda.exe (?), despite being the linux installer.

P.S. Yeah I don’t really know why I did it, or what I was thinking while doing it… I am not familiar with tljh but this was a stupid idea, period.

you could theoretically try unpacking the conda tarball and copying stuff into place… you should be able to tell what version you expect by looking in the package cache $PREFIX/pkg.

if you can’t get that to work i can’t recommend much more than backing up the old user install, and starting over: in $PREFIX/conda-meta/history, there is a full list of everything that was ever installed/re-installed.