13

When using an Anaconda environment, I can't start Jupyter to work in a notebook. I can do so without the environment, but I need to be able to use the environment. Here's what I do and the errors I get:

ben@ben-K60IJ:~/surveillance_sound_classifier/surveillance_sound_classifier$ source activate EECS352
discarding /home/ben/anaconda/bin from PATH
prepending /home/ben/anaconda/envs/EECS352/bin to PATH
(EECS352)ben@ben-K60IJ:~/surveillance_sound_classifier/surveillance_sound_classifier$ jupyter notebook
Traceback (most recent call last):
  File "/home/ben/anaconda/envs/EECS352/bin/jupyter-notebook", line 4, in <module>
import notebook.notebookapp
  File "/home/ben/anaconda/envs/EECS352/lib/python2.7/site-packages/notebook/notebookapp.py", line 61, in <module>
from .services.contents.manager import ContentsManager
  File "/home/ben/anaconda/envs/EECS352/lib/python2.7/site-packages/notebook/services/contents/manager.py", line 16, in <module>
from nbformat import sign, validate, ValidationError
  File "/home/ben/anaconda/envs/EECS352/lib/python2.7/site-packages/nbformat/__init__.py", line 33, in <module>
from .validator import validate, ValidationError
  File "/home/ben/anaconda/envs/EECS352/lib/python2.7/site-packages/nbformat/validator.py", line 21, in <module>
raise ImportError(str(e) + verbose_msg)
ImportError: No module named functools32

Jupyter notebook format depends on the jsonschema package:

    https://pypi.python.org/pypi/jsonschema

Please install it first.

Yes, I've done pip install jsonschema and conda install jsonschema AND pip install functools32 and conda install functools32 from within the EECS352 environment to no avail; I arrive at an almost identical error, except this time, functools32 is replaced with _version.

I've reinstalled Anaconda, updated all its packages, created a new environment in the same way I created this one, and still I get this error. I'm using Ubuntu 15.10 32-bit. I used to be able to use this environment with no problems until roughly a week ago.

If this is a duplicate, please point me to the original; however, I haven't yet found anything that seems really relevant. The only thing that might be relevant is that this error did pop up after I modified some .conf file because I was having issues updating my computer's software using sudo apt-get upgrade. I don't recall what I had done and to which file, but if it's likely the source of this issue, I can spend some time trying to track it down. Please let me know if I should spend my time to do this, and I will.

Derek O
  • 16,770
  • 4
  • 24
  • 43
Ben Sandeen
  • 1,403
  • 3
  • 14
  • 17
  • Did you install the requirements within your virtualenv of EECS352? – Kevin London Mar 09 '16 at 22:03
  • What do you mean by "requirements"? I'm using the exact same environment that was working roughly a week ago. Nothing in the environment has changed. – Ben Sandeen Mar 09 '16 at 22:06
  • requirements in this sense meaning the `jsonschema` package and `functools32` – Kevin London Mar 09 '16 at 23:01
  • Oh, sorry, I didn't specify that I did both the `pip` and `conda` `install` of `jsonschema` and `functools32` from __within__ the EECS352 environment. I'll update my question, thanks. – Ben Sandeen Mar 10 '16 at 02:34
  • Oh, I have the same problem. I installed jupyter some weeks ago. But today, using anaconda, it fails to launch for the same jsonschema library. – visoft Mar 23 '16 at 13:17
  • @BenSandeen did you solve the problem? I think is something wrong with the anaconda distribution. I installed anaconda on a fresh system and I hit in the same problem. But ```pip install --upgrade jsonschema``` (as described below) solved it. – visoft Apr 07 '16 at 15:16
  • Nope, I haven't solved it, I just worked around it since it was finals week and since then, I haven't really need it anymore, so I haven't bothered too much with it – Ben Sandeen Apr 10 '16 at 03:37
  • I tried all of the posted solutions but unfortunately none of them worked for me. In the end, I solved it by creating a new conda environment. This may not be a solution but might be good to know. – Boson Bear Mar 09 '20 at 09:49

8 Answers8

24

I think I have a solution.

I did may things, regenerated my env (anaconda env) from another computer where it worked, but no success.

What I think that nailed it is upgrading jsonschema to 2.5.1

Here are my steps from "bad" jupyter env to working jupyter env.

Good luck and come back if it doesn't work, I will post the notebook* relevant versions.

>conda upgrade pip
pip:        8.1.0-py27_0  --> 8.1.1-py27_0
setuptools: 20.2.2-py27_0 --> 20.3-py27_0 

>pip install functools32
Downloading functools32-3.2.3-2.tar.gz    
Successfully installed functools32-3.2.3.post2

>jupyter notebook
ImportError: No module named _version
Jupyter notebook format depends on the jsonschema package:
    https://pypi.python.org/pypi/jsonschema
Please install it first.

>pip install jsonschema
Requirement already satisfied

>pip install --upgrade jsonschema
Collecting jsonschema
Downloading jsonschema-2.5.1-py2.py3-none-any.whl
Successfully uninstalled jsonschema-2.4.0
Successfully installed jsonschema-2.5.1

>jupyter notebook
[I 16:45:41.708 NotebookApp] Writing notebook server cookie secret to 
[I 16:45:42.134 NotebookApp] Serving notebooks from local directory: 
[I 16:45:42.134 NotebookApp] 0 active kernels 
[I 16:45:42.134 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
visoft
  • 503
  • 5
  • 13
  • What is weird is that I cloned a working env using `conda list -e` command. There I have the old jsonschema (2.4.0). Beats me where is the conflict or what other dependencies are not listed by anaconda. On working env I installed stuff directly from github with `python setup.py`. I don't know how conda/pip monitor/knows what is installed or not and at this point I am too afraid to ask :) – visoft Mar 23 '16 at 15:01
5

i also got the same error and none of the above mentioned procedures worked for me so i've checked the documentation of anaconda and found something useful

conda install -c conda-forge/label/cf201901 jsonschema

conda install jupyter

jupyter notebook

this worked for me,thanks to anaconda documentation

kamma rahul
  • 137
  • 2
  • 3
4

Re-install jsonschema solve the problem in my case:

$ pip uninstall jsonschema
...

$ pip install jsonschema
...
biendltb
  • 1,149
  • 1
  • 13
  • 20
1

If any of the above mentioned solution didn't work then try this in your anaconda prompt: First run conda update -n root conda so you have the latest conda version installed. Then run conda update --all This will update all packages in the current environment to the latest version. Even after installing jsonschema, your Jupyter Notebook might not run and give you the error:

Jupyter notebook format depends on the jsonschema package:
https://pypi.python.org/pypi/jsonschema
Please install it first

Then I suggest you to run the given two commands. It will solve your issue as it solved mine.

Sven Eberth
  • 3,057
  • 12
  • 24
  • 29
Joe
  • 23
  • 5
0

Try this from the terminal:

pip install ipython[notebook]

It worked for me, let me know if the problem still exists.

0

I had the same problem.

I solved it by running this command

conda install -c anaconda jsonschema

https://anaconda.org/anaconda/jsonschema

searain
  • 3,143
  • 6
  • 28
  • 60
0

I solved it by just uninstalling and reinstalling python 3.7

-1

Try this from terminal, it worked to me:

pip install --upgrade pyrsistent
bjc01
  • 1