2

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!

Ramya T
  • 53
  • 1
  • 6

3 Answers3

4

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
Shiv948
  • 469
  • 5
  • 13
  • This also applies if you didn't install attrs through your package manager (pacman in my case). The reason is the same. – Maxim Schmidt Mar 27 '22 at 09:35
0

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

hynek
  • 3,647
  • 1
  • 18
  • 26
  • Not unless you installed https://pypi.org/project/attr/ by hand. Do you have a file named `attr.py` somewhere in your project? – hynek Mar 29 '20 at 08:52
  • Yes, attr.py is present inside, C:\Users\Ramya\AppData\Roaming\Python\Python37\site-packages - I deleted that and reinstalled Anaconda. Now I'm able to launch Jupyter. – Ramya T Mar 29 '20 at 12:47
0
  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.
leo
  • 1
  • 2