Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other installation instructions? #1

Closed
mdtdev opened this issue Feb 27, 2016 · 12 comments
Closed

Other installation instructions? #1

mdtdev opened this issue Feb 27, 2016 · 12 comments
Labels

Comments

@mdtdev
Copy link

mdtdev commented Feb 27, 2016

On OSX, using Anaconda as my distribution of python 2, following the instructions does not make gnuplot appear as a notebook type in the Jupyter pull-down menu of notebook types. Did: pip install gnuplot_kernel; no error messages. All requirements met:

metakernel>=0.10.5
notebook>=4.0
IPython>=3.0

pip install went smoothly. Gnuplot is installed and on the path, tests out fine.

Are there any additional instructions on the setup side? Most of the other programs I have paired with Jupyter required starting and setting something internal to them before Jupyter recognized them.

@has2k1
Copy link
Owner

has2k1 commented Feb 27, 2016

I do not have access to OSX, so I am going by the documentation here. Do you have anything in the following directories?

ls -l ~/Library/Jupyter
ls -l ~/Library/Jupyter/kernels

@has2k1 has2k1 added the bug label Feb 27, 2016
@mdtdev
Copy link
Author

mdtdev commented Feb 27, 2016

Well that is interesting. I have the following in those directories:

ls -l ~/Library/Jupyter:

drwxr-xr-x  4 mdt  staff    136 Feb 22 20:51 kernels/
-rw-r--r--  1 mdt  staff  65536 Feb 27 18:18 nbsignatures.db
-rw-------  1 mdt  staff   1386 Nov 18 13:06 notebook_cookie_secret
-rw-------  1 mdt  staff   1386 Nov 18 13:06 notebook_secret
drwx------  8 mdt  staff    272 Feb 27 17:54 runtime/

ls -l ~/Library/Jupyter/kernels:

drwxr-xr-x  4 mdt  staff  136 Feb 22 01:02 ir/
drwxr-xr-x  5 mdt  staff  170 Feb 22 20:51 julia-0.4/

However, I am thinking the problem may be with my use of the Anaconda distribution as it keeps a \share folder in its filespace as well. That is in the folder ls -l ~/anaconda/share/jupyter/ which also contains a kernels subfolder.

$ ls -l ~/anaconda/share/jupyter/kernels/
total 0
drwxr-xr-x  4 mdt  staff  136 Feb 27 00:04 ir/

I am not even remotely an expert on Jupyter notebooks, but I am assuming that Python is native (hence no kernel in either location). The ir and julia-0.4 kernels (in ~/Library/Jupyter/kernels) I installed manually a week or so ago.

The ir kernel in the ~/anaconda/share/jupyter/kernels/ folder was installed by Anaconda's conda package manager as part of a test of Anaconda's support for basic R (See also here.) I did that test today. I just discovered this so I have not yet been able to determine which of the ir kernels is actually used and when.

So this could be due to Anaconda, something OSX-ey, or maybe I messed something up previously.

What should I see in the kernel's directory? Should the gnuplot_kernel show up in that list as a directory there? I installed it using pip as there is currently no support for installs with the conda package manager.

PS: searching my Anaconda install, I found a directory gnuplot_kernel in the folder:

/Users/mdt/anaconda/lib/python2.7/site-packages

