1

Have you guys faced this problem before? I was installing cuCNN and after the installation, I cannot open Jupyter Notebooks anymore.

When I try it I got this error:

(base) PS C:\Users\USER> jupyter notebook

(base) PS C:\Users\USER> jupyter notebook
Traceback (most recent call last):
  File "D:\Program Files(D)\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
    from notebook.notebookapp import main
  File "D:\Program Files(D)\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 43, in <module>
    from jinja2 import Environment, FileSystemLoader
  File "D:\Program Files(D)\Anaconda3\lib\site-packages\jinja2\__init__.py", line 6, in <module>
    from markupsafe import escape

ImportError: cannot import name 'escape' from 'markupsafe' (unknown location)
(base) PS C:\Users\USER>

Does anyone know how to solve it? I executed these commands to install cuDNN:

conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/
python3 -m pip install tensorflow
https://www.tensorflow.org/install/pip#windows-wsl2
  • Does this answer your question? [ImportError: cannot import name 'escape' from 'jinja2'](https://stackoverflow.com/questions/71718167/importerror-cannot-import-name-escape-from-jinja2) – β.εηοιτ.βε Mar 21 '23 at 16:35

1 Answers1

0

I solved it hopefully:

"You have to reinstall markupsafe"

After trying several things I had to remove "markupsafe" manually, because "pip uninstall markupsafe" did not work out, once removed it, proceed to install markupsafe again(pip install markupsafe)... and that's it.

Note that for me only worked markupsafe 2.0.1, superior versions had other problems(this problem: https://github.com/aws/aws-sam-cli/issues/3661) pip install markupsafe==2.0.1

  • It's good that at least solved things for now; however, as Anaconda/conda is your main package manager, and in fact distribution you are using, it is in general best to stick with installing via conda when possible, see [here for the command in this case](https://anaconda.org/conda-forge/markupsafe). Of course, you can specify the version with conda, too. – Wayne Feb 20 '23 at 04:27