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

aiidalab/full-stack:edge container crashing #494

Closed
edan-bainglass opened this issue Aug 16, 2024 · 8 comments · Fixed by aiidalab/aiidalab-widgets-base#629
Closed

aiidalab/full-stack:edge container crashing #494

edan-bainglass opened this issue Aug 16, 2024 · 8 comments · Fixed by aiidalab/aiidalab-widgets-base#629
Assignees

Comments

@edan-bainglass
Copy link
Member

Crashing with the following message:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/notebook/traittypes.py", line 235, in _resolve_classes
    klass = self._resolve_string(klass)
  File "/home/jovyan/.local/lib/python3.9/site-packages/traitlets/traitlets.py", line 2015, in _resolve_string
    return import_item(string)
  File "/home/jovyan/.local/lib/python3.9/site-packages/traitlets/utils/importstring.py", line 33, in import_item
    module = __import__(package, fromlist=[obj])
ModuleNotFoundError: No module named 'jupyter_server.contents'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/bin/jupyter-notebook", line 10, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.9/site-packages/jupyter_core/application.py", line 269, in launch_instance
    return super().launch_instance(argv=argv, **kwargs)
  File "/home/jovyan/.local/lib/python3.9/site-packages/traitlets/config/application.py", line 1073, in launch_instance
    app = cls.instance(**kwargs)
  File "/home/jovyan/.local/lib/python3.9/site-packages/traitlets/config/configurable.py", line 583, in instance
    inst = cls(*args, **kwargs)
  File "/home/jovyan/.local/lib/python3.9/site-packages/traitlets/traitlets.py", line 1292, in __new__
    inst.setup_instance(*args, **kwargs)
  File "/home/jovyan/.local/lib/python3.9/site-packages/traitlets/traitlets.py", line 1335, in setup_instance
    super(HasTraits, self).setup_instance(*args, **kwargs)
  File "/home/jovyan/.local/lib/python3.9/site-packages/traitlets/traitlets.py", line 1311, in setup_instance
    init(self)
  File "/opt/conda/lib/python3.9/site-packages/notebook/traittypes.py", line 226, in instance_init
    self._resolve_classes()
  File "/opt/conda/lib/python3.9/site-packages/notebook/traittypes.py", line 238, in _resolve_classes
    warn(f"{klass} is not importable. Is it installed?", ImportWarning)
TypeError: warn() missing 1 required keyword-only argument: 'stacklevel'
@danielhollas
Copy link
Contributor

@edan-bainglass thanks for the report. Is it crashing on container startup? Where exactly do you see this trace?

@edan-bainglass
Copy link
Member Author

On container startup

@unkcpz
Copy link
Member

unkcpz commented Aug 16, 2024

Just provide more context, if I understand correctly from the discussion with @edan-bainglass, he changed to use edge image for his profile and it can not start with the exception above. My guess was some jupyter core package installed in his home folder that cause the conflict. I remember @danielhollas pinned a jupyter package version could that be the cause of the issue?

@danielhollas
Copy link
Contributor

jupyter package version could that be the cause of the issue?

No, I don't think that's the issue. But I believe I saw something similar when i was upgrading the container to the edge image.

@edan-bainglass Can you provide the output of pip list --user in the container?
You're going to have to run the container manually with attached volume, depending on your config, something like (substitute <profile_name> with the name of your profile if you use aiidalab-launch

docker run -v aiidalab_<profile_name>_home:/home/jovyan ghcr.io/aiidalab/full-stack:edge pip list --user

@danielhollas
Copy link
Contributor

My guess was some jupyter core package installed in his home folder that cause the conflict.

Yes, I'd guess this is likely. Another thing to know is what was the previous version of the image that worked?

@danielhollas
Copy link
Contributor

According to this issue, downgrading or upgrading traitlets might fix this jupyter/notebook#7048

@danielhollas
Copy link
Contributor

danielhollas commented Aug 18, 2024

It seems that this is caused by traitlets>=5.10.0 . @edan-bainglass can you please confirm what version of traitlets are you running? You should be able to get it working by installing traitlets==5.9.0.

I would also be interested about which version of the image have you been running previously. AFAIK this is not a problem with edge, I see in with latest and also with previous versions, so now I am thoroughly confused as to how this ever worked and why we did not notice it previously???

Ohhh, I found it. 😅 It looks like this issue has been introduced only very recently in aiidalab-widgets-base==2.3.0a1 where I unpinned the traitlets version specifier from ==5.9.0 to ~=5.9, I didn't know that newer versions did not work. I'll put up some PRs to fix this, but in the meantime @edan-bainglass you'll have to reinstall traitlets manually.

EDIT: Here's the PR that introduced this aiidalab/aiidalab-widgets-base#621
This also uncovers a problem with the current tests which clearly did not catch this. The problem is that when running the notebook tests in AWB, we first launch the container, and only then we install AWB. Which means that we don't catch issues that only pop up once the container is restarted. (also related to #477 in this repo)

@edan-bainglass
Copy link
Member Author

@danielhollas thanks for taking care of this. Note that it is no longer a concern for me at the moment.

A bit of context - I was exploring Solara for app/widget development, specifically for the QueryBuilder-widget. As it would be part of the widgets base repo, I figured I'd develop in an AiiDAlab container. Solara requires ipywidgets v8.x. Hence, I checked out the full-stack:edge image. Then the above issue occurred. However, in the meantime, I had decided to instead develop in a separate/dedicated repo. Therefore, no longer an issue.

In any case, good we caught this bug. Thanks again @danielhollas, @unkcpz for addressing it.

danielhollas added a commit to danielhollas/aiidalab-widgets-base that referenced this issue Aug 21, 2024
As we learned in aiidalab/aiidalab-docker-stack#494,
it is really not good if traitlets dependency is installed
outside of the conda enviroment (i.e. to ~/.local) as it may
break the jupyter notebook. Here we downgrade the minimum traitlets
version back to 5.4.

(NOTE: That the original motivation to upgrading to 5.9 was performance,
I believe it is better if we upgrade directly in the image).
danielhollas added a commit to aiidalab/aiidalab-widgets-base that referenced this issue Aug 22, 2024
As we learned in aiidalab/aiidalab-docker-stack#494,
it is really not good if traitlets dependency is installed
outside of the conda enviroment (i.e. to ~/.local) as it may
break the jupyter notebook. Here we downgrade the minimum traitlets
version back to 5.4.

(NOTE: That the original motivation to upgrading to 5.9 was performance,
I believe it is better if we upgrade directly in the image).
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