Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nbclassic has no attribute base #128

Closed
minrk opened this issue Jul 9, 2022 · 6 comments · Fixed by #130
Closed

nbclassic has no attribute base #128

minrk opened this issue Jul 9, 2022 · 6 comments · Fixed by #130

Comments

@minrk
Copy link
Member

minrk commented Jul 9, 2022

Linking nbclassic 0.4.2 fails with:

module 'nbclassic' has no attribute 'base'

I believe is here.

I think there are some incomplete migrations bringing in legacy notebook things. The bundler extension also has a number of undefined names and imports that I don't think will work.

@echarles
Copy link
Member

echarles commented Jul 9, 2022

@minrk Can you paste here the commands to reproduce the issue?

@minrk
Copy link
Member Author

minrk commented Jul 9, 2022

Sure! Installing and enabling nbclassic in a clean env is enough:

python3 -m venv /tmp/test-nbclassic
source /tmp/test-nbclassic/bin/activate
pip install nbclassic
jupyter server extension enable --sys-prefix nbclassic # workaround #127
jupyter server

produces:

[W 2022-07-09 16:36:06.934 ServerApp] module 'nbclassic' has no attribute 'base'

Importing nbclassic.bundler.handlers also fails:

$ python3 -c 'import nbclassic.bundler.handlers'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/test-nbclassic/lib/python3.9/site-packages/nbclassic/bundler/handlers.py", line 10, in <module>
    from nbclassic.base.handlers import IPythonHandler
ModuleNotFoundError: No module named 'nbclassic.base'
pip freeze
anyio==3.6.1
appnope==0.1.3
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
asttokens==2.0.5
attrs==21.4.0
backcall==0.2.0
beautifulsoup4==4.11.1
bleach==5.0.1
cffi==1.15.1
debugpy==1.6.2
decorator==5.1.1
defusedxml==0.7.1
entrypoints==0.4
executing==0.8.3
fastjsonschema==2.15.3
idna==3.3
ipykernel==6.15.1
ipython==8.4.0
ipython-genutils==0.2.0
jedi==0.18.1
Jinja2==3.1.2
jsonschema==4.6.2
jupyter-client==7.3.4
jupyter-core==4.11.1
jupyter-server==1.18.1
jupyterlab-pygments==0.2.2
MarkupSafe==2.1.1
matplotlib-inline==0.1.3
mistune==0.8.4
nbclassic==0.4.2
nbclient==0.6.6
nbconvert==6.5.0
nbformat==5.4.0
nest-asyncio==1.5.5
notebook-shim==0.1.0
packaging==21.3
pandocfilters==1.5.0
parso==0.8.3
pexpect==4.8.0
pickleshare==0.7.5
prometheus-client==0.14.1
prompt-toolkit==3.0.30
psutil==5.9.1
ptyprocess==0.7.0
pure-eval==0.2.2
pycparser==2.21
Pygments==2.12.0
pyparsing==3.0.9
pyrsistent==0.18.1
python-dateutil==2.8.2
pyzmq==23.2.0
Send2Trash==1.8.0
six==1.16.0
sniffio==1.2.0
soupsieve==2.3.2.post1
stack-data==0.3.0
terminado==0.15.0
tinycss2==1.1.1
tornado==6.2
traitlets==5.3.0
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==1.3.3

@minrk
Copy link
Member Author

minrk commented Jul 10, 2022

Strangely, there's an additional error in the jupyterhub tests (what brought me here) that prevents load as well:

2022-07-09T02:50:42.0277315Z [I 2022-07-09 02:50:40.173 MockSingleUserServer manager:340] jupyterlab | extension was successfully linked.
2022-07-09T02:50:42.0278001Z [W 2022-07-09 02:50:40.173 MockSingleUserServer manager:344] module 'nbclassic' has no attribute 'base'
2022-07-09T02:50:42.0278516Z [D 50:40.434 MockHub config_manager:93] Paths used for configuration of jupyter_notebook_config: 
2022-07-09T02:50:42.0278878Z     	/tmp/nandy/.jupyter/jupyter_notebook_config.json
2022-07-09T02:50:42.0279336Z [D 50:40.435 MockHub config_manager:93] Paths used for configuration of jupyter_notebook_config: 
2022-07-09T02:50:42.0279697Z     	/etc/jupyter/jupyter_notebook_config.json
2022-07-09T02:50:42.0280134Z [D 50:40.435 MockHub config_manager:93] Paths used for configuration of jupyter_notebook_config: 
2022-07-09T02:50:42.0280491Z     	/usr/local/etc/jupyter/jupyter_notebook_config.json
2022-07-09T02:50:42.0280948Z [D 50:40.435 MockHub config_manager:93] Paths used for configuration of jupyter_notebook_config: 
2022-07-09T02:50:42.0281381Z     	/opt/hostedtoolcache/Python/3.8.13/x64/etc/jupyter/jupyter_notebook_config.d/jupyterlab.json
2022-07-09T02:50:42.0281804Z     	/opt/hostedtoolcache/Python/3.8.13/x64/etc/jupyter/jupyter_notebook_config.json
2022-07-09T02:50:42.0282285Z [D 50:40.436 MockHub config_manager:93] Paths used for configuration of jupyter_notebook_config: 
2022-07-09T02:50:42.0282678Z     	/home/runner/.local/etc/jupyter/jupyter_notebook_config.json
2022-07-09T02:50:42.0283130Z [D 50:40.436 MockHub config_manager:93] Paths used for configuration of jupyter_notebook_config: 
2022-07-09T02:50:42.0283497Z     	/tmp/nandy/.jupyter/jupyter_notebook_config.json
2022-07-09T02:50:42.0284088Z [I 2022-07-09 02:50:40.436 MockSingleUserServer manager:340] notebook_shim | extension was successfully linked.
2022-07-09T02:50:42.0284722Z [I 2022-07-09 02:50:40.470 MockSingleUserServer manager:362] notebook_shim | extension was successfully loaded.
2022-07-09T02:50:42.0285476Z [I 2022-07-09 02:50:40.472 LabApp] JupyterLab extension loaded from /opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/jupyterlab
2022-07-09T02:50:42.0286206Z [I 2022-07-09 02:50:40.472 LabApp] JupyterLab application directory is /opt/hostedtoolcache/Python/3.8.13/x64/share/jupyter/lab
2022-07-09T02:50:42.0286870Z [I 2022-07-09 02:50:40.480 MockSingleUserServer manager:362] jupyterlab | extension was successfully loaded.
2022-07-09T02:50:42.0287461Z [D 2022-07-09 02:50:40.483 MockSingleUserServer manager:355] Traceback (most recent call last):
2022-07-09T02:50:42.0288149Z       File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/jupyter_server/extension/manager.py", line 351, in load_extension
2022-07-09T02:50:42.0288598Z         extension.load_all_points(self.serverapp)
2022-07-09T02:50:42.0289225Z       File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/jupyter_server/extension/manager.py", line 231, in load_all_points
2022-07-09T02:50:42.0289728Z         return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
2022-07-09T02:50:42.0290402Z       File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/jupyter_server/extension/manager.py", line 231, in <listcomp>
2022-07-09T02:50:42.0290895Z         return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
2022-07-09T02:50:42.0291612Z       File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/jupyter_server/extension/manager.py", line 224, in load_point
2022-07-09T02:50:42.0291995Z         return point.load(serverapp)
2022-07-09T02:50:42.0292581Z       File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/jupyter_server/extension/manager.py", line 150, in load
2022-07-09T02:50:42.0292946Z         return loader(serverapp)
2022-07-09T02:50:42.0293597Z       File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/jupyter_server/extension/application.py", line 453, in _load_jupyter_server_extension
2022-07-09T02:50:42.0293997Z         extension.initialize()
2022-07-09T02:50:42.0294656Z       File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/jupyter_server/extension/application.py", line 420, in initialize
2022-07-09T02:50:42.0295031Z         self._prepare_settings()
2022-07-09T02:50:42.0295645Z       File "/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/jupyter_server/extension/application.py", line 290, in _prepare_settings
2022-07-09T02:50:42.0296056Z         webapp = self.serverapp.web_app
2022-07-09T02:50:42.0296462Z     AttributeError: 'ServerApp' object has no attribute 'web_app'
2022-07-09T02:50:42.0296713Z     
2022-07-09T02:50:42.0303345Z [W 2022-07-09 02:50:40.483 MockSingleUserServer manager:356] nbclassic | extension failed loading with message: 'ServerApp' object has no attribute 'web_app'

