Difference between revisions of "Python"
From Alessandro's Wiki
Porcelinux (talk | contribs) |
Porcelinux (talk | contribs) |
||
Line 29: | Line 29: | ||
== Config == | == Config == | ||
* Users | |||
adduser -G jupyterhub newuser | |||
* in /etc/sudoers | |||
Cmnd_Alias JUPYTER_CMD = /usr/local/bin/sudospawner | |||
rhea ALL=(%jupyterhub) NOPASSWD:JUPYTER_CMD | |||
Use Jupyter'''Lab''' by Default (instead of Notebook) | Use Jupyter'''Lab''' by Default (instead of Notebook) | ||
in /etc/jupyterhub/jupyterhub_config.py | in /etc/jupyterhub/jupyterhub_config.py | ||
Line 45: | Line 54: | ||
* [D 2022-02-15 10:27:43.776 JupyterHub app:2727] Could not load pycurl: No module named 'pycurl' | * [D 2022-02-15 10:27:43.776 JupyterHub app:2727] Could not load pycurl: No module named 'pycurl' | ||
pip install pycurl |
Revision as of 10:36, 15 February 2022
Pip
- update Pip version using pip itself
pip install pip -U
Advanced
Virtual Environments
Package dependencies are sometimes incompatible to each other, so the solution is to create a isolated package tree shell to have a "clean" system for every package installation. In python it's the Virutal Environment
- create:
python3 -m venv new-env
- activate
source ~/new-env/bin/activate
JupyterHub
Installation
- create a user (jupyterhub
python3 -m venv jupyterhub-env . jupyterhub-env/bin/activate (jupyterhub-env) ~ $ pip install jupyterhub
Config
- Users
adduser -G jupyterhub newuser
- in /etc/sudoers
Cmnd_Alias JUPYTER_CMD = /usr/local/bin/sudospawner rhea ALL=(%jupyterhub) NOPASSWD:JUPYTER_CMD
Use JupyterLab by Default (instead of Notebook) in /etc/jupyterhub/jupyterhub_config.py
c.Spawner.cmd=["jupyter-labhub"]
- change default notebook directory
c.Spanwer.default_url: /notebooks c.Spawner.notebook_dir: /apps/jupyter
- Running as root is not recommended. Use --allow-root to bypass.
c.Spawner.args = ['--allow-root']
Debug
- run with debug from cli
jupyterhub -f /etc/jupyterhub/jupyterhub_config.py --debug
- [D 2022-02-15 10:27:43.776 JupyterHub app:2727] Could not load pycurl: No module named 'pycurl'
pip install pycurl