and it had the following contents (apparently the Anaconda site-packages directory is at the location above, and that is where Anaconda's pip stuck gnuplot_kernel):

$ ls ~/anaconda/lib/python2.7/site-packages/gnuplot_kernel
__init__.py __main__.pyc    images/     magics/     tests/
__init__.pyc    exceptions.py   kernel.py   replwrap.py
__main__.py exceptions.pyc  kernel.pyc  replwrap.pyc

Hope that clarifies something! Thanks for any help!

@has2k1
Copy link
Owner

has2k1 commented Feb 27, 2016

Can you try out another install (below) and see whether & where it gets installed.

pip install metakernel_python --update

ls -l ~/Library/Jupyter/kernels
ls -l ~/anaconda/share/jupyter/kernels/

@mdtdev
Copy link
Author

mdtdev commented Feb 28, 2016

My pip does not like --update but assuming you wanted --upgrade then:

$ pip install --upgrade  metakernel_python
Collecting metakernel-python
  Downloading metakernel_python-0.11.3.tar.gz
Requirement already up-to-date: metakernel in ./anaconda/lib/python2.7/site-packages (from metakernel-python)
Requirement already up-to-date: jedi in ./anaconda/lib/python2.7/site-packages (from metakernel-python)
Requirement already up-to-date: IPython>=3.0 in ./anaconda/lib/python2.7/site-packages (from metakernel->metakernel-python)
Building wheels for collected packages: metakernel-python
  Running setup.py bdist_wheel for metakernel-python ... done
  Stored in directory: /Users/mdt/Library/Caches/pip/wheels/4b/10/2e/71a8cd506c8a11fb871dffaad0e8acf99cd2920d2a71bf9051
Successfully built metakernel-python
Installing collected packages: metakernel-python
Successfully installed metakernel-python-0.11.3

and:

$ ls -l ~/Library/Jupyter/kernels
total 0
drwxr-xr-x  4 mdt  staff  136 Feb 22 01:02 ir/
drwxr-xr-x  5 mdt  staff  170 Feb 22 20:51 julia-0.4/

and finally:

$ ls -l ~/anaconda/share/jupyter/kernels/
total 0
drwxr-xr-x  4 mdt  staff  136 Feb 27 00:04 ir/

No joy. Also, now there is a metakernel python option in my Jupyter pull-down menu:

jupyter_pull_down

@has2k1
Copy link
Owner

has2k1 commented Feb 28, 2016

There is secret kernels directory somewhere. The Jupyter clients look in the kernels directory(ies) to known which kernels are available and how to start them.

Tryout this potential fix

pip install git+https://github.com/has2k1/gnuplot_kernel.git@osx-install

It installs using the pull request (#2) branch.

@has2k1
Copy link
Owner

has2k1 commented Feb 28, 2016

To help sniff out that other kernels directory, can you try this out.

Open a new notebook and run these commands in a cell

from jupyter_client.kernelspec import KernelSpecManager
ksm = KernelSpecManager()
ksm.find_kernel_specs()

@mdtdev
Copy link
Author

mdtdev commented Feb 28, 2016

Ok, I'll try the second thing first. Upon running:

from jupyter_client.kernelspec import KernelSpecManager
ksm = KernelSpecManager()
ksm.find_kernel_specs()

the result is:

{'ir': '/Users/mdt/Library/Jupyter/kernels/ir',
 'julia-0.4': '/Users/mdt/Library/Jupyter/kernels/julia-0.4',
 'metakernel_python': '/usr/local/share/jupyter/kernels/metakernel_python',
 'python2': '/Users/mdt/anaconda/lib/python2.7/site-packages/ipykernel/resources'}

This is under the previous attempts, before trying the install from github. The ir and julia installs make sense as I did those manually under a previous python setup. The metakernel_python is what happened when I followed your instructions using pip. I am surprised by this as I thought Anaconda's pip would default to installing things in the Anaconda filespace and that programs there would be appropriately directed to prefixes in there. So that one was secret. 😄 The python2 was prebuilt for Anaconda. Also not a location I expected to see.

@mdtdev
Copy link
Author

mdtdev commented Feb 28, 2016

Trying: pip install git+https://github.com/has2k1/gnuplot_kernel.git@osx-install the output is similar to what we got before:

Collecting git+https://github.com/has2k1/gnuplot_kernel.git@osx-install
  Cloning https://github.com/has2k1/gnuplot_kernel.git (to osx-install) to /var/folders/l_/4h1b3fgd4xz99v5xv60lr7kh0000gn/T/pip-x6rqjs-build
  Requirement already satisfied (use --upgrade to upgrade): gnuplot-kernel==0.2.0 from git+https://github.com/has2k1/gnuplot_kernel.git@osx-install in ./lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): metakernel>=0.10.5 in ./lib/python2.7/site-packages (from gnuplot-kernel==0.2.0)
Requirement already satisfied (use --upgrade to upgrade): notebook>=4.0 in ./lib/python2.7/site-packages (from gnuplot-kernel==0.2.0)
Requirement already satisfied (use --upgrade to upgrade): IPython>=3.0 in ./lib/python2.7/site-packages (from metakernel>=0.10.5->gnuplot-kernel==0.2.0)

So basically it seems to say that the requirements are met...

Which of the Jupyter directories is gnuplot_kernel supposed to be in on a more usual Python install?

@has2k1
Copy link
Owner

has2k1 commented Feb 28, 2016

I expect gnuplot_kernel to install in the same location as metakernel_python. For your case, that should be /usr/local/share/jupyter/kernels/.

@has2k1
Copy link
Owner

has2k1 commented Feb 28, 2016

That last install did not do anything. Try forcing a reinstall.

pip uninstall gnuplot_kernel
pip install --upgrade --no-cache-dir git+https://github.com/has2k1/gnuplot_kernel.git@osx-install

@mdtdev
Copy link
Author

mdtdev commented Feb 28, 2016

Haha. I was just trying that. It appears to have worked!

For reference:

from jupyter_client.kernelspec import KernelSpecManager
ksm = KernelSpecManager()
ksm.find_kernel_specs()

now gives:

{'gnuplot': '/usr/local/share/jupyter/kernels/gnuplot',
 'ir': '/Users/mdt/Library/Jupyter/kernels/ir',
 'julia-0.4': '/Users/mdt/Library/Jupyter/kernels/julia-0.4',
 'metakernel_python': '/usr/local/share/jupyter/kernels/metakernel_python',
 'python2': '/Users/mdt/anaconda/lib/python2.7/site-packages/ipykernel/resources'}

which is where you expected things to end up.

Thanks for all the help! I am very excited to have gnuplot in a notebook. 👍

@mdtdev mdtdev closed this as completed Feb 28, 2016
@has2k1
Copy link
Owner

has2k1 commented Feb 28, 2016

Great. Thanks for the debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants