Hi there,
I am running a Jupyterhub (tljh with TmpAuthenticator) and would like to include SQL functionality. I installed PostgreSQL on my server and would like to use it in Jupyterlab. However, I am having trouble importing the corresponding psycopg2 library.
import psycopg2
ModuleNotFoundError: No module named 'psycopg2'
I already had some issues when trying to install libraries before. However, I learned that I have to install them using this syntax:
sudo -H pip install psycopg2 -t /opt/tljh/user/bin/
This installation procedure fixed my library-related problems in the past but does not appear to help in the current situation.
$ source /opt/tljh/user/bin/activate
(base) $ pip freeze | grep psycopg2
psycopg2==2.9.1
psycopg2 shows up inside the SSH terminal and also in jupterlab when I try !pip freeze
. I tried to install psycopg2 outside of virtualenv but it did not help, either. I can not install it using !pip install psycog2
because Requirement already satisfied: psycopg2 in /opt/tljh/user/bin (2.9.1)
. However, I can use the library inside the SSH terminal when I python3
, just not inside Jupyterlab.
I already spent many hours on research regarding this issue and tried a lot of the suggested solutions but it feels bad wasting a lot of time and I also feel like I arrived at a dead end. Any help would be appreciated and I will gladly provide any information you might need for this. Thanks for reading my post.
Kind regards,
Domme