[MacPorts] #69244: Problem of versions of jupyter notebook and traitlets

MacPorts noreply at macports.org
Tue Jan 30 20:41:11 UTC 2024


#69244: Problem of versions of jupyter notebook and traitlets
-------------------------------+----------------------------
 Reporter:  jolivetr           |      Owner:  (none)
     Type:  defect             |     Status:  new
 Priority:  High               |  Milestone:
Component:  ports              |    Version:
 Keywords:  jupyter, notebook  |       Port:  py311-notebook
-------------------------------+----------------------------
 Dear all,

 I am facing an issue I cannot seem to be able to solve myself. I am trying
 to install jupyter notebook and the latest version of the port gives me
 the 6.4 while it conflicts with the latest version of traitlets for some
 warning issue (from what I have understood from my browsing various forums
 on the web).

 Here is the message I get


 {{{
 dhcp140 21:27:53 ~/Downloads > jupyter notebook
 Traceback (most recent call last):
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/notebook/traittypes.py", line 235, in _resolve_classes
     klass = self._resolve_string(klass)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/traitlets/traitlets.py", line 2015, in _resolve_string
     return import_item(string)
            ^^^^^^^^^^^^^^^^^^^
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /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/local/Library/Frameworks/Python.framework/Versions/3.11/bin
 /jupyter-notebook", line 8, in <module>
     sys.exit(main())
              ^^^^^^
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/jupyter_core/application.py", line 277, in launch_instance
     return super().launch_instance(argv=argv, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/traitlets/config/application.py", line 1073, in
 launch_instance
     app = cls.instance(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/traitlets/config/configurable.py", line 583, in instance
     inst = cls(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/traitlets/traitlets.py", line 1292, in __new__
     inst.setup_instance(*args, **kwargs)
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/traitlets/traitlets.py", line 1335, in setup_instance
     super(HasTraits, self).setup_instance(*args, **kwargs)
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/traitlets/traitlets.py", line 1311, in setup_instance
     init(self)
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /site-packages/notebook/traittypes.py", line 226, in instance_init
     self._resolve_classes()
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
 /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'
 }}}

 Most answers I found point to the fact that notebook is calling for a
 private method of traitlets called warn while it should be calling for
 warnings.warn, which is public. I'd like to push forward a newer version
 of notebook (7.x.x?) but that involves a lot of dependencies and I don't
 know which ones must be pushed forward. In the meantime, I'll work out a
 dirty hack, if I can...

 Thanks for the help and for the fix, if possible. If there is something
 wrong on my side, I am happy to be taught (I just uninstalled/reinstalled
 macports to fix this). It was working with python38 and broke since I am
 trying to move to python311 (yeah, I know, I am late...)

 Cheers,
 R

-- 
Ticket URL: <https://trac.macports.org/ticket/69244>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list