Issue starting new jupyter notebook (says For debugging purposes, this card will be retained for 6 more days)

Dear All, I am trying to create an instance of jupyter notebook. It first shows “Your session is currently starting… Please be patient as this process can take a few minutes.” but then instead of starting the notebook it goes to “For debugging purposes, this card will be retained for 6 more days”. I tried to debug this and found that when script.sh runs to launch the Jupyter Notebook Server it gives the below error. I guess that it happened cause I tried to install a few python packages (matplotlib, matplotlib_inline and IPython). Is there any way to fix this?

Thanks

Traceback (most recent call last):
File “/usr/local/pace-apps/manual/packages/anaconda3/2022.05/lib/python3.9/site-packages/notebook/traittypes.py”, line 232, in _resolve_classes
klass = self._resolve_string(klass)
File “/home/hice1/aagrawal433/.local/lib/python3.9/site-packages/traitlets/traitlets.py”, line 2015, in _resolve_string
return import_item(string)
File “/home/hice1/aagrawal433/.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 the handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/pace-apps/manual/packages/anaconda3/2022.05/bin/jupyter-notebook”, line 11, in
sys.exit(main())
File “/usr/local/pace-apps/manual/packages/anaconda3/2022.05/lib/python3.9/site-packages/jupyter_core/application.py”, line 264, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File “/home/hice1/aagrawal433/.local/lib/python3.9/site-packages/traitlets/config/application.py”, line 1073, in launch_instance
app = cls.instance(**kwargs)
File “/home/hice1/aagrawal433/.local/lib/python3.9/site-packages/traitlets/config/configurable.py”, line 583, in instance
inst = cls(*args, **kwargs)
File “/home/hice1/aagrawal433/.local/lib/python3.9/site-packages/traitlets/traitlets.py”, line 1292, in new
inst.setup_instance(*args, **kwargs)
File “/home/hice1/aagrawal433/.local/lib/python3.9/site-packages/traitlets/traitlets.py”, line 1335, in setup_instance
super(HasTraits, self).setup_instance(*args, **kwargs)
File “/home/hice1/aagrawal433/.local/lib/python3.9/site-packages/traitlets/traitlets.py”, line 1311, in setup_instance
init(self)
File “/usr/local/pace-apps/manual/packages/anaconda3/2022.05/lib/python3.9/site-packages/notebook/traittypes.py”, line 223, in instance_init
self._resolve_classes()
File “/usr/local/pace-apps/manual/packages/anaconda3/2022.05/lib/python3.9/site-packages/notebook/traittypes.py”, line 235, in _resolve_classes
warn(f"{klass} is not importable. Is it installed?", ImportWarning)
TypeError: warn() missing 1 required keyword-only argument: ‘stacklevel’
Timed out waiting for Jupyter Notebook server to open port 31948!

Hello, and welcome!

In searching for potential causes of your first error, I came across this: ModuleNotFoundError: No module named 'jupyter_server.contents' switching to Python kernel · Issue #24436 · microsoft/azuredatastudio · GitHub - which makes it look like you might be facing a known issue with a recent version of traitlets. Can you check what happens if you run the following:

pip uninstall traitlets
pip install traitlets==5.9.0

I followed this article and already tried to uninstall traitlets in the interactive shell. It says that it cannot install this as it is not installed. If I tried installing it it would give some installation error as shown below.

Uninstalling error:
Cannot uninstall requirement traitlets, not installed
You are using pip version 8.1.2, however version 24.0 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.

Installing error:
Collecting traitlets==5.9.0
Using cached https://files.pythonhosted.org/packages/39/c3/205e88f02959712b62008502952707313640369144a7fded4cbc61f48321/traitlets-5.9.0.tar
.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File “”, line 1, in
IOError: [Errno 2] No such file or directory: ‘/tmp/pip-build-0UZPi1/traitlets/setup.py’

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-0UZPi1/traitlets/

I resolved the issue. I was not importing the correct modules before uninstalling traitlets. Thanks for the help. The method suggested by you worked after I imported the correct modules.