Follow the latest instructions
Using conda appears to require login into a Hub session and opening a terminal, connecting directly to a jupyter-* user doesn't make conda available for some reason.
sudo -E conda install -c conda-forge nb_conda_kernels
sudo -E conda create -n bw2 -c conda-forge -c cmutel brightway2 ipykernel seaborn tqdm
sudo -E conda create -n bw25 -c conda-forge -c cmutel brightway25 ipykernel seaborn tqdm
sudo -E conda create -n regional -c conda-forge -c cmutel brightway25 bw2regional ipykernel seaborn tqdm geopandas
Note: Must be run with sudo -E
.
Activate the virtualenv, and then:
ipython kernel install --user --name <name>
The name doesn't have to be the same as the venv
.
Note: This needs to be done in an SSH session, not via the terminal in the hub.
source /opt/tljh/user/etc/profile.d/conda.sh
conda activate <env>
sudo -E /opt/tljh/user/condabin/conda install -c conda-forge -c cmutel <library>
sudo -E /opt/tljh/user/condabin/conda remove --name myenv --all
sudo -E conda update -n base conda
sudo -E conda install -c conda-forge conda-libmamba-solver
sudo -E conda config --set experimental_solver libmamba --env
The tljh-config
program modifies the file /opt/tljh/config/config.yaml
- you can also browse or edit this file directly.
sudo tljh-config set limits.memory 16G
sudo tljh-config set limits.cpu 4
sudo tljh-config set services.cull.timeout 3600
sudo tljh-config reload
sudo tljh-config set user_environment.default_app jupyterlab
(From https://tljh.jupyter.org/en/latest/howto/env/notebook-interfaces.html)
Our current security model is built around classes, where we can create users by username, and they can set their own passwords when logging on the first time. Here is the authentication documentation: https://tljh.jupyter.org/en/latest/howto/auth/firstuse.html
The command to create a new user is:
sudo tljh-config add-item users.allowed <username>
This can be run in an SSH session.
Switch to anonymous usage:
sudo tljh-config set auth.type tmpauthenticator.TmpAuthenticator
sudo tljh-config reload
Switch to only registered users:
sudo tljh-config set auth.type firstuseauthenticator.FirstUseAuthenticator
sudo tljh-config reload
Adding an approved user name does not create the Linux user - this happens on first login. To customize the new user, change the skeleton directory /etc/skel/
.
To create a more accessible Brightway data directory:
sudo mkdir /etc/skel/bw_data
And then edit /etc/skel/.profile
to add:
export BRIGHTWAY2_DIR=$HOME/bw_data
However, this doesn't work as .profile
is not sourced when opening JupyterHub. For now we stick with the standard directory location, namely:
/home/jupyter-<username>/.local/share/Brightway3/
You can put standard JupyterHub config directives under /opt/tljh/config/jupyterhub_config.d/<some-config-file-name>
. So you may create a file at /opt/tljh/config/jupyterhub_config.d/environment.py
and add the following contents:
c.Spawner.environment = {
'TEST': 'blah'
}
(From jupyterhub/the-littlest-jupyterhub#308)
You need to delete from both the JupyterHub registry and from the linux system:
sudo tljh-config remove-item users.allowed <username>
sudo userdel jupyter-<username>
Files are stored in:
/etc/skel/
Following https://tljh.jupyter.org/en/latest/howto/content/share-data.html.
Shared data is in /srv/data/
Some libraries want or require write permissions.
Rower:
sudo chmod +777 /opt/tljh/user/envs/regional/lib/python3.10/site-packages/rower/data/ecoinvent\ 3.8\ cutoff/
bw2_lcimpact:
sudo chmod 666 /opt/tljh/user/envs/regional/lib/python3.10/site-packages/bw2_lcimpact/data/*.gpkg
sudo chmod 777 /opt/tljh/user/envs/regional/lib/python3.10/site-packages/bw2_lcimpact/data
- bw2regional: for geocollections. needs to be copied to a read-all directory, and filepaths updated.