Comments (5)
Ok, here's how to solve it (should be documented somewhere in the sudospawner webpage I guess):
- to make the neccessary variables be passed to sudospawner, use
Defaults env_keep += "PYTHONPATH JUPYTER_PATH WHATEVER_ELSE"
in the sudoers file. - Now sudospawner will start, but mediator removes the PYTHONPATH variable, so we run into the same problem just one step later
Feb 09 17:44:09 myhost start_jhub[8254]: [I 230209 17:44:09 mediator:89] Spawning /opt/jhub/bin/jupyterhub-singleuser
Feb 09 17:44:09 myhost start_jhub[8254]: [W 230209 17:44:09 mediator:91] PYTHONPATH env not allowed for security reasons
Feb 09 17:44:09 myhost start_jhub[8254]: Traceback (most recent call last):
Feb 09 17:44:09 myhost start_jhub[8254]: File "/opt/jhub/bin/jupyterhub-singleuser", line 5, in <module>
Feb 09 17:44:09 myhost start_jhub[8254]: from jupyterhub.singleuser import main
Feb 09 17:44:09 myhost start_jhub[8254]: ModuleNotFoundError: No module named 'jupyterhub'
According to https://github.com/jupyterhub/sudospawner we can solve this by creating a file sudospawner-singleuser
. This will be called from sudospawner instead of jupyterhub-singleuser
, so we can set PYTHONPATH again and then call jupyterhub-singleuser ourself:
#!/bin/bash
export PYTHONPATH=<set your path>
exec "$(dirname "$0")/jupyterhub-singleuser" $@
And now it works.
from sudospawner.
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋
Welcome to the Jupyter community! 🎉
from sudospawner.
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋
Welcome to the Jupyter community! 🎉
from sudospawner.
Having exactly the same problem. sudospawner fails to start as the neccessary PYTHONPATH variable get's lost despite c.Spawner.env_keep is listing it.
from sudospawner.
The problem is, that you do not pass PYTHONPATH
but set it to a new, possibly unexpected value ...
Therefore I use the following workaround in our cluster:
export JUPYTER_PATH=/usr/local/jupyter
#...
sed -i.orig -e "/self.sudo_args/ a\ if 'PYTHONPATH' in os.environ:\n cmd.append('='.join(['PYTHONPATH', os.environ['PYTHONPATH']]))" \
${JUPYTER_PATH}/lib/python${PY_VERS}/site-packages/sudospawner/spawner.py
sed -i.orig -e "/if'PYTHONPATH' in env:/ s/:/ and 'NO_PYTHONPATH' in env:/"\
${JUPYTER_PATH}/lib/python${PY_VERS}/site-packages/sudospawner/mediator.py
#...
if [[ ! -e /usr/local/jupyter/bin/jupyterhub-singleuser ]]; then
print '#!/bin/bash -l
unset HTTP_PROXY HTTPS_PROXY
if [[ -z ${PY_VERSION} ]]; then
case "$( lsb_release -rs )" in
20.04) export PY_VERSION=3.8 ;;
18.04) export PY_VERSION=3.6 ;;
esac
fi
PYTHONPATH="${PYTHONPATH}:/usr/local/jupyter/lib/python${PY_VERSION}/site-packages"
exec /usr/local/jupyter/bin/jupyterhub-singleuser "$@"
' >/usr/local/jupyter/bin/jupyterhub-singleuser
fi
Have fun ;-)
from sudospawner.
Related Issues (20)
- Multi user login fails HOT 1
- One user login to jupyterhub but others get internal server error. HOT 5
- Does Sudospawner support Spawner.mem_limit? HOT 3
- fail to open PAM session
- 'Add User' not working for admin users with JupyterHub run using PAMAuthentication and SudoSpawner HOT 2
- Spawn error - sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
- <feature request> Support for alternative commands for sudo
- documentation should be updated for 2.0.0
- Advantage of using sudo spawner over adding capabilities CAP_SETUID, CAP_SETGID to JupyterHub HOT 6
- Jupyterhub terminated immediately after start HOT 5
- JupyterHub fails untidily when a home directory is unavailable, with unhelpful error message HOT 2
- [BUG] c.Spawner.args not working with SudoSpawner HOT 1
- No publish to PyPI workflow setup HOT 3
- How to switch/activate the conda env when the jupyterlab startup? HOT 1
- Can't set sudo_args using CLI HOT 1
- The method move_cert needs to be overridden HOT 1
- etc/migrated tried to create as sudo'ed user HOT 2
- Debugging messages from spawners lost when restarting hub
- I can't create notebook as a user with "dot" in username HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sudospawner.