I've tried to install jupyter extensions following the instruction here.
The first step named 'Install the python package' in the instruction was succeeded.
But the second one named 'Install javascript and css files' was failed.
I executed jupyter contrib nbextension install --user
as instructed, but an error occured.
The error says: pkg_resources.DistributionNotFound: The 'terminado>=0.8.1' distribution was not found and is required by notebook
. (All traceback shown is as below.)
But I confirmed that I've already installed 'terminado' v0.8.2 package, which was installed via pip.
How can I handle this problem? Is the problem solely that jupyter command does not know where the 'terminado' is installed? Or is the problem more serious?
All the error message is as below:
Traceback (most recent call last):
File "/usr/local/bin/jupyter-contrib", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3241, in <module>
@_call_aside
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3225, in _call_aside
f(*args, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 583, in _build_master
ws.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'terminado>=0.8.1' distribution was not found and is required by notebook
I'm using macOS Catalina (but same problem appeared on Mojave.
The problem is, as it may be turned out with seeing the error message, that the jupyter contrib
command uses python2, not python3 which is my preference.
The usage of python2 by the command was caused by the shebang of /usr/local/bin/jupyter-contrib
file.
The shebang was #!/usr/bin/python
, which means that it specified jupyter-contrib
used python interpreter which located on /usr/bin/python
which is python2 on my machine (and many other Mac machine, maybe).
Hence you should specify python3 with the shebang rather than python2.
First, get your python3 installation path like this:
$ which python3
Copy the returned path.
Open the /usr/local/bin/jupyter-contrib
file. Note that this file is read-only but you have to rewrite it, so you should open it with sudo
:
$ sudo vim /usr/local/bin/jupyter-contrib
Rewrite the shebang on the 1st line. Shebang may now be like this:
#!/usr/bin/python
where it specifies python2 as its interpreter. You should rewrite the path to python3's path which you copied at step 1:
#!{{Paste your python3's path}}
Save the file.
That's it.
Now jupyter-contrib
uses python3.
So jupyter contrib nbextension install --user
command should succeeds.