Jupyter is not opening

Hi guys, i was wunning a code and I installed a library and suddenly Jupyter stopped working. I uninstalled and installed twice but nothing, the message that appears said:

Traceback (most recent call last):
**File “C:\ProgramData\Anaconda3\Scripts\jupyter-notebook-script.py”, line 6, in **
from notebook.notebookapp import main
**File “C:\ProgramData\Anaconda3\lib\site-packages\notebook\notebookapp.py”, line 44, in **
from jinja2 import Environment, FileSystemLoader
**File “C:\ProgramData\Anaconda3\lib\site-packages\jinja2_init_.py”, line 12, in **
from .environment import Environment
**File “C:\ProgramData\Anaconda3\lib\site-packages\jinja2\environment.py”, line 25, in **
from .defaults import BLOCK_END_STRING
**File “C:\ProgramData\Anaconda3\lib\site-packages\jinja2\defaults.py”, line 3, in **
from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401
**File “C:\ProgramData\Anaconda3\lib\site-packages\jinja2\filters.py”, line 13, in **
from markupsafe import soft_unicode
ImportError: cannot import name ‘soft_unicode’ from ‘markupsafe’ (C:\Users\acuad\AppData\Roaming\Python\Python39\site-packages\markupsafe_init_.py)

What can i do? :frowning:

Do you remember what library you installed? By looking at paths in the traceback, it seems that you may have two conflicting installations of markupsafe: one in Anaconda3 environment, and one in AppData\Roaming. It could be a result of mixing up conda install and pip install. Could you please:

  1. provide conda list and pip list
    2 . try running pip uninstall markupsafe and checking if Jupyter now works?

Note: also seen in Jupyter Notebook Launch Error

Hi I have the same problem and I have already tried downgrading Markupsafe and uninstalling it but I still get the same import error when I try to launch Jupyter Notebook from Anaconda.
Here is my code in terminal:
jupyter notebook
Traceback (most recent call last):
File “/Users/name/opt/anaconda3/bin/jupyter-notebook”, line 7, in
from notebook.notebookapp import main
File “/Users/name/opt/anaconda3/lib/python3.9/site-packages/notebook/notebookapp.py”, line 44, in
from jinja2 import Environment, FileSystemLoader
File “/Users/name/opt/anaconda3/lib/python3.9/site-packages/jinja2/init.py”, line 12, in
from .environment import Environment
File “/Users/name/opt/anaconda3/lib/python3.9/site-packages/jinja2/environment.py”, line 25, in
from .defaults import BLOCK_END_STRING
File “/Users/name/opt/anaconda3/lib/python3.9/site-packages/jinja2/defaults.py”, line 3, in
from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401
File “/Users/name/opt/anaconda3/lib/python3.9/site-packages/jinja2/filters.py”, line 13, in
from markupsafe import soft_unicode
ImportError: cannot import name ‘soft_unicode’ from ‘markupsafe’ (/Users/name/.local/lib/python3.9/site-packages/markupsafe/init.py)

Would you mind providing conda list, pip list and jupyter --version output, please?

1 Like

My conda list nor my pip list have markup safe.

This is my jupyter version output:
Selected Jupyter core packages…
IPython : 8.5.0
ipykernel : 6.16.0
ipywidgets : 8.0.2
jupyter_client : 7.3.5
jupyter_core : 5.0.0rc1
jupyter_server : not installed
jupyterlab : not installed
nbclient : not installed
nbconvert : not installed
nbformat : not installed
notebook : not installed
qtconsole : not installed
traitlets : 5.4.0

Here discusses how the issue is coming up now because soft_unicode was removed from markupsafe. Covered here is the change where soft_unicode became soft_str.

Some of the more thorough options towards the bottom of that thread, such as here may help those encountering this issue at present.
This post has a nice command to force the re-install step if you are having issues.