Error while launching Jupyter Notebook - @attr.s(hash=True) AttributeError: module 'attr' has no attribute 's'

Viewed 1417

I am not able to launch or open Jupyter Notebook. I have uninstalled and installed it multiple times, still get the same error which I have pasted below!

It's giving some 'Attribute Error'.

Traceback (most recent call last):
File "C:\Users\Ramya\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in 
from notebook.notebookapp import main
File "C:\Users\Ramya\anaconda3\lib\site-packages\notebook\notebookapp.py", line 80, in 
from .services.contents.manager import ContentsManager
File "C:\Users\Ramya\anaconda3\lib\site-packages\notebook\services\contents\manager.py", line 17, in 
from nbformat import sign, validate as validate_nb, ValidationError
File "C:\Users\Ramya\anaconda3\lib\site-packages\nbformat\__init__.py", line 32, in 
from .validator import validate, ValidationError
File "C:\Users\Ramya\anaconda3\lib\site-packages\nbformat\validator.py", line 12, in 
from jsonschema import ValidationError
File "C:\Users\Ramya\anaconda3\lib\site-packages\jsonschema\__init__.py", line 11, in 
from jsonschema.exceptions import (
File "C:\Users\Ramya\anaconda3\lib\site-packages\jsonschema\exceptions.py", line 152, in 
@attr.s(hash=True)
AttributeError: module 'attr' has no attribute 's'

Please help!

3 Answers

Run Anaconda prompt as Admin

pip uninstall attr

followed by

conda install --force attrs

Now jupyter notebook should work.

Reason for the Issue :

  • attr pip package was installed into your user site-packages directory.
  • That is loaded in preference to the site-packages directory maintained by conda.
  • so every time you launch your Jupyter - attr package is been referred from your user site-packages instead of attrs from conda

You have most likely created a module with the name attr that is shadowing the PyPI package required by jsonschema.

  1. Search the file named 'attr.py' on your computer
  2. Delete that file
  3. Reopen Jupiter notebook or redownload it This works on my computer, I have tried' pip uninstall attr' and it does not work, I guess we should do it by hand.
Related