Installing Libraries for all Users

Hi,

I have tljh installed on my local server and I am using my own Identity server for authentication. Everything works well but I am having issues installing libraries for my users. How can I install libraries for all users in tljh?

I have tried doing sudo apt-get install pandas and the installation is succusful but when I login in with a user and try
import pandas as pd

I get a module not found error.

TLJH uses a separate Python environment for users. Install conda, pip or apt packages — The Littlest JupyterHub v0.1 documentation has more information

Plus, according to here that wouldn’t even be the correct command for installing pandas currently via apt-get.
I’d stick to using conda or pip for installing pandas, numpy, and other things typical to the Python ecosystem. I’ve installed some complex modules using pip on TLJH following that documentation and had good luck.

1 Like

Hi, Sorry I posted the question in a hurry and wrote the wrong command, I am using pip to install packages but I am not using the terminal from Jupyter Notebook, I am using PUTTY to access the server where tljh is installed and using

sudo -E pip install numpy to install numpy but the module is not available for all users.

I have also tried to activate the environment using
source /opt/tljh/user/bin/activate

and then installed numpy using the above command but nothing seems to work.

image

Not following why you haven’t tried the recommended way to see if that fixes things?
I haven’t set a hub up and used it lately, and so I cannot confirm there aren’t issues; however, not following the documentation is not advised.

Not sure if this will bump it to the top. Still having this issue for me. followed every guide.

Ran as admin on jupyterhub, ran from root on machine, etc. Unfortunately new members are only allowed one attachment or I’d post pictures.

Here’s terminal history for root:

GNU nano 7.2 history.txt
1 sudo -E conda install -c conda-forge mne
2 -E conda install -c conda-forge mne
3 conda install -c conda-forge mne
4 conda
5 sudo -E pip install mne
6 apt install python3-mne
7 -E apt install python3-mne
8 apt -E install python3-mne
9 apt -install -E python3-mne
10 apt install python3-mne -E
11 apt -install -E python3-mne
12 sudo -E conda install -c conda-forge gdal
13 cd Desktop
14 history >history.txt

for my username:>

1  sudo apt update && sudo apt upgrade -y
2  sudo reboot
3  sudo apt udpate && sudo apt upgrade -y
4  sudo apt update && sudo apt upgrade -y
5  sudo apt-get update 
6  sudo apt-get install realvnc-vnc-server
7  sudo systemctl restart vncserver-x11-serviced
8  sudo apt-get install realvnc-vnc-viewer
9  sudo raspi-config

10 sudo apt install sysbench
11 sysbench --test=cpu --cpu-max-prime=20000 run
12 sudo apt install stress
13 sudo apt install glmark2
14 glmark2
15 sudo apt install python3 python3-dev git curl
17 curl -L The Littlest Jupyterhub | sudo -E python3 - --admin science
18 sudo -E pip install mne
19 apt install
20 sudo -E apt install python3-mne
21 sudo su -
22 sudo apt update && sudo apte upgrade -y
23 sudo apt update && sudo apt upgrade -y
24 cd Desktop
25 history >history.txt

In TLJH i also tried to install from there for all users. no such luck. Here’s the command history from there:

jupyter-science@raspberrypi:~ $ sudo su -

Wi-Fi is currently blocked by rfkill.
Use raspi-config to set the country before use.

root@raspberrypi:~# history
1 sudo -E conda install -c conda-forge mne
2 -E conda install -c conda-forge mne
3 conda install -c conda-forge mne
4 conda
5 sudo -E pip install mne
6 apt install python3-mne
7 -E apt install python3-mne
8 apt -E install python3-mne
9 apt -install -E python3-mne
10 apt install python3-mne -E
11 history
root@raspberrypi:~#

Now, when I do this from TLJH I can import it:

jupyter-science@raspberrypi:~ $ python
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import mne

but as soon as I go into a notebook it doesn’t work even from the same exact user:
image

As you can see I used the provided example from the guide:
Installing on your own server — The Littlest JupyterHub documentation
in the form:
sudo -E pip install there

and it doesn’t work

Feel I should add, as it might be relevant:

root@raspberrypi:~# sudo -E pip install mne
error: externally-managed-environment

Ă— This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

For more information visit http://rptl.io/venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
root@raspberrypi:~#