Closed mdtdev closed 8 years ago
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
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!
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/
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:
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.
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()
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. :smile: The python2
was prebuilt for Anaconda. Also not a location I expected to see.
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?
I expect gnuplot_kernel
to install in the same location as metakernel_python
. For your case, that should be /usr/local/share/jupyter/kernels/
.
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
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. :+1:
Great. Thanks for the debugging.
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.