3

How do I create a C Notebook in Anaconda Jupyter?

When I ran the following commands. It does not seem to load the install_c_kernel python file.

  1. pip install jupyter-c-kernel
  2. install_c_kernel
  3. jupyter-notebook

1 Answers1

4

What I did to make it work was:

  1. Enter Commands in Anaconda Powershell Command Prompt
pip install jupyter-c-kernel
  1. replace codes in kernel.py:
#subprocess.call(['gcc', filepath, '-std=c11', '-rdynamic', '-ldl', '-o', self.master_path])
subprocess.call(['gcc', filepath, '-std=c11', '-o', self.master_path])
...
#cflags = ['-std=c11', '-fPIC', '-shared', '-rdynamic'] + cflags
cflags = ['-std=c11', '-shared'] + cflags
...
#args = ['gcc', source_filename] + cflags + ['-o', binary_filename] + ldflags
args = ['gcc', source_filename] + cflags + ['-o', binary_filename]
  1. copy \jupyter_c_kernel directory:
..\anaconda3\envs\py39-ijava\Lib\site-packages\jupyter_c_kernel

to:

..\anaconda3\Lib\site-packages\jupyter_c_kernel
  1. run command install_c_kernel:
..\anaconda3\Lib\site-packages\jupyter_c_kernel\install_c_kernel
  1. Install gcc compiler:

    • download mingw32 -> select mingw32-base and mingw32-gcc-g++ -> Installation -> Apply Changes-> Installation -> Quit
  2. Set Environment:

    • start -> env -> Environment Variables -> Path -> Edit -> Set new Path C:\MinGW\bin

  3. check gcc version:

gcc --version
  1. run
juypter notebook

Please Vote this answer if it helped you!