Closed vemonet closed 5 years ago
Hi. As you correctly guessed, to run the notebook in Jupyter it is first necessary to have the kernel installed into Jupyter, otherwise it won't work. In fact, if I try to run the same docker container as you (jupyter/datascience-notebook:latest
), when I go to the launcher tab in JupyterLab I see the kernels for Python, Julia and R, but obviously not for SPARQL, since it has not been installed yet. If I then try to open the example notebook, it complains that it cannot find a suitable kernel.
The solution is, as you say, to follow the README and install the kernel by doing
pip install sparqlkernel
jupyter sparqlkernel install --user
Since you used a !
prefix, I guess you did that within the notebook, and you were using a Python kernel. So once that was made, the kernel should be available inside the container ... but that notebook was already using the previous (Python) kernel, so it would still not work. At that stage you can switch the kernel in the notebook: go to the upper right where the kernel name is printed (probably Python
), click on it and you should be able to change it to the SPARQL kernel, then it would work,
Another possibility is to install the kernel before opening the notebook, perhaps by using a terminal window in the JupyterLab launcher. The use of docker exec
on the running container as you propose should also work -- but again it will take effect only on the notebooks you open after installation.
Hi! Thanks a lot, I am not really experimented with Jupyter Notebooks, this was my mistake
go to the upper right where the kernel name is printed It was what I missed, it is now working with Van Gogh example, thanks a lot!
To make this working out of the box it depends how we would approach the issue
Thanks a lot for the helps and the kernel! It is ideal for SPARQL querying
The Dockerfile approach is straightforward:
FROM jupyter/datascience-notebook
RUN pip install sparqlkernel && jupyter sparqlkernel install --user
If you use that Dockerfile to build a new image by e.g.
docker build . -t jupyter/datascience-notebook-sparql
then you can just launch that new image instead of the original one, and the kernel will be available from the start.
Hi,
I am trying to run the examples in a Jupyter Notebook (itself running in Docker): https://github.com/paulovn/sparql-kernel/blob/master/examples/sparql-vanGogh.ipynb Running Jupyter using Docker:
The example notebook is not working out of the box (no pip install, no import, so I guess you did them beside of the notebook)
So I tried to run the following commands from the README in the Notebook:
This block is executing fine, with the pip install working great, and the
jupyter sparqlkernel install
returning:But when I run the first block I get the following error:
UsageError: Line magic function
%endpointnot found.
So I guess that the sparql kernel is not properly installed/imported in Jupyter
I also tried to run those commands through
docker exec my_container jupyter sparqlkernel install --user
but, still not recognizing the magic linesDo you know how to have this sparqlkernel running? Or is it any comprehensive example of a running one?