jupyter-xeus / xeus-cling

Jupyter kernel for the C++ programming language
BSD 3-Clause "New" or "Revised" License
3.02k stars 292 forks source link

Cannot open any C++ kernel on Docker #462

Open dibalikpohon opened 1 year ago

dibalikpohon commented 1 year ago

I pulled a docker image jupyter/minimal-notebook and installed xeus-cling from a pre-installed venv base on that image.

I opened the JupyterLab. I found C++ are listed on the Notebook list. Unfortunately, I can't run any kernels there. I opened the logs and it shows some errors that I don't understand.

2022-11-20 21:32:19 [I 2022-11-20 14:32:19.486 ServerApp] Creating new notebook in 
2022-11-20 21:32:19 [I 2022-11-20 14:32:19.995 ServerApp] Kernel started: e3a000c1-ff2f-4237-9520-2faf6e0c32af
2022-11-20 21:32:20 In file included from input_line_1:1:
2022-11-20 21:32:20 In file included from /opt/conda/bin/../lib/gcc/../../x86_64-conda-linux-gnu/include/c++/10.4.0/new:40:
2022-11-20 21:32:20 In file included from /opt/conda/bin/../lib/gcc/../../x86_64-conda-linux-gnu/include/c++/10.4.0/x86_64-conda-linux-gnu/bits/c++config.h:522:
2022-11-20 21:32:20 /opt/conda/bin/../lib/gcc/../../x86_64-conda-linux-gnu/include/c++/10.4.0/x86_64-conda-linux-gnu/bits/os_defines.h:39:10: fatal error: 'features.h' file not found
2022-11-20 21:32:20 #include <features.h>
2022-11-20 21:32:20          ^~~~~~~~~~~~
2022-11-20 21:32:20 Replaced symbol atexit cannot be found in JIT!
2022-11-20 21:32:20 Replaced symbol at_quick_exit cannot be found in JIT!
2022-11-20 21:32:20 Error: signal 11:
2022-11-20 21:32:20 /opt/conda/bin/xcpp(_Z7handleri+0x2d)[0x560f6927d50d]
2022-11-20 21:32:20 /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f51fd147520]
2022-11-20 21:32:20 /opt/conda/bin/../lib/libxeus-cling.so.0(_ZN5clang4Sema22MarkFunctionReferencedENS_14SourceLocationEPNS_12FunctionDeclEb+0x30)[0x7f52036b3b40]
2022-11-20 21:32:22 [I 2022-11-20 14:32:22.981 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (1/5), new random ports
2022-11-20 21:32:23 In file included from input_line_1:1:
2022-11-20 21:32:23 In file included from /opt/conda/bin/../lib/gcc/../../x86_64-conda-linux-gnu/include/c++/10.4.0/new:40:
2022-11-20 21:32:23 In file included from /opt/conda/bin/../lib/gcc/../../x86_64-conda-linux-gnu/include/c++/10.4.0/x86_64-conda-linux-gnu/bits/c++config.h:522:
2022-11-20 21:32:23 /opt/conda/bin/../lib/gcc/../../x86_64-conda-linux-gnu/include/c++/10.4.0/x86_64-conda-linux-gnu/bits/os_defines.h:39:10: fatal error: 'features.h' file not found
2022-11-20 21:32:23 #include <features.h>
2022-11-20 21:32:23          ^~~~~~~~~~~~
2022-11-20 21:32:23 Replaced symbol atexit cannot be found in JIT!
2022-11-20 21:32:23 Replaced symbol at_quick_exit cannot be found in JIT!
2022-11-20 21:32:23 Error: signal 11:
2022-11-20 21:32:23 /opt/conda/bin/xcpp(_Z7handleri+0x2d)[0x55c47950050d]
2022-11-20 21:32:23 /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f9607185520]
2022-11-20 21:32:23 /opt/conda/bin/../lib/libxeus-cling.so.0(_ZN5clang4Sema22MarkFunctionReferencedENS_14SourceLocationEPNS_12FunctionDeclEb+0x30)[0x7f960d6f1b40]
2022-11-20 21:32:26 [I 2022-11-20 14:32:26.001 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (2/5), new random ports

*it keeps repeating*...

2022-11-20 21:32:35 [I 2022-11-20 14:32:35.054 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (5/5), new random ports
2022-11-20 21:32:35 In file included from input_line_1:1:
2022-11-20 21:32:35 In file included from /opt/conda/bin/../lib/gcc/../../x86_64-conda-linux-gnu/include/c++/10.4.0/new:40:
2022-11-20 21:32:35 In file included from /opt/conda/bin/../lib/gcc/../../x86_64-conda-linux-gnu/include/c++/10.4.0/x86_64-conda-linux-gnu/bits/c++config.h:522:
2022-11-20 21:32:35 /opt/conda/bin/../lib/gcc/../../x86_64-conda-linux-gnu/include/c++/10.4.0/x86_64-conda-linux-gnu/bits/os_defines.h:39:10: fatal error: 'features.h' file not found
2022-11-20 21:32:35 #include <features.h>
2022-11-20 21:32:35          ^~~~~~~~~~~~
2022-11-20 21:32:35 Replaced symbol atexit cannot be found in JIT!
2022-11-20 21:32:35 Replaced symbol at_quick_exit cannot be found in JIT!
2022-11-20 21:32:35 Error: signal 11:
2022-11-20 21:32:35 /opt/conda/bin/xcpp(_Z7handleri+0x2d)[0x55e5ed26c50d]
2022-11-20 21:32:35 /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7fcd00363520]
2022-11-20 21:32:35 /opt/conda/bin/../lib/libxeus-cling.so.0(_ZN5clang4Sema22MarkFunctionReferencedENS_14SourceLocationEPNS_12FunctionDeclEb+0x30)[0x7fcd068cfb40]
2022-11-20 21:32:38 [W 2022-11-20 14:32:38.074 ServerApp] AsyncIOLoopKernelRestarter: restart failed
2022-11-20 21:32:38 [W 2022-11-20 14:32:38.074 ServerApp] Kernel e3a000c1-ff2f-4237-9520-2faf6e0c32af died, removing from map.

Running Python kernel is fine.

I was expecting any C++ kernel on xeus-cling worked fine. But I found it didn't.

These packages was being installed when executing mamba install xeus-cling -c conda-forge

Package                       Version  Build                  Channel                   Size
────────────────────────────────────────────────────────────────────────────────────────────────
  Install:
────────────────────────────────────────────────────────────────────────────────────────────────

  + _libgcc_mutex                   0.1  conda_forge            conda-forge/linux-64       3kB
  + _openmp_mutex                   4.5  2_gnu                  conda-forge/linux-64      24kB
  + binutils_impl_linux-64         2.39  h6ceecb4_0             conda-forge/linux-64      13MB
  + binutils_linux-64              2.39  h5fc0e48_11            conda-forge/linux-64      25kB
  + ca-certificates           2022.9.24  ha878542_0             conda-forge/linux-64     154kB
  + clang                         9.0.1  cling_v0.9_hf01e6bc_5  conda-forge/linux-64     211kB
  + clang-9                       9.0.1  cling_v0.9_h6699504_5  conda-forge/linux-64     642kB
  + clang-tools                   9.0.1  cling_v0.9_h1e27157_5  conda-forge/linux-64      85MB
  + clangdev                      9.0.1  cling_v0.9_h1e27157_5  conda-forge/linux-64      46MB
  + clangxx                       9.0.1  cling_v0.9_he14baed_5  conda-forge/linux-64     211kB
  + cling                           0.9  he0ac6c6_1             conda-forge/linux-64      26MB
  + cppzmq                        4.8.1  hf7cf922_0             conda-forge/linux-64      26kB
  + cxxopts                       2.1.2  h4bd325d_1001          conda-forge/linux-64      15kB
  + gcc_impl_linux-64            10.4.0  h5231bdf_19            conda-forge/linux-64      49MB
  + gcc_linux-64                 10.4.0  h9215b83_11            conda-forge/linux-64      25kB
  + gxx_impl_linux-64            10.4.0  h5231bdf_19            conda-forge/linux-64      12MB
  + gxx_linux-64                 10.4.0  h6e491c6_11            conda-forge/linux-64      25kB
  + kernel-headers_linux-64      2.6.32  he073ed8_15            conda-forge/noarch       724kB
  + ld_impl_linux-64               2.39  hc81fddc_0             conda-forge/linux-64     778kB
  + libclang                      9.0.1  cling_v0.9_h1e27157_5  conda-forge/linux-64      24MB
  + libclang-cpp                  9.0.1  cling_v0.9_h6699504_5  conda-forge/linux-64      14MB
  + libclang-cpp9                 9.0.1  cling_v0.9_h6699504_5  conda-forge/linux-64      14MB
  + libgcc-devel_linux-64        10.4.0  hd38fd1e_19            conda-forge/linux-64       4MB
  + libgcc-ng                    12.2.0  h65d4601_19            conda-forge/linux-64     954kB
  + libgomp                      12.2.0  h65d4601_19            conda-forge/linux-64     466kB
  + libllvm9                      9.0.1  default_hc23dcda_7     conda-forge/linux-64      27MB
  + libsanitizer                 10.4.0  h5246dfb_19            conda-forge/linux-64       6MB
  + libsodium                    1.0.18  h36c2ea0_1             conda-forge/linux-64     375kB
  + libstdcxx-devel_linux-64     10.4.0  hd38fd1e_19            conda-forge/linux-64      10MB
  + libstdcxx-ng                 12.2.0  h46fd767_19            conda-forge/linux-64       4MB
  + libuuid                      2.32.1  h7f98852_1000          conda-forge/linux-64      28kB
  + libzlib                      1.2.13  h166bdaf_4             conda-forge/linux-64      66kB
  + llvm-tools                    9.0.1  cling_v0.9_h2b820e9_7  conda-forge/linux-64       5MB
  + llvmdev                       9.0.1  cling_v0.9_h2b820e9_7  conda-forge/linux-64      40MB
  + nlohmann_json                 3.9.1  h9c3ff4c_1             conda-forge/linux-64     125kB
  + openssl                       3.0.7  h166bdaf_0             conda-forge/linux-64       3MB
  + pugixml                      1.11.4  h9c3ff4c_0             conda-forge/linux-64     128kB
  + sysroot_linux-64               2.12  he073ed8_15            conda-forge/noarch        33MB
  + xeus                          3.0.2  h52ebe9d_0             conda-forge/linux-64     531kB
  + xeus-cling                   0.14.0  he0ac6c6_3             conda-forge/linux-64      11MB
  + xeus-zmq                      1.0.1  h70bab47_0             conda-forge/linux-64     536kB
  + xtl                           0.7.4  h4bd325d_0             conda-forge/linux-64      98kB
  + zeromq                        4.3.4  h9c3ff4c_1             conda-forge/linux-64     360kB

  Summary:

  Install: 43 packages

  Total download: 434MB

────────────────────────────────────────────────────────────────────────────────────────────────
adah1972 commented 1 year ago

It seems the key might be replacing Miniconda with Miniforge. I failed with Miniconda on Ubuntu 20.04, but using Miniforge worked.

abrarfahim19 commented 1 year ago

I have faced a similar issue. I have tried with Conda.

conda install -c conda-forge xeus-cling

Did you manage to solve it?

adah1972 commented 1 year ago

@abrarfahim19 Do not use Conda. Using Miniforge solved the problem for me on Ubuntu.

abrarfahim19 commented 1 year ago

@adah1972 thanks. I tried miniforge and it worked.

ghost commented 1 year ago

Miniforge does not work for me. Which base image do you use? I tried 3 different ones without success

/opt/conda/bin/../lib/gcc/../../x86_64-conda-linux-gnu/include/c++/12.2.0/x86_64-conda-linux-gnu/bits/os_defines.h:39:10: fatal error: 'features.h
Possible C++ standard library mismatch, compiled with __GLIBCXX__
ghost commented 1 year ago

@abrarfahim19 Did you just replace conda install -c conda-forge xeus-cling with mamba install -c conda-forge xeus-cling? Did you use a clean environment?

abrarfahim19 commented 1 year ago

@kllp yes. It worked for me. And yes, it was a clean environment.