ipython-contrib / jupyter_contrib_nbextensions

A collection of various notebook extensions for Jupyter
http://jupyter-contrib-nbextensions.readthedocs.io/en/latest
Other
5.23k stars 806 forks source link

Trouble in installing the notebook extensions #793

Open metabolinguistics opened 7 years ago

metabolinguistics commented 7 years ago

Hi, members. I have trouble in installing Jupyter notebook extensions, though I think I follow the formal method described in readme.md.

First, my environment is

 $ pip install pyyaml
 $ pip install https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tarball/master
 $ jupyter contrib-nbextension install --user

%% Although the official site offers this command without a hyphen between contrib and nbextension, there is a web page that tells me that is a mistake. Therefore, I inserted the hyphen.

$ pip install jupyter_nbextensions_configurator %% This command is listed in the "Jupyter Nbextensions Configurator" page.

$ jupyter nbextensions_configurator enable --user

With these commands, I have got just two extensions when I access "http://localhost:8888/nbextensions/": "Nbextensions dashboard tab" and "Nbextensions edit menu item."

According to the explanation in git hub, it seems that if we introduce jupyter_nbextensions_configurator, then every notebook extension can be selected from "http://localhost:8888/nbextensions/". However, I have got just two extensions above.

What I would like to use is drag-and-drop. So, I wrote the following command.

$ jupyter nbextension enable dragdrop

After restarting the notebook, I found out dragdrop in "http://localhost:8888/nbextensions".

However, it did not work, probably because of a json problem. I do not know well json.

I do not understand when and where I got wrong and how I can install the notebook extension correctly.

I have copied the terminal in the following text file. Could you check the text file and give me a comment?

Thank you.

jcb91 commented 7 years ago

So, it seems from your text file/shell output that althought your ran the install command, it didn't actually complete successfully, as something threw an exception:

GennoMacBook:~ gen$ jupyter contrib-nbextension install --user
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/bin/jupyter-contrib-nbextension", 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 3095, in <module>
    @_call_aside
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3081, in _call_aside
    f(*args, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3108, 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 660, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 673, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 851, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (six 1.4.1 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python), Requirement.parse('six>=1.9.0'), set(['prompt-toolkit']))

From the traceback, it seems that the module prompt-toolkit requires six version 1.9.0 or greater (see jonathanslenders/python-prompt-toolkit:setup.py#L34 for confirmation of this requirement), but that for some reason, you only have version 1.4.1 installed. This is presumably down to something somewhere not having specified a dependency properly, but it can't be this repo directly, as we don't directly depend on six. Anyway, to fix this, you should presumably

pip install --upgrade six

As a point of interest, with regard to

%% Although the official site offers this command without a hyphen between contrib and nbextension, there is a web page that tells me that is a mistake. Therefore, I inserted the hyphen.

It should work with either variant, thanks to the way jupyter looks for subcommands. I think a few people have had problems though when their base jupyter script has a non-default name (e.g. with MacPorts), which may be the source of that recommendation.

You also appear to be using the OSX system python (/System/Library/Frameworks/Python.framework/Versions/2.7) for your notebook environment, so I'd recommend using a different one, in order to be less likely to break something important while messing with things like notebook. My personal recommendation would be for conda, but equally good would be e.g. homebrew or perhaps MacPorts.

metabolinguistics commented 7 years ago

Thank you for your comment, Josh Barnes.

I understand that the problem is caused by the version of pip.

Now, I am recovering my mac from the time machine.

After the recovery, I will try the method you told me.

In connection with this issue, I am wondering which command is better for the first install.

I mean, the official site offers two commands for pip users:

pip install jupyter_contrib_nbextensions

pip install https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tarball/master

Which command do I use for install the jupyter notebook extensions?

Are the two commands essentially the same? Or do they have a different meaning?

As for the notebook environment, it is the problem of the size of my storage.

Anaconda seems to be a very "heavy" program. Therefore I do not have enough room to store the anaconda.

When I fix this problem, let you know in this issue.

Thank you.

jcb91 commented 7 years ago

I understand that the problem is caused by the version of pip.

Well, the problem with the install command is caused by the version of the six package. Do you mean to say that your not having the correct version of six was caused by the version of pip which you're using?

Are the two commands essentially the same? Or do they have a different meaning?

They are pretty much the same, the only difference is that the shorter command will install the version of the package available from pypi, while the longer command (the one with https://github...) will install directly from the master branch of the github repository, which will sometimes be slightly more up-to-date than the pypi release. Does that make sense?

Anaconda seems to be a very "heavy" program.

The full anaconda, yes. I'm on a relatively small SSD, so I get by with the lightweight miniconda plus explicitly adding whichever packages I need (including notebook and its dependencies), rather than installing the whole anaconda environment. But sure, if you've got reasons to be using the system Python, you can, by all means :)

jcb91 commented 7 years ago

@metabolinguistics did you manage to resolve this ok in the end?