Users getting 403 : Forbidden while login into jupyterhub with python3.5.2

Hello,

i am trying to get jupyterHub working on a my on-premise linux machine. I have installed the jupyterhub and jupyterhub and configurable-http-proxy process started without any issues. but when I am trying to login into the login, I am getting 403 : Forbidden.

After checking jupyterHub logs, I can see that, handler blocking my request.

Note: I have same setup working with Conda - Python 3.5.2 |Anaconda custom

Here I am trying to setup Jupyterhub without using the conda environment. So I have installed the python3.5.2 using pyenv and installed the jupyterhub=0.7.2 using pip.

in this setup, for some reason my sudospawner/jupyterhub-singleuser not able to communicate to hub.

here is the env details/package version.

Python 3.5.2 (default, Mar 13 2024, 18:20:55)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

$PATH:
/usr/local/anaconda3/jhub_py36/pyenv/shims
/usr/local/anaconda3/jhub_py36/pyenv/bin
/usr/share/centrifydc/bin
/usr/local/bin
/bin
/usr/bin
/usr/local/sbin
/usr/sbin
/home/jhubapp/.local/bin
/home/jhubapp/bin

sys.path:
/usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/bin
/usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/lib/python35.zip
/usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/lib/python3.5
/usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/lib/python3.5/plat-linux
/usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/lib/python3.5/lib-dynload
/usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/lib/python3.5/site-packages

sys.executable:
/usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/bin/python3.5

sys.version:
3.5.2 (default, Mar 13 2024, 18:20:55)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

platform.platform():
Linux-3.10.0-1160.92.1.el7.x86_64-x86_64-with-centos-7.9.2009-Core

which -a jupyter:
/usr/local/anaconda3/jhub_py36/pyenv/shims/jupyter

pip list:
Package Version


alembic 1.4.3
argon2-cffi 21.1.0
attrs 22.1.0
backcall 0.2.0
bleach 3.3.1
certifi 2018.8.24
cffi 1.15.1
chardet 4.0.0
decorator 5.1.1
defusedxml 0.7.1
entrypoints 0.3
idna 2.10
importlib-metadata 2.1.3
ipykernel 5.5.6
ipython 7.9.0
ipython-genutils 0.2.0
jedi 0.17.2
Jinja2 2.11.3
jsonschema 3.2.0
jupyter-client 6.1.12
jupyter-contrib-core 0.4.2
jupyter-core 4.6.3
jupyter-nbextensions-configurator 0.2.3
jupyterhub 0.7.2
Mako 1.1.6
MarkupSafe 1.1.1
mistune 0.8.4
nbconvert 5.6.1
nbformat 5.1.3
notebook 6.2.0
oauthlib 2.0.1
packaging 20.9
pamela 0.3.0
pandocfilters 1.5.1
parso 0.7.1
pexpect 4.9.0
pickleshare 0.7.5
pip 19.3.1
prometheus-client 0.12.0
prompt-toolkit 2.0.10
ptyprocess 0.7.0
pycparser 2.21
Pygments 2.11.2
pyparsing 2.4.7
pyrsistent 0.17.3
python-dateutil 2.9.0.post0
python-editor 1.0.4
PyYAML 5.3.1
pyzmq 20.0.0
requests 2.25.1
Send2Trash 1.8.2
setuptools 39.0.1
six 1.16.0
SQLAlchemy 1.3.24
sudospawner 0.3.0
terminado 0.8.3
testpath 0.6.0
tornado 6.1
traitlets 4.3.3
urllib3 1.26.9
wcwidth 0.2.13
webencodings 0.5.1
zipp 1.2.0


hub process.
jupyterhub -f /home/jhubapp/jupyterhub_config.py

jhubapp 48192 1 0 09:42 pts/0 00:00:01 /usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/bin/python3.5 /usr/local/anaconda3/jhub_py36/p

jhubapp 48244 48192 0 09:42 ? 00:00:00 node /bin/configurable-http-proxy --ip 0.0.0.0 --port 8000 --api-ip 127.0.0.1 --api-port 8083 --default-targe
jhubapp 48252 48192 0 09:42 ? 00:00:00 python /usr/local/share/jupyter/cull-idle-servers/cull_idle_servers.py --timeout=7200

Jupytrhub logs - Handler blocking request while login to hub.

[W 2024-03-14 09:42:53.626 JupyterHub configurable:168] Config option log_file not recognized by JupyterHub. Did you mean one of: config_file, extra_log_file, logo_file?

[D 2024-03-14 09:42:53.627 JupyterHub app:1283] Writing PID 48192 to /usr/local/share/jupyter/hub/jupyterhub.pid
[I 2024-03-14 09:42:53.628 JupyterHub app:724] Loading cookie_secret from /usr/local/share/jupyter/hub/jupyterhub_cookie_secret
[D 2024-03-14 09:42:53.628 JupyterHub app:796] Connecting to db: sqlite:////usr/local/share/jupyter/hub/jupyterhub.sqlite
[I 2024-03-14 09:42:53.673 JupyterHub app:892] Not using whitelist. Any authenticated user will be allowed.
[D 2024-03-14 09:42:53.852 JupyterHub app:1085] Loading state for din123 from db
[D 2024-03-14 09:42:53.853 JupyterHub app:1097] din123 not running.
[D 2024-03-14 09:42:53.859 JupyterHub app:1085] Loading state for ac33570 from db
[D 2024-03-14 09:42:53.866 JupyterHub app:1102] Loaded users:
din123 admin
[I 2024-03-14 09:42:53.876 JupyterHub app:1453] Hub API listening on http://127.0.0.1:8082/hub/
[I 2024-03-14 09:42:53.880 JupyterHub app:1176] Starting proxy @ http://0.0.0.0:8000/
[D 2024-03-14 09:42:53.880 JupyterHub app:1177] Proxy cmd: [‘configurable-http-proxy’, ‘–ip’, ‘0.0.0.0’, ‘–port’, ‘8000’, ‘–api-ip’, ‘127.0.0.1’, ‘–api-port’, ‘8083’, ‘–default-target’, ‘http://127.0.0.1:8082’, ‘–error-target’, ‘http://127.0.0.1:8082/hub/error’, ‘–ssl-key’, ‘/usr/local/etc/jupyter/ssl/jupyter.key’, ‘–ssl-cert’, ‘/usr/local/etc/jupyter/ssl/jupyter.cert’]
09:42:54.252 [ConfigProxy] info: Adding route / → http://127.0.0.1:8082
09:42:54.277 [ConfigProxy] info: Proxying https://0.0.0.0:8000 to http://127.0.0.1:8082
09:42:54.278 [ConfigProxy] info: Proxy API at http://127.0.0.1:8083/api/routes
09:42:54.283 [ConfigProxy] info: Route added / → http://127.0.0.1:8082
[D 2024-03-14 09:42:54.308 JupyterHub app:1205] Proxy started and appears to be up
[I 2024-03-14 09:42:54.309 JupyterHub service:220] Starting service ‘cull-idle’: [‘python’, ‘/usr/local/share/jupyter/cull-idle-servers/cull_idle_servers.py’, ‘–timeout=7200’]
[I 2024-03-14 09:42:54.316 JupyterHub service:90] Spawning python /usr/local/share/jupyter/cull-idle-servers/cull_idle_servers.py --timeout=7200
[D 2024-03-14 09:42:54.326 JupyterHub spawner:584] Polling subprocess every 30s
[I 2024-03-14 09:42:54.329 JupyterHub app:1485] JupyterHub is now running at http://127.0.0.1:8000/
[I 2024-03-14 09:42:54.587 JupyterHub log:100] 200 GET /hub/api/users (cull-idle@127.0.0.1) 22.12ms
[I 2024-03-14 09:43:16.205 JupyterHub log:100] 302 GET /user/din123 (@10.170.69.14) 5.81ms
[D 240314 09:43:17 mediator:139] Starting mediator for din123
[I 240314 09:43:17 mediator:75] Spawning /usr/local/anaconda3/jhub_py36/pyenv/versions/py3.5/bin/jupyterhub-singleuser ‘–user=“din123”’ ‘–cookie-name=“jupyter-hub-token-din123”’ ‘–base-url=“/user/din123”’ ‘–hub-host=“”’ ‘–hub-prefix=“/hub/”’ ‘–hub-api-url=“http://127.0.0.1:8082/hub/api”’ ‘–ip=“127.0.0.1”’ --port=36557 ‘–notebook-dir=“~/”’ ‘–NotebookApp.default_url=“/tree”’ --debug --disable-user-config
[D 2024-03-14 09:43:17.833 din123 application:179] Searching [‘/usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/etc/jupyter’, ‘/usr/local/etc/jupyter’, ‘/etc/jupyter’] for config files
[D 2024-03-14 09:43:17.833 din123 application:556] Looking for jupyter_config in /etc/jupyter
[D 2024-03-14 09:43:17.833 din123 application:556] Looking for jupyter_config in /usr/local/etc/jupyter
[D 2024-03-14 09:43:17.834 din123 application:556] Looking for jupyter_config in /usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/etc/jupyter
[D 2024-03-14 09:43:17.835 din123 application:556] Looking for jupyter_notebook_config in /etc/jupyter
[D 2024-03-14 09:43:17.835 din123 application:556] Looking for jupyter_notebook_config in /usr/local/etc/jupyter
[D 2024-03-14 09:43:17.835 din123 application:578] Loaded config file: /usr/local/etc/jupyter/jupyter_notebook_config.json
[D 2024-03-14 09:43:17.836 din123 application:556] Looking for jupyter_notebook_config in /usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/etc/jupyter
[W 2024-03-14 09:43:17.837 din123 notebookapp:1508] server_extensions is deprecated, use nbserver_extensions
[D 2024-03-14 09:43:17.844 din123 config_manager:96] Paths used for configuration of jupyter_notebook_config:
/etc/jupyter/jupyter_notebook_config.json
[D 2024-03-14 09:43:17.844 din123 config_manager:96] Paths used for configuration of jupyter_notebook_config:
/usr/local/etc/jupyter/jupyter_notebook_config.json
[D 2024-03-14 09:43:17.845 din123 config_manager:96] Paths used for configuration of jupyter_notebook_config:
/usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/etc/jupyter/jupyter_notebook_config.json
[D 2024-03-14 09:43:17.846 din123 config_manager:96] Paths used for configuration of jupyter_notebook_config:
/home/din123/.jupyter/jupyter_notebook_config.json
[W 2024-03-14 09:43:18.096 din123 login:239] All authentication is disabled. Anyone who can connect to this server will be able to run code.
[D 2024-03-14 09:43:18.118 din123 init:177] Loading server extension jupyter_nbextensions_configurator
[D 2024-03-14 09:43:18.118 din123 init:182] Editing template path to add /usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/lib/python3.5/site-packages/jupyter_nbextensions_configurator/templates
[D 2024-03-14 09:43:18.118 din123 init:195] Editing nbextensions path to add /usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/lib/python3.5/site-packages/jupyter_nbextensions_configurator/static
[D 2024-03-14 09:43:18.118 din123 init:200] Adding new handlers
[I 2024-03-14 09:43:18.119 din123 **init**:208] Loaded server extension jupyter_nbextensions_configurator
[I 2024-03-14 09:43:18.119 din123 notebookapp:2257] Serving notebooks from local directory: /home/din123
[I 2024-03-14 09:43:18.119 din123 notebookapp:2257] Jupyter Notebook 6.2.0 is running at:
[I 2024-03-14 09:43:18.119 din123 notebookapp:2257] http://127.0.0.1:36557/user/din123/
[I 2024-03-14 09:43:18.119 din123 notebookapp:2258] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[D 240314 09:43:18 mediator:42] mediator result: {‘ok’: True, ‘pid’: 48432}
[D 2024-03-14 09:43:18.325 JupyterHub spawner:584] Polling subprocess every 30s
[D 2024-03-14 09:43:18.488 JupyterHub utils:84] Server at http://127.0.0.1:36557/user/din123 responded with 302
[I 2024-03-14 09:43:18.487 din123 log:55] 302 GET /user/din123 (127.0.0.1) 1.770000ms
[I 2024-03-14 09:43:18.489 JupyterHub base:322] User din123 server took 2.154 seconds to start
[I 2024-03-14 09:43:18.489 JupyterHub orm:188] Adding user din123 to proxy /user/din123 => http://127.0.0.1:36557
[D 2024-03-14 09:43:18.492 JupyterHub orm:146] Fetching POST http://127.0.0.1:8083/api/routes/user/din123
09:43:18.499 [ConfigProxy] info: Adding route /user/din123 → http://127.0.0.1:36557
09:43:18.500 [ConfigProxy] info: Route added /user/din123 → http://127.0.0.1:36557
09:43:18.502 [ConfigProxy] info: 201 POST /api/routes/user/din123
[D 2024-03-14 09:43:18.502 JupyterHub base:236] Setting cookie for din123: jupyter-hub-token-din123, {‘secure’: True}
[I 2024-03-14 09:43:18.516 JupyterHub log:100] 302 GET /hub/user/din123 (din123@10.170.69.14) 2182.40ms
[I 2024-03-14 09:43:18.635 din123 log:55] 302 GET /user/din123 (10.170.69.14) 1.140000ms
[I 2024-03-14 09:43:18.791 JupyterHub log:100] 200 GET /hub/api/authorizations/cookie/jupyter-hub-token-din123/[secret] (din123@127.0.0.1) 16.60ms
[D 2024-03-14 09:43:18.782 din123 auth:190] Received request from Hub user {‘server’: ‘/user/din123’, ‘last_activity’: ‘2024-03-14T14:43:18.326755’, ‘admin’: True, ‘groups’: , ‘name’: ‘din123’, ‘pending’: None}
[D 2024-03-14 09:43:18.782 din123 auth:286] Allowing whitelisted Hub user din123
[W 2024-03-14 09:43:18.783 din123 handlers:496] Blocking request with non-local ‘Host’ polccdhen004.test.intranet (polccdhen004.test.intranet:8000). If the notebook should be accessible at that name, set NotebookApp.allow_remote_access to disable the check.
[D 2024-03-14 09:43:18.797 din123 handlers:252] Using contents: services/contents
[D 2024-03-14 09:43:18.798 din123 handlers:252] Using contents: services/contents
[D 2024-03-14 09:43:18.851 din123 handlers:836] Path base/images/favicon.ico served from /usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/lib/python3.5/site-packages/notebook/static/base/images/favicon.ico
[D 2024-03-14 09:43:18.851 din123 handlers:836] Path components/jquery-ui/themes/smoothness/jquery-ui.min.css served from /usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/lib/python3.5/site-packages/notebook/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css
[D 2024-03-14 09:43:18.852 din123 handlers:836] Path components/jquery-typeahead/dist/jquery.typeahead.min.css served from /usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/lib/python3.5/site-packages/notebook/static/components/jquery-typeahead/dist/jquery.typeahead.min.css
[D 2024-03-14 09:43:18.852 din123 handlers:836] Path style/style.min.css served from /usr/local/anaconda3/jhub_py36/pyenv/versions/3.5.2/envs/py3.5/lib/python3.5/site-packages/notebook/static/style/style.min.css

@minrk – Could you please help me on this… I am stuck

Python 3.5 is very old and unsupported. Please try a more recent version (Python 3.8 is the oldest version that’s not end-of-life) with the latest version of JupyterHub (4.0.2).

@manics - It’s working with Anaconda version of python3.5

when I am tried with python3.5 or python3.6 even with the jupyterhub = 0.8.1
I am getting the same issues…

just wanted to know… is it possible to run jupyterhub without using the Anaconda version of python?

@minrk @manics guy’s can someone give me some pointers to deal with this issues?

I have no insight into this issue but just to reiterate what’s already been said, python 3.5.2 is 3.5 years past its absolute end of life, and perhaps even more of an issue for getting any help here, JupyterHub 0.7.2 is from 2017 (i.e. 7 years ago). I don’t think it’s viable to expect anyone to be able to help you get 7 year old, pre 1.0 software to work when it’s now on 4.0 :slight_smile:. Current versions of both are available via anaconda, and/or other places.

(Also, I don’t think you will get good results using Discourse pings that way, probably best not to use them at all…people you respond to in a thread will be notified without one.)

1 Like

Thanks you so much… we have dependencies on our on-prem spark version… it’s not supported with python> 3.7 so I can’t upgrade the jupyterhub instance.

It’s working with Anaconda version of python3.5.2 but not with python3.5.2 installed thru pyenv.

In principle you should be able to get an old version of JupyterHub working (with or without Anaconda), but you’ll need to do the investigative work yourself. For example, you’ll need to make sure all dependencies working- it’s possible newer versions of a dependency have been released which won’t have been tested with the ancient version of JupyterHub you’re using. The only way to know is to use trial and error to downgrade packages. This also applies to all transitive dependencies.

This could end up being relatively easy, or it could end up taking significantly longer than it would to upgrade the rest of your environment. Regardless of what you choose, good luck!