Public | Automated Build

Last pushed: a month ago
Short Description
Jupyter notebook server with a C kernel
Full Description

Minimal C kernel for Jupyter

Use with Docker (recommended)

  • docker pull brendanrius/jupyter-c-kernel
  • docker run -p 8888:8888 brendanrius/jupyter-c-kernel
  • Copy the given URL containing the token, and browse to it. For instance:

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
     http://localhost:8888/?token=66750c80bd0788f6ba15760aadz53beb9a9fb4cf8ac15ce8
    

Manual installation

Works only on Linux and OS X. Windows is not supported yet. If you want to use this project on Windows, please use Docker.

  • Make sure you have the following requirements installed:
    • gcc
    • jupyter
    • python 3
    • pip

Step-by-step:

  • pip install jupyter-c-kernel
  • install_c_kernel
  • jupyter-notebook. Enjoy!

Example of notebook

Custom compilation flags

You can use custom compilation flags like so:

Here, the -lm flag is passed so you can use the math library.

Contributing

The docker image installs the kernel in editable mode, meaning that you can
change the code in real-time in Docker. For that, just run the docker box like
that:

git clone https://github.com/brendan-rius/jupyter-c-kernel.git
cd jupyter-c-kernel
docker run -v $(pwd):/jupyter/jupyter_c_kernel/ -p 8888:8888 brendanrius/jupyter-c-kernel

This clones the source, run the kernel, and binds the current folder (the one
you just cloned) to the corresponding folder in Docker.
Now, if you change the source, it will be reflected in http://localhost:8888
instantly. Do not forget to click "restart" the kernel on the page as it does
not auto-restart.

License

MIT

Docker Pull Command
Owner
brendanrius
Source Repository

Comments (1)
siserte
a year ago

Hello,
I've installed your build with docker, and it works.
However, I'm trying to execute cells (C code) and I get this error in the terminal where I have running the docker:

[I 09:56:03.784 NotebookApp] Kernel started: 9890c216-3fba-4d8e-9bfb-08e5c82d68b5
gcc: error: /opt/conda/lib/python3.5/site-packages/jupyter_c_kernel/../resources/master.c: No such file or directory
[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
File "/opt/conda/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 228, in dispatch_shell
handler(stream, idents, msg)
File "/opt/conda/lib/python3.5/site-packages/ipykernel/kernelbase.py", line 391, in execute_request
user_expressions, allow_stdin)
File "/opt/conda/lib/python3.5/site-packages/jupyter_c_kernel/kernel.py", line 135, in do_execute
p = self.create_jupyter_subprocess([self.master_path, binary_file.name])
File "/opt/conda/lib/python3.5/site-packages/jupyter_c_kernel/kernel.py", line 112, in create_jupyter_subprocess
lambda contents: self._write_to_stderr(contents.decode()))
File "/opt/conda/lib/python3.5/site-packages/jupyter_c_kernel/kernel.py", line 25, in init
super().init(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0)
File "/opt/conda/lib/python3.5/subprocess.py", line 950, in init
restore_signals, start_new_session)
File "/opt/conda/lib/python3.5/subprocess.py", line 1544, in _execute_child
raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied

How could I have the correct premissions?
Thank you.