cortex-lab / phy

phy: interactive visualization and manual spike sorting of large-scale ephys data
BSD 3-Clause "New" or "Revised" License
304 stars 155 forks source link

Problem with OpenGL Drivers [Ubuntu 22.04] #1196

Open acumpelik opened 1 year ago

acumpelik commented 1 year ago

Hi everyone,

I am trying to install Phy on Ubuntu 22.04.1 on an AMD/ATI Mobility Radeon HD 5430 graphics card. I haven't been able to launch the GUI due to the following errors:

$ phy template-gui params.py 
16:34:03.753 [W] model:655            Skipping spike waveforms that do not exist, they will be extracted on the fly from the raw data as needed.
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
libGL error: MESA-LOADER: failed to open radeonsi: /usr/lib/dri/radeonsi_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: radeonsi
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
WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed.
QGLXContext: Failed to create dummy contextglxinfo | grep "OpenGL version"
OpenGL version string: 4.6 (Compatibility Profile) Mesa 22.2.5
16:34:04.099 [W] gui:671              Could not create view TemplateFeatureView.
Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile) 
Aborted (core dumped)`

So the main problem seems to be failure with creating an OpenGL context. I tried updating the drivers and the mesa-util package, and that got me to this error:

$ phy template-gui params.py 
18:02:20.322 [W] model:655            Skipping spike waveforms that do not exist, they will be extracted on the fly from the raw data as needed.
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
libGL error: MESA-LOADER: failed to open radeonsi: /usr/lib/dri/radeonsi_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: radeonsi
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
Segmentation fault (core dumped)

I tried updating the drivers by updating the mesa-utils library (which seems to be an open-source OpenGL implementation for Linux). I also managed to locate the packages and tried setting a symbolic link and adding the path the libraries are in to the 'LD_LIBRARY_PATH', none of which worked.

I got a suggestion to force Phy to use software rendering instead of hardware acceleration:

export LIBGL_ALWAYS_SOFTWARE=1

This managed to get rid of one of the driver errors, but the other one is still a problem (and this also didn't fix the broader issue). So this is the current error I'm getting:

$ phy template-gui params.py 
19:06:50.685 [W] model:655            Skipping spike waveforms that do not exist, they will be extracted on the fly from the raw data as needed.
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
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
Segmentation fault (core dumped)

If anyone has any suggestions on what I could try next, it would be greatly appreciated!

mdiamantaki commented 7 months ago

I have the same issue. Installation on Ubuntu 22.04 as currently suggested:

1. Create a new conda environment with the conda dependencies:
   conda create -n phy2 -y cython dask h5py joblib matplotlib numpy pillow pip pyopengl pyqt pyqtwebengine pytest python qtconsole requests responses scikit-learn scipy traitlets
2. Activate the new conda environment with conda activate phy2
3. Install the development version of phy: pip install git+https://github.com/cortex-lab/phy.git

Using the yaml file (as was suggested in issue #1209), it gets stuck at “Solving environment” for hours

After running: phy template-gui params.py, I get the following

17:26:16.025 [W] model:603 Unreferenced clusters found in templates (generally not a problem) 17:26:16.729 [W] model:625 Unreferenced clusters found in spike_clusters (generally not a problem) 17:26:17.958 [W] model:667 Skipping spike waveforms that do not exist, they will be extracted on the fly from the raw data as needed. Segmentation fault (core dumped)

Any tips for making it to work?