Issue in jupyter notebook

hi dear

greetings

i just started in python for graduate project after create new environment in anaconda and run below commands in anaconda prompt

///////////////////////////////////////////////////////////////////

conda update conda -y

conda upgrade conda -y

conda remove --force jupyter -y

conda remove --force jupyterlab -y

conda remove --force jupyter notebook -y

conda remove --force jupyter_server -y


install jupyter

conda install jupyter -y

conda install jupyterlab -y

conda install jupyter notebook -y

conda install jupyter_server -y
//////////////////////////////////////////////////////////////////

i got this errors
//////////////////////////////////////////////////////////////////

(base) PS C:\Users\MAHMO> jupyter notebook
Traceback (most recent call last):
File “C:\Users\MAHMO\anaconda3\Lib\site-packages\notebook\traittypes.py”, line 235, in _resolve_classes
klass = self._resolve_string(klass)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\traitlets.py”, line 2009, in _resolve_string
return import_item(string)
^^^^^^^^^^^^^^^^^^^
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\utils\importstring.py”, line 30, 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 “C:\Users\MAHMO\anaconda3\Scripts\jupyter-notebook-script.py”, line 10, in
sys.exit(main())
^^^^^^
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\jupyter_core\application.py”, line 285, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\config\application.py”, line 1044, in launch_instance
app = cls.instance(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\config\configurable.py”, line 555, in instance
inst = cls(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\traitlets.py”, line 1295, in new
inst.setup_instance(*args, **kwargs)
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\traitlets.py”, line 1338, in setup_instance
super(HasTraits, self).setup_instance(*args, **kwargs)
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\traitlets.py”, line 1314, in setup_instance
init(self)
File “C:\Users\MAHMO\anaconda3\Lib\site-packages\notebook\traittypes.py”, line 226, in instance_init
self._resolve_classes()
File “C:\Users\MAHMO\anaconda3\Lib\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’

//////////////////////////////////////////////////////////////////

for python and jupyter version

(base) PS C:\Users\MAHMO> python --version
Python 3.11.5
(base) PS C:\Users\MAHMO> jupyter --version
Selected Jupyter core packages…
IPython : 8.15.0
ipykernel : 6.25.2
ipywidgets : 8.0.4
jupyter_client : 8.3.1
jupyter_core : 5.3.1
jupyter_server : 2.7.3
jupyterlab : 3.6.3
nbclient : 0.8.0
nbconvert : 7.8.0
nbformat : 5.9.2
notebook : 6.5.4
qtconsole : 5.4.2
traitlets : 5.10.0

Please help

BR

I would recommend two things:
a) installing all packages together. currently you are installing a metapackage jupyter (Jupyter :: Anaconda.org) which is likely not needed; you should not need to install jupyter-server manually
b) trying conda-forge if you want the latest versions as this is where Jupyter maintainers upload packages

So in a fresh environment, conda install -c conda-forge jupyterlab notebook. If you want specific versions you could pin them, for example conda install -c conda-forge jupyterlab=4.0.6 notebook=7.0.4

1 Like