jupyter/qtconsole

Segmentation Fault on `jupyter qtconsole`

SoundsSerious opened this issue · 10 comments

Hi I'm a long time user of qtconsole but this problem is stumping me.

My environment which was working previously suddenly began experiencing segmentation faults on python 3.9.12 Window system linux Ubuntu20.04.

I removed anaconda and tried again but the issue persisted each time with a fresh conda install qtconsole. I installed Ubuntu 22.04 , verified x11 (via xeyes) and finally got qtconsole working with the default python 3.11. I made a new conda environment and tried again with python 3.9.12 and got the following error as before.

jupyter qtconsole --debug
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-olly'
[JupyterQtConsoleApp] Searching ['/home/olly/miniconda3/envs/nept/etc/jupyter', '/home/olly/.jupyter', '/home/olly/.local/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[JupyterQtConsoleApp] Looking for jupyter_config in /etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /usr/local/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /home/olly/.local/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /home/olly/.jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /home/olly/miniconda3/envs/nept/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /usr/local/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /home/olly/.local/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /home/olly/.jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /home/olly/miniconda3/envs/nept/etc/jupyter
[JupyterQtConsoleApp] Connection File not found: /home/olly/.local/share/jupyter/runtime/kernel-23913.json
[JupyterQtConsoleApp] Instantiating kernel 'Python 3 (ipykernel)' with kernel provisioner: local-provisioner
[JupyterQtConsoleApp] Starting kernel: ['/home/olly/miniconda3/envs/nept/bin/python', '-m', 'ipykernel_launcher', '-f', '/home/olly/.local/share/jupyter/runtime/kernel-23913.json']
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:36953
[JupyterQtConsoleApp] connecting shell channel to tcp://127.0.0.1:41393
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:41393
[JupyterQtConsoleApp] connecting iopub channel to tcp://127.0.0.1:53547
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:53547
[JupyterQtConsoleApp] connecting stdin channel to tcp://127.0.0.1:33207
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:33207
[JupyterQtConsoleApp] connecting heartbeat channel to tcp://127.0.0.1:36177
[JupyterQtConsoleApp] connecting control channel to tcp://127.0.0.1:36953
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:36953
Segmentation fault

The working qtconsole startup looks like this

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-olly'
[JupyterQtConsoleApp] Searching ['/home/olly/miniconda3/envs/nept11/etc/jupyter', '/home/olly/.jupyter', '/home/olly/.local/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[JupyterQtConsoleApp] Looking for jupyter_config in /etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /usr/local/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /home/olly/.local/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /home/olly/.jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /home/olly/miniconda3/envs/nept11/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /usr/local/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /home/olly/.local/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /home/olly/.jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /home/olly/miniconda3/envs/nept11/etc/jupyter
[JupyterQtConsoleApp] Connection File not found: /home/olly/.local/share/jupyter/runtime/kernel-25136.json
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[JupyterQtConsoleApp] Instantiating kernel 'Python 3 (ipykernel)' with kernel provisioner: local-provisioner
[JupyterQtConsoleApp] Starting kernel: ['/home/olly/miniconda3/envs/nept11/bin/python', '-m', 'ipykernel_launcher', '-f', '/home/olly/.local/share/jupyter/runtime/kernel-25136.json']
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:36141
[JupyterQtConsoleApp] connecting shell channel to tcp://127.0.0.1:40899
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:40899
[JupyterQtConsoleApp] connecting iopub channel to tcp://127.0.0.1:53845
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:53845
[JupyterQtConsoleApp] connecting stdin channel to tcp://127.0.0.1:55035
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:55035
[JupyterQtConsoleApp] connecting heartbeat channel to tcp://127.0.0.1:37173
[JupyterQtConsoleApp] connecting control channel to tcp://127.0.0.1:36141
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:36141
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[JupyterQtConsoleApp] Received history reply with 0 entries

Verifying qtconsole also works on 3.10.13

I believe I found the root cause which is related to https://github.com/matplotlib/basemap

using conda install -c conda-forge basemap basemap-data basemap-data-hires lxml the following message is displayed about changing packages, presumably one of these conflicts with qtconsole as this can reliably replicate the error.

The following packages will be REMOVED:

  libgomp-11.2.0-h1234567_1

The following packages will be UPDATED:

  libgcc-ng          pkgs/main::libgcc-ng-11.2.0-h1234567_1 --> conda-forge::libgcc-ng-13.2.0-h807b86a_2
  libstdcxx-ng       pkgs/main::libstdcxx-ng-11.2.0-h12345~ --> conda-forge::libstdcxx-ng-13.2.0-h7e041cc_2
  openssl              pkgs/main::openssl-3.0.11-h7f8727e_2 --> conda-forge::openssl-3.1.3-hd590300_0

The following packages will be SUPERSEDED by a higher-priority channel:

  _libgcc_mutex           pkgs/main::_libgcc_mutex-0.1-main --> conda-forge::_libgcc_mutex-0.1-conda_forge
  _openmp_mutex          pkgs/main::_openmp_mutex-5.1-1_gnu --> conda-forge::_openmp_mutex-4.5-2_kmp_llvm
  ca-certificates    pkgs/main::ca-certificates-2023.08.22~ --> conda-forge::ca-certificates-2023.7.22-hbcca054_0
  certifi            pkgs/main/linux-64::certifi-2023.7.22~ --> conda-forge/noarch::certifi-2023.7.22-pyhd8ed1ab_0

I have temporarily found a workaround by using the conda install --no-deps option to not include additional dependencies, which potentially can cause new problems.

@SoundsSerious, the problem is you're mixing packages from conda-forge with those from the defaults channel. To avoid that, I'd suggest you to reininstall Anaconda (if you're using its base environment) and then create a new one only with conda-forge packages.

@ccordoba12 I've closed this issue as I think its probably closer to basemap maintenance which is a recurring issue. I've tried this but the problem persits, I had hoped that conda would identify the correct underlying c-libs but it looks like this might not work as intened.

Steps to reproduce the error

conda env remove nept -y
conda create -n nept python=3.9.12 -y
conda activate nept
conda install -c conda-forge basemap qtconsole -y
jupyter qtconsole

The problem is in this command, I think:

conda create -n nept python=3.9.12 -y

It needs to be

conda create -n nept -c conda-forge python=3.9.12 -y

because you need to install everything from conda-forge.

Awesome, thanks, I'll try this!

@ccordoba12 I tried this an unfortunately It didn't work. Same problem as before

Ok, sorry to hear that. Then it's nice that you found a workaround for this problem.