Installing External Libraries
-
wrote on Apr 1, 2021, 4:59 AM last edited by
Is it possible to install external python libraries using pip via the terminal?
-
@robi I'm not able to install them because they still want to install it in the read-only directories for the base env. If I create an virtual environment using venv, I also won't be able to choose it as the kernel since there is no root system access.
Not sure if I'm missing something.
@thpuffin You have to run inside the notebook and not in the Web Terminal of JupyterHub app.
To understand why, please see https://docs.cloudron.io/apps/jupyterhub/#how-it-works . But at a high level, there is the "hub" which is essentially an authenticator/login service. The Web Terminal will give you access to this container. This container like other cloudron app containers is readonly.
When a user logs in, a "notebook container" is created for each user. This way each user has a virtual environment of their own. This container is read/write and user can install anything. There is a "shell" from within jupyterlab itself and you have to run pip there. Also, see https://docs.cloudron.io/apps/jupyterhub/#notebook-persistence about persistence of any additional package you install.
-
Is it possible to install external python libraries using pip via the terminal?
wrote on Apr 1, 2021, 5:24 AM last edited by@thpuffin only if they're in /app/data and not in /app/code
-
wrote on Apr 1, 2021, 6:18 AM last edited by
@robi I'm not able to install them because they still want to install it in the read-only directories for the base env. If I create an virtual environment using venv, I also won't be able to choose it as the kernel since there is no root system access.
Not sure if I'm missing something.
-
@robi I'm not able to install them because they still want to install it in the read-only directories for the base env. If I create an virtual environment using venv, I also won't be able to choose it as the kernel since there is no root system access.
Not sure if I'm missing something.
@thpuffin You have to run inside the notebook and not in the Web Terminal of JupyterHub app.
To understand why, please see https://docs.cloudron.io/apps/jupyterhub/#how-it-works . But at a high level, there is the "hub" which is essentially an authenticator/login service. The Web Terminal will give you access to this container. This container like other cloudron app containers is readonly.
When a user logs in, a "notebook container" is created for each user. This way each user has a virtual environment of their own. This container is read/write and user can install anything. There is a "shell" from within jupyterlab itself and you have to run pip there. Also, see https://docs.cloudron.io/apps/jupyterhub/#notebook-persistence about persistence of any additional package you install.
-
@thpuffin You have to run inside the notebook and not in the Web Terminal of JupyterHub app.
To understand why, please see https://docs.cloudron.io/apps/jupyterhub/#how-it-works . But at a high level, there is the "hub" which is essentially an authenticator/login service. The Web Terminal will give you access to this container. This container like other cloudron app containers is readonly.
When a user logs in, a "notebook container" is created for each user. This way each user has a virtual environment of their own. This container is read/write and user can install anything. There is a "shell" from within jupyterlab itself and you have to run pip there. Also, see https://docs.cloudron.io/apps/jupyterhub/#notebook-persistence about persistence of any additional package you install.
wrote on Apr 2, 2021, 7:09 AM last edited by@girish I see.
From what I understand, each user has a virtual environment of their own. Each user can install their own packages using the notebook itself, and not the terminal.
That means that if a user were to have multiple virtual environments, then I would need to set it up using ipykernel via the notebook too?
-
@girish I see.
From what I understand, each user has a virtual environment of their own. Each user can install their own packages using the notebook itself, and not the terminal.
That means that if a user were to have multiple virtual environments, then I would need to set it up using ipykernel via the notebook too?
@thpuffin Correct, each user can install their own packages. I am not 100% sure about the right terminology but.. there's only one environment per user. Inside each environment, a user can have many notebooks.
Also, if you want to have a package pre-installed for all the users, you can just use a custom image - https://docs.cloudron.io/apps/jupyterhub/#selecting-a-notebook-image . You can use any of the notebook images from the upstream project - https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html
-
@thpuffin Correct, each user can install their own packages. I am not 100% sure about the right terminology but.. there's only one environment per user. Inside each environment, a user can have many notebooks.
Also, if you want to have a package pre-installed for all the users, you can just use a custom image - https://docs.cloudron.io/apps/jupyterhub/#selecting-a-notebook-image . You can use any of the notebook images from the upstream project - https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html
wrote on Apr 3, 2021, 1:23 AM last edited by@girish Thanks for the answer. Having one and only one environment per user is quite the inconvenience
-
-