I can't update conda or other packages in TLJH

Suddenly, if I run in a JupyterHub terminal sudo -E conda update conda -c conda-forge or sudo -E conda update pvlib-python -c conda-forge it just says /Killed and I don’t know what to do.

It could be an out-of-memory error. You could try mamba, which has a lighter memory footprint, but i guess if you can’t update things…

Generally having conda run as root as a poor idea, as much like many app package managers, e.g. pip, npm, it allows running arbitrary code by packages. Similarly, doing things to the base environment where conda itself is installed can leave your system in a broken state. On binder, for example, the base environment is left untouched, and notebook env gets updated with tools, etc.


Thanks! I should’ve mentioned I’m using the littlest jupyterhub (TLJH) so I followed their instructions to install jupyterhub:

curl -L https://tljh.jupyter.org/bootstrap.py \
  | sudo python3 - \
    --admin <admin-user-name>

I agree my preference would be to not use sudo or the (base) conda environment, but not sure the best way to undo do that or roll my own.


I was able to fix this by taking some extreme measures.

  1. I bumped up my Azure VM to B2s with 2CPU and 4gb RAM.
  2. I followed the instructions to install micromamba
  3. I updated the $MAMBA_ROOT_REPO to match the base env for TLJH: /opt/tljh/user, I did this in the new section of .bashrc that micromamba created when I cURL’d their script. I also may have initialized bash as the shell which added a folder called ~/micromamba with a bash script, and added to my path in .bashrc a link to the bash script. Then I had to restart the terminal, I was using TLJH to open a terminal.
  4. One problem I was having was RemoveError, described in conda GitHub issue 8149. I think I accidently pip installed setuptools by accident and borked my base conda env (I know! don’t use base, but that’s the way TLJH setup script works.). So I pip uninstalled setuptools then used micromamba to reinstall setuptools from conda-forge.
  5. Then I could used conda to install mamba
  6. Finally I used mamba to update conda, and then from now on I just use mamba.

Lesson(s) learned: I’ll look into updating the TLJH script to create a separate environment, IDK if that’s possible, but I think that would help keep the base environment from getting borked. Maybe a python virtual env would be even easier since most of the Jupyter Hub packages are installed using pip.

You can setup a swapfile to get a little extra RAM for building and installing.