I'm not 100% sure what's different there, but #130 appears to fix it.

@echarles
Copy link
Member

Thx @minrk I have run those commands on my env and it works fine (was also working fine in my existing conda env).

python3 -m venv /tmp/test-nbclassic
source /tmp/test-nbclassic/bin/activate
pip install nbclassic
jupyter server extension enable --sys-prefix nbclassic # workaround #127
jupyter server
open http://localhost:8888/tree

It is true that there is a warning module 'nbclassic' has no attribute 'base'. Starting with --debug does not give more details. I think jupyter-server is silently catching some errors (cc/ @Zsailer)

[W 2022-07-10 07:45:24.924 ServerApp] module 'nbclassic' has no attribute 'base'
[I 2022-07-10 07:45:25.169 ServerApp] notebook_shim | extension was successfully linked.
[I 2022-07-10 07:45:25.225 ServerApp] notebook_shim | extension was successfully loaded.
[I 2022-07-10 07:45:25.229 ServerApp] nbclassic | extension was successfully loaded.
[I 2022-07-10 07:45:25.236 ServerApp] Serving notebooks from local directory: /Users/echarles/datalayer-platform/ext/jupyter-notebook-classic
[I 2022-07-10 07:45:25.236 ServerApp] Jupyter Server 1.18.1 is running at:
[I 2022-07-10 07:45:25.236 ServerApp] http://localhost:8888/?token=14ba66dd9fea8e60dd6a5f3ba06224d61f68555044bcbed1
[I 2022-07-10 07:45:25.236 ServerApp]  or http://127.0.0.1:8888/?token=14ba66dd9fea8e60dd6a5f3ba06224d61f68555044bcbed1
[I 2022-07-10 07:45:25.236 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2022-07-10 07:45:25.244 ServerApp] 
    
    To access the server, open this file in a browser:
        file:///Users/echarles/Library/Jupyter/runtime/jpserver-25920-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=14ba66dd9fea8e60dd6a5f3ba06224d61f68555044bcbed1
     or http://127.0.0.1:8888/?token=14ba66dd9fea8e60dd6a5f3ba06224d61f68555044bcbed1
[W 2022-07-10 07:45:40.370 ServerApp] 404 GET /nbclassic (::1) 5.60ms referer=None
^C[I 2022-07-10 07:45:48.629 ServerApp] interrupted
Serving notebooks from local directory: /Users/echarles/datalayer-platform/ext/jupyter-notebook-classic
0 active kernels
Jupyter Server 1.18.1 is running at:
http://localhost:8888/?token=14ba66dd9fea8e60dd6a5f3ba06224d61f68555044bcbed1
 or http://127.0.0.1:8888/?token=14ba66dd9fea8e60dd6a5f3ba06224d61f68555044bcbed1
Shutdown this Jupyter server (y/[n])? ^C[C 2022-07-10 07:45:48.845 ServerApp] received signal 2, stopping
[I 2022-07-10 07:45:48.847 ServerApp] Shutting down 2 extensions
[I 2022-07-10 07:45:48.848 ServerApp] Shutting down 0 terminals

@jongillham
Copy link

jongillham commented Jul 11, 2022

FYI I had the same issue as well https://stackoverflow.com/questions/72883216/jupyterhub-fails-to-spawn-new-session-with-no-module-named-ipythonhandler when running the JupyterHub Docker image. My JupyterHub service stopped working after I rebuilt the container and I had to pin to version 0.3.7.

@echarles
Copy link
Member

@minrk @jongillham nbclassic 0.4.3 is released https://github.com/jupyter/nbclassic/releases/tag/v0.4.3
I hope it solves the issues you have encountered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants