xeus-cling
xeus-cling copied to clipboard
C++ 17 Kernel doesn't work with Jupyter Console
Install xeus-cling in a clean conda enviroment xcpp11 and xcpp14 works fine with jupyter console, however xcpp17 doesn't work. To reproduce the issue
conda create -n cling
conda install jupyter
conda install -c conda-forge xeus-cling
Then run jupyter console with xeus-cling kernels
jupyter console --kernel xcpp11
and
jupyter console --kernel xcpp14
work as expected. However
jupyter console --kernel xcpp17
gives error information
Traceback (most recent call last):
File "/home/swang/intelpython3/envs/cling/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 432, in init_kernel_info
reply = self.client.get_shell_msg(timeout=1)
File "/home/swang/intelpython3/envs/cling/lib/python3.9/site-packages/jupyter_client/client.py", line 78, in get_shell_msg
return self.shell_channel.get_msg(*args, **kwargs)
File "/home/swang/intelpython3/envs/cling/lib/python3.9/site-packages/jupyter_client/blocking/channels.py", line 54, in get_msg
raise Empty
_queue.Empty
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/swang/intelpython3/envs/cling/bin/jupyter-console", line 10, in <module>
sys.exit(main())
File "/home/swang/intelpython3/envs/cling/lib/python3.9/site-packages/jupyter_core/application.py", line 254, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/swang/intelpython3/envs/cling/lib/python3.9/site-packages/traitlets/config/application.py", line 844, in launch_instance
app.initialize(argv)
File "/home/swang/intelpython3/envs/cling/lib/python3.9/site-packages/traitlets/config/application.py", line 87, in inner
return method(app, *args, **kwargs)
File "/home/swang/intelpython3/envs/cling/lib/python3.9/site-packages/jupyter_console/app.py", line 136, in initialize
self.init_shell()
File "/home/swang/intelpython3/envs/cling/lib/python3.9/site-packages/jupyter_console/app.py", line 106, in init_shell
self.shell = ZMQTerminalInteractiveShell.instance(parent=self,
File "/home/swang/intelpython3/envs/cling/lib/python3.9/site-packages/traitlets/config/configurable.py", line 537, in instance
inst = cls(*args, **kwargs)
File "/home/swang/intelpython3/envs/cling/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 350, in __init__
self.init_kernel_info()
File "/home/swang/intelpython3/envs/cling/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 435, in init_kernel_info
raise RuntimeError("Kernel didn't respond to kernel_info_request") from e
RuntimeError: Kernel didn't respond to kernel_info_request
I wonder if there's any way to fix this?
Me too! C++17 fails on Mac Catalina after clean install of JupyterLab and Xeus-cling, when opening a notebook that was developed under xeus-cling C++17 and worked perfectly before. The error messages are different from above:
[I 2021-09-02 13:26:09.482 ServerApp] Kernel started: 8860c126-6a11-4d15-a379-8e82353c58ab
In file included from input_line_1:1:
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:235:33: error: too many arguments to function call, expected 1, have 2
return __builtin_operator_new(__args...);
~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:256:12: note: in instantiation of function template specialization 'std::__1::__libcpp_operator_new<unsigned long, std::align_val_t>' requested
here
return __libcpp_operator_new(__size, __align_val);
^
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:245:29: error: too many arguments to function call, expected 1, have 2
__builtin_operator_delete(__args...);
~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:297:14: note: in instantiation of function template specialization 'std::__1::__libcpp_operator_delete<void *, std::align_val_t>' requested here
return __libcpp_operator_delete(__ptr, __align_val);
^
[I 2021-09-02 13:26:15.484 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (1/5), keep random ports
In file included from input_line_1:1:
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:235:33: error: too many arguments to function call, expected 1, have 2
return __builtin_operator_new(__args...);
~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:256:12: note: in instantiation of function template specialization 'std::__1::__libcpp_operator_new<unsigned long, std::align_val_t>' requested
here
return __libcpp_operator_new(__size, __align_val);
^
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:245:29: error: too many arguments to function call, expected 1, have 2
__builtin_operator_delete(__args...);
~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:297:14: note: in instantiation of function template specialization 'std::__1::__libcpp_operator_delete<void *, std::align_val_t>' requested here
return __libcpp_operator_delete(__ptr, __align_val);
^
[I 2021-09-02 13:26:18.490 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (2/5), keep random ports
In file included from input_line_1:1:
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:235:33: error: too many arguments to function call, expected 1, have 2
return __builtin_operator_new(__args...);
~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:256:12: note: in instantiation of function template specialization 'std::__1::__libcpp_operator_new<unsigned long, std::align_val_t>' requested
here
return __libcpp_operator_new(__size, __align_val);
^
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:245:29: error: too many arguments to function call, expected 1, have 2
__builtin_operator_delete(__args...);
~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:297:14: note: in instantiation of function template specialization 'std::__1::__libcpp_operator_delete<void *, std::align_val_t>' requested here
return __libcpp_operator_delete(__ptr, __align_val);
^
/Users/mark/opt/miniconda3/envs/XEUS/lib/python3.9/json/encoder.py:257: UserWarning: date_default is deprecated since jupyter_client 7.0.0. Use jupyter_client.jsonutil.json_default.
return _iterencode(o, 0)
[I 2021-09-02 13:26:21.499 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (3/5), keep random ports
In file included from input_line_1:1:
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:235:33: error: too many arguments to function call, expected 1, have 2
return __builtin_operator_new(__args...);
~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:256:12: note: in instantiation of function template specialization 'std::__1::__libcpp_operator_new<unsigned long, std::align_val_t>' requested
here
return __libcpp_operator_new(__size, __align_val);
^
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:245:29: error: too many arguments to function call, expected 1, have 2
__builtin_operator_delete(__args...);
~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~
/Users/mark/opt/miniconda3/envs/XEUS/include/c++/v1/new:297:14: note: in instantiation of function template specialization 'std::__1::__libcpp_operator_delete<void *, std::align_val_t>' requested here
return __libcpp_operator_delete(__ptr, __align_val);
I installed xeus-cling as described by @Waerden001 above under Ubuntu Linux 20.4. I am facing the same issues except that
jupyter console --kernel xcpp17
just hangs forever. No error messages.
I encountered the same problem on Manjaro Linux. Solved by installing older version of xeus-cling:
conda install xeus-cling==0.9.0 -c conda-forge
This version works with C++17 fine.
In my case the console does start, but fails as follows:
dimitry@laptop:~/tmp$ jupyter console --kernel xcpp17
Jupyter console 6.4.0
__ _____ _ _ ___
\ \/ / _ \ | | / __|
> < __/ |_| \__ \
/_/\_\___|\__,_|___/
xeus-cling: a Jupyter Kernel C++ - based on cling
C++17
In [1]: #include <string>/home/dimitry/.local/lib/python3.9/site-packages/jupyter_console/ptshell.py:852: RuntimeWarning: coroutine 'ZMQSocketChannel.msg_ready' was never awaited
while self.client.iopub_channel.msg_ready():
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Unhandled exception in event loop:
File "/usr/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/dimitry/.local/lib/python3.9/site-packages/prompt_toolkit/input/vt100.py", line 168, in callback_wrapper
callback()
File "/home/dimitry/.local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 691, in read_from_input
self.key_processor.process_keys()
File "/home/dimitry/.local/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 274, in process_keys
self._process_coroutine.send(key_press)
File "/home/dimitry/.local/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 186, in _process
self._call_handler(matches[-1], key_sequence=buffer[:])
File "/home/dimitry/.local/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_processor.py", line 329, in _call_handler
handler.call(event)
File "/home/dimitry/.local/lib/python3.9/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 102, in call
result = self.handler(event)
File "/home/dimitry/.local/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 475, in _
self.handle_iopub()
File "/home/dimitry/.local/lib/python3.9/site-packages/jupyter_console/ptshell.py", line 854, in handle_iopub
msg_type = sub_msg['header']['msg_type']
Exception 'coroutine' object is not subscriptable
Press ENTER to continue...
NB: I've built a Debian package for xeus-cling, which is accessible here.
The same type of problem occurs here. First, I installed jupyter before installing xeus in my conda environment. Then, I installed xeus in this environment. It is all fine except for c++ 17 Kernel. It just keeps restarting until the fifth time, then it fails. My OS is pop-os 20.04.
same issue with wsl ubuntu + jupyter notebook (on windows installation its fine)
As mentioned above, installing older version of xeus-cling (to 0.9) seems to solve the problem.
@petyrj that's not really a solution, but rather a workaround.
Anyone coming around where this happened the last ~1 month: pin the stdcxx
library.
conda install xeus-cling \
libstdcxx-devel_linux-64==9.4.0 \
libgcc-devel_linux-64==9.4.0 \
-c conda-forge
Symptom was:
Warning in cling::IncrementalParser::CheckABICompatibility():
Possible C++ standard library mismatch, compiled with __GLIBCXX__ '20210601'
Extraction of runtime standard library version was: '20220527'
and the automatically installed version from conda was 9.5.0. C++11 seemed to work, but C++14 and C++17 were broken.
Whew, glad to see I am not the only person dealing with this issue! Has there been any resolution or update?
@mariop64 it seems to be working for me now:

Although, I am not using Conda, but installed .deb packages from this PPA:
https://launchpad.net/~ppa-verse/+archive/ubuntu/xeus-cling
so