Issue in jupyter notebook

hi dear


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\”, line 235, in _resolve_classes
klass = self._resolve_string(klass)
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\”, line 2009, in _resolve_string
return import_item(string)
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\utils\”, 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\”, line 10, in
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\jupyter_core\”, line 285, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\config\”, line 1044, in launch_instance
app = cls.instance(**kwargs)
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\config\”, line 555, in instance
inst = cls(*args, **kwargs)
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\”, line 1295, in new
inst.setup_instance(*args, **kwargs)
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\”, line 1338, in setup_instance
super(HasTraits, self).setup_instance(*args, **kwargs)
File “C:\Users\MAHMO\AppData\Roaming\Python\Python311\site-packages\traitlets\”, line 1314, in setup_instance
File “C:\Users\MAHMO\anaconda3\Lib\site-packages\notebook\”, line 226, in instance_init
File “C:\Users\MAHMO\anaconda3\Lib\site-packages\notebook\”, 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


I would recommend two things:
a) installing all packages together. currently you are installing a metapackage jupyter (Jupyter :: 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