/cling on Jupyter on Windows: Kernel cannot start (via WindowsKernel.com)

## cling on Jupyter on Windows: Kernel cannot start (via WindowsKernel.com)

Background: I am trying to install the cling c++ interpreter here. I am on a Windows and have had Anaconda running well, Jupyter notebook also working fine with the existing Python kernels. The installation process was smooth on the surface but there is Kernel error once I try to open Jupyter notebook on the installed Kernel.

(In the end I would hope to be able to use c++ with Jupyter notebook so if anyone has had any success please could you share your experience. On that, while the xeus-cling is not usable for Windows as many say, this cling appears to be a separate thing)

The installation: Here is what I have done:

2. Extract and place in Program Files folder
3. Following the instruction in here, add C:Program Filescling_2019-11-28_arm64bin to the PATH variable
4. Activate base Anaconda environment
5. cd .../share/cling/Jupyter/kernel
6. pip install -e .
7. jupyter-kernelspec install --user cling-cpp11

Every thing seems to be fine up to here, no warning/error.

The error: Then I load up my Jupyter notebook and try to run the cpp11 kernel, but it is unable to start with a long error traceback, the first/last items of which read:

Traceback (most recent call last):
File "C:ProgramDataAnaconda3libsite-packagestornadoweb.py", line 1699, in _execute
result = await result
File "C:ProgramDataAnaconda3libsite-packagestornadogen.py", line 736, in run
yielded = self.gen.throw(*exc_info)  # type: ignore
File "C:ProgramDataAnaconda3libsite-packagesnotebookservicessessionshandlers.py", line 73, in post
type=mtype))
... (omitted) ...
File "C:ProgramDataAnaconda3libsite-packagesjupyter_clientlauncher.py", line 138, in launch_kernel
proc = Popen(cmd, **kwargs)
File "C:ProgramDataAnaconda3libsubprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "C:ProgramDataAnaconda3libsubprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified


And on the cmd the following:

[E 14:39:14.265 NotebookApp] Failed to run command:
['jupyter-cling-kernel', '-f', 'path\to\jupyter\runtime\kernel-..(random string here)..json', '--std=c++11']


The troubleshooting (1): … appearing to suggest that it is unable to locate a jupyter-cling-kernel. But I do have file named jupyter-cling-kernel in the .../Anaconda3/Scripts folder, and this folder is also in my PATH variable. After opening it, I discovered it is a python file with only a few lines. Looks like it corresponds to the command above.

#!C:ProgramDataAnaconda3python.exe
# EASY-INSTALL-DEV-SCRIPT: 'clingkernel==0.0.2','jupyter-cling-kernel'
__requires__ = 'clingkernel==0.0.2'
__import__('pkg_resources').require('clingkernel==0.0.2')
__file__ = 'C:\Program Files\cling_2019-11-28_arm64\share\cling\Jupyter\kernel\scripts\jupyter-cling-kernel'
with open(__file__) as f:


so then I modified my kernel.json file, adding the absolute python path (so that it knows to run it with python) and the absolute path of the jupyter-cling-kernel. (originally it was just "argv:["jupyter-cling-kernel", "-f", ...)

{
"display_name": "C++11",
"argv": [
**"C:\ProgramData\Anaconda3\python.exe",
"C:\ProgramData\Anaconda3\Scripts\jupyter-cling-kernel",**
"-f",
"{connection_file}",
"--std=c++11"
],
"language": "C++"

}


The troubleshooting (2):… which indeed appears to be the right direction, at least it is running sth but now another error:

Traceback (most recent call last):
File "C:ProgramDataAnaconda3Scriptsjupyter-cling-kernel", line 7, in
File "C:Program Filescling_2019-11-28_arm64shareclingJupyterkernelscrip
tsjupyter-cling-kernel", line 3, in
from clingkernel import main
File "c:program filescling_2019-11-28_arm64shareclingjupyterkernelcling
kernel.py", line 24, in
from fcntl import fcntl, F_GETFL, F_SETFL
ModuleNotFoundError: No module named 'fcntl'


Now with some googling this fcntl appears to be sth not for Windows. So at this point I am wondering have I downloaded the wrong binary or should I modify this clingkernel.py file or do I need to do some compilation myself?

Again, if any of you knows of how to get the c++ run of Jupyter (on windows), appreciate if you could share your experience. Thanks.

This is a syndicated post. Read the original post at Source link .