cortex-lab / phy

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

Context creation error when launching phy #1122

Open panichem opened 2 years ago

panichem commented 2 years ago

Hi, I'm attempting to launch phy in a dedicated conda environment (python version 3.8) on a Macbook Pro running OS 11.2.3.

When I launch phy from the command line (on the mini dataset used in the 2021 UCL neuropixels course) I observe the following error:

Screen Shot 2021-10-23 at 2 58 08 PM

The phy gui is almost fully functional, except that the text lists in cluster and similarity view are not displayed:

Screen Shot 2021-10-23 at 2 57 29 PM

Any advice on how to resolve this would be appreciated.

jjtukker commented 2 years ago

I have exactly the same issue! On MacOS 11.6, with Python 3.9, pyqt5 5.13 and pyqtwebengine 5.13 (I had compatibility issues before, had to revert to earlier versions of pyqt5 and pyqtwebengine to get this far but now I'm stuck). My GPU is AM Radeon Pro 5500M via PCIe, plus an integrated Intel IHD Graphics 630. According to glxinfo the opengl version is 1.4 but I think this is only relevant for xquartz (but I am not sure how opengl is related to this so I mention it just in case).

Note that for both missing views, the drawing of screenshots works but the bar menu in the top right does not. I would be VERY grateful for any ideas. I've just spent a long time trying to get this to work on my local machine after failing on our (Ubuntu) compute server due to qt-related issues.

(spikesorting) user-adm@BR-M-3016296dzne Kilosort_2020-08-03_140330 % phy template-gui params.py --debug 21:59:58.489 [D] init:68 Start capturing exceptions. 21:59:58.510 [W] model:591 Unreferenced clusters found in templates (generally not a problem) 21:59:58.516 [D] model:607 Loading spike clusters. 21:59:58.523 [W] model:613 Unreferenced clusters found in spike_clusters (generally not a problem) 21:59:58.530 [D] model:680 Loading templates. 21:59:58.558 [D] model:712 Templates are dense. 21:59:58.558 [W] model:655 Skipping spike waveforms that do not exist, they will be extracted on the fly from the raw data as needed. 21:59:58.559 [D] model:718 Loading the whitening matrix. 21:59:58.560 [D] model:725 Loading the inverse of the whitening matrix. 21:59:58.583 [D] model:754 Loading features. 21:59:58.584 [D] model:769 Features are sparse. 21:59:58.585 [D] model:791 Loading template features. 21:59:58.587 [D] model:801 Template features are sparse. 21:59:58.834 [D] context:100 Initialize joblib cache dir at /Users/user-adm/Lab/DATA/ephys/Constance/Kilosort_2020-08-03_140330/.phy. 21:59:58.835 [D] context:101 Reducing the size of the cache if needed. 21:59:58.870 [D] base:102 Add filter high_pass. 21:59:58.871 [D] config:31 Load config file /Users/user-adm/.phy/phy_config.py. 21:59:58.871 [D] plugin:145 Loading 0 plugins. 21:59:58.871 [D] context:126 Load memcache for phy.apps.base._get_mean_waveforms. 21:59:58.872 [D] context:126 Load memcache for phy.apps.base._get_mean_waveforms. 21:59:58.872 [D] context:126 Load memcache for phy.apps.base._get_template_waveforms. 21:59:58.872 [D] context:126 Load memcache for phy.apps.base.get_mean_spike_template_amplitudes. 21:59:58.873 [D] context:126 Load memcache for phy.apps.base.get_template_counts. 21:59:58.873 [D] context:126 Load memcache for phy.apps.base.get_template_for_cluster. 21:59:58.873 [D] context:126 Load memcache for phy.apps.template.gui.get_template_amplitude. 21:59:58.873 [D] context:126 Load memcache for phy.apps.base.get_cluster_amplitude. 21:59:58.874 [D] context:126 Load memcache for phy.apps.base.get_mean_firing_rate. 21:59:58.874 [D] context:126 Load memcache for phy.apps.base.get_best_channel. 21:59:58.874 [D] context:126 Load memcache for phy.apps.template.gui.get_best_channels. 21:59:58.874 [D] context:126 Load memcache for phy.apps.base.get_channel_shank. 21:59:58.875 [D] context:126 Load memcache for phy.apps.base.get_probe_depth. 21:59:58.875 [D] context:126 Load memcache for phy.apps.base.peak_channel_similarity. 21:59:58.876 [D] context:209 The file /Users/user-adm/Lab/DATA/ephys/Constance/Kilosort_2020-08-03_140330/.phy/new_cluster_id.pkl doesn't exist. 21:59:58.882 [D] context:185 Save data to /Users/user-adm/Lab/DATA/ephys/Constance/Kilosort_2020-08-03_140330/.phy/spikes_per_cluster.pkl. 21:59:58.887 [D] gui:463 Creating GUI. 21:59:58.945 [D] state:46 Load /Users/user-adm/.phy/TemplateGUI/state.json for GUIState. 21:59:58.945 [D] state:46 Load /Users/user-adm/Lab/DATA/ephys/Constance/Kilosort_2020-08-03_140330/.phy/state.json for GUIState. 21:59:59.035 [D] gui:718 Add view ClusterView to GUI. 21:59:59.136 [D] gui:718 Add view SimilarityView to GUI. 21:59:59.179 [D] gui:718 Add view WaveformView to GUI. 21:59:59.346 [D] base:337 Set state for WaveformView. 21:59:59.358 [D] gui:718 Add view CorrelogramView to GUI. 21:59:59.361 [D] base:337 Set state for CorrelogramView. 21:59:59.385 [D] gui:718 Add view ISIView to GUI. 21:59:59.388 [D] base:337 Set state for ISIView. 21:59:59.403 [D] gui:718 Add view FeatureView to GUI. 21:59:59.406 [D] base:337 Set state for FeatureView. 21:59:59.430 [D] gui:718 Add view AmplitudeView to GUI. 21:59:59.433 [D] base:337 Set state for AmplitudeView. 21:59:59.458 [D] gui:718 Add view FiringRateView to GUI. 21:59:59.461 [D] base:337 Set state for FiringRateView. 21:59:59.481 [D] gui:718 Add view ProbeView to GUI. 21:59:59.484 [D] base:337 Set state for ProbeView. 21:59:59.502 [D] gui:718 Add view TemplateFeatureView to GUI. 21:59:59.505 [D] base:337 Set state for TemplateFeatureView. 21:59:59.529 [D] gui:718 Add view ClusterScatterView to GUI. 21:59:59.532 [D] base:337 Set state for ClusterScatterView. 21:59:59.533 [D] base:494 Set color scheme to random. 21:59:59.534 [D] base:1623 Adding default color schemes to ClusterScatterView. 21:59:59.607 [D] gui:519 Load the geometry state. [17535:47619:1206/220000.389401:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.389436:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.389699:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.389715:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.390479:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.390497:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.390597:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.390607:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.391067:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.391081:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.391193:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.391210:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.391819:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.391832:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.392002:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.392032:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.392440:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.392457:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.392581:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.392594:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.392919:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.392936:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.393049:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.393060:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.396279:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.396302:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.396494:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.396510:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.397562:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.397580:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.397711:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.397726:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.398485:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.398498:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.398639:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.398651:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.398995:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.399009:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. [17535:47619:1206/220000.403024:ERROR:gl_context_cgl.cc(136)] Error creating context. [17535:47619:1206/220000.403041:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization. 22:00:00.797 [D] supervisor:813 Clusters selected: [101] (239)

CoreSVG has logged an error. Set environment variabe "CORESVG_VERBOSE" to learn more. 22:21:48.362 [D] state:171 Update GUI state for ClusterView 22:21:48.363 [D] state:171 Update GUI state for WaveformView 22:21:48.363 [D] state:171 Update GUI state for CorrelogramView 22:21:48.364 [D] state:171 Update GUI state for ISIView 22:21:48.364 [D] state:171 Update GUI state for FeatureView 22:21:48.364 [D] state:171 Update GUI state for AmplitudeView 22:21:48.364 [D] state:171 Update GUI state for FiringRateView 22:21:48.364 [D] state:171 Update GUI state for ProbeView 22:21:48.364 [D] state:171 Update GUI state for TemplateFeatureView 22:21:48.365 [D] state:171 Update GUI state for ClusterScatterView 22:21:48.365 [D] context:138 Save memcache for phy.apps.base._get_mean_waveforms. 22:21:48.366 [D] context:138 Save memcache for phy.apps.base._get_template_waveforms. 22:21:48.367 [D] context:138 Save memcache for phy.apps.base.get_mean_spike_template_amplitudes. 22:21:48.368 [D] context:138 Save memcache for phy.apps.base.get_template_counts. 22:21:48.369 [D] context:138 Save memcache for phy.apps.base.get_template_for_cluster. 22:21:48.370 [D] context:138 Save memcache for phy.apps.template.gui.get_template_amplitude. 22:21:48.370 [D] context:138 Save memcache for phy.apps.base.get_cluster_amplitude. 22:21:48.370 [D] context:138 Save memcache for phy.apps.base.get_mean_firing_rate. 22:21:48.371 [D] context:138 Save memcache for phy.apps.base.get_best_channel. 22:21:48.371 [D] context:138 Save memcache for phy.apps.template.gui.get_best_channels. 22:21:48.372 [D] context:138 Save memcache for phy.apps.base.get_channel_shank. 22:21:48.372 [D] context:138 Save memcache for phy.apps.base.get_probe_depth. 22:21:48.373 [D] context:138 Save memcache for phy.apps.base.peak_channel_similarity. 22:21:48.373 [D] gui:600 Save the geometry state. 22:21:48.374 [D] state:218 Save global GUI state to /Users/user-adm/.phy/TemplateGUI/state.json. 22:21:48.376 [D] state:232 Save local GUI state to /Users/user-adm/Lab/DATA/ephys/Constance/Kilosort_2020-08-03_140330/.phy/state.json. 22:21:48.383 [D] model:263 Close memmap array features. 22:21:48.384 [D] model:263 Close memmap array sparse_features.data. 22:21:48.384 [D] model:263 Close memmap array sparse_features.cols. 22:21:48.384 [D] model:263 Close memmap array sparse_template_features.data. 22:21:48.384 [D] model:263 Close memmap array sparse_templates.data. 22:21:48.384 [D] model:263 Close memmap array template_features. 22:21:48.384 [D] init:87 Stop capturing exceptions. (spikesorting) user-adm@BR-M-3016296dzne Kilosort_2020-08-03_140330 % (spikesorting) user-adm@BR-M-3016296dzne Kilosort_2020-08-03_140330 % conda list

packages in environment at /Users/user-adm/opt/anaconda3/envs/spikesorting:

#

Name Version Build Channel

appnope 0.1.2 pypi_0 pypi backcall 0.2.0 pypi_0 pypi ca-certificates 2021.10.8 h033912b_0 conda-forge certifi 2021.10.8 py39h6e9494a_1 conda-forge charset-normalizer 2.0.9 pypi_0 pypi click 7.1.2 pypi_0 pypi cloudpickle 2.0.0 pypi_0 pypi colorcet 3.0.0 pypi_0 pypi cycler 0.11.0 pypi_0 pypi cython 3.0.0a9 pypi_0 pypi dask 2021.11.2 pypi_0 pypi debugpy 1.5.1 pypi_0 pypi decorator 5.1.0 pypi_0 pypi entrypoints 0.3 pypi_0 pypi fonttools 4.28.3 pypi_0 pypi fsspec 2021.11.1 pypi_0 pypi ghp-import 2.0.2 pypi_0 pypi h5py 3.6.0 pypi_0 pypi idna 3.3 pypi_0 pypi importlib-metadata 4.8.2 pypi_0 pypi ipykernel 6.6.0 pypi_0 pypi ipython 7.30.1 pypi_0 pypi ipython-genutils 0.2.0 pypi_0 pypi jedi 0.18.1 pypi_0 pypi jinja2 3.0.3 pypi_0 pypi joblib 1.1.0 pypi_0 pypi jupyter-client 7.1.0 pypi_0 pypi jupyter-core 4.9.1 pypi_0 pypi kiwisolver 1.3.2 pypi_0 pypi libcxx 12.0.0 h2f01273_0
libffi 3.3 hb1e8313_2
locket 0.2.1 pypi_0 pypi markdown 3.3.6 pypi_0 pypi markupsafe 2.0.1 pypi_0 pypi matplotlib 3.5.0 pypi_0 pypi matplotlib-inline 0.1.3 pypi_0 pypi mergedeep 1.3.4 pypi_0 pypi mkdocs 1.2.3 pypi_0 pypi mtscomp 1.0.2 pypi_0 pypi ncurses 6.3 hca72f7f_2
nest-asyncio 1.5.4 pypi_0 pypi numpy 1.22.0rc1 pypi_0 pypi openssl 1.1.1l h0d85af4_0 conda-forge packaging 21.3 pypi_0 pypi param 1.12.1a1 pypi_0 pypi parso 0.8.3 pypi_0 pypi partd 1.2.0 pypi_0 pypi pexpect 4.8.0 pypi_0 pypi phy 2.0b5 pypi_0 pypi phylib 2.4.1 pypi_0 pypi pickleshare 0.7.5 pypi_0 pypi pillow 8.4.0 pypi_0 pypi pip 21.3.1 pypi_0 pypi prompt-toolkit 3.0.23 pypi_0 pypi ptyprocess 0.7.0 pypi_0 pypi pyct 0.4.8 pypi_0 pypi pygments 2.10.0 pypi_0 pypi pyopengl 3.1.5 pypi_0 pypi pyparsing 3.0.6 pypi_0 pypi pyqt5 5.13.0 pypi_0 pypi pyqt5-plugins 5.15.4.2.2 pypi_0 pypi pyqt5-qt5 5.15.2 pypi_0 pypi pyqt5-sip 12.9.0 pypi_0 pypi pyqtwebengine 5.12 pypi_0 pypi pyqtwebengine-qt5 5.15.2 pypi_0 pypi python 3.9.7 h88f2d9e_1
python-dateutil 2.8.2 pypi_0 pypi python-dotenv 0.19.2 pypi_0 pypi python_abi 3.9 2_cp39 conda-forge pyyaml 6.0 pypi_0 pypi pyyaml-env-tag 0.1 pypi_0 pypi pyzmq 22.3.0 pypi_0 pypi qt5-applications 5.15.2.2.2 pypi_0 pypi qt5-tools 5.15.2.1.2 pypi_0 pypi qtconsole 5.2.1 pypi_0 pypi qtpy 1.11.3 pypi_0 pypi readline 8.1 h9ed2024_0
requests 2.26.0 pypi_0 pypi scipy 1.7.3 pypi_0 pypi setuptools 58.0.4 py39hecd8cb5_0
setuptools-scm 6.3.2 pypi_0 pypi six 1.16.0 pypi_0 pypi sqlite 3.36.0 hce871da_0
tk 8.6.11 h7bc2e8c_0
tomli 1.2.2 pypi_0 pypi toolz 0.11.2 pypi_0 pypi tornado 6.1 pypi_0 pypi tqdm 4.62.3 pypi_0 pypi traitlets 5.1.1 pypi_0 pypi tzdata 2021e hda174b7_0
urllib3 1.26.7 pypi_0 pypi watchdog 2.1.6 pypi_0 pypi wcwidth 0.2.5 pypi_0 pypi wheel 0.37.0 pyhd3eb1b0_1
xz 5.2.5 h1de35cc_0
zipp 3.6.0 pypi_0 pypi zlib 1.2.11 h1de35cc_3

AliyaAbl commented 2 years ago

Hi, I have the same problem with the two windows being blank. Have you found a solution to this?

panichem commented 2 years ago

Hi AliyaAbi, I didn't - I ended up switching to a windows machine.

danieljdenman commented 2 years ago

hi all - @AliyaAbl i just went through this, including the downgrading pyqt and pyqtwebengine in order to get the data to show up in the views and get around the vertex shader issues

`Error in Vertex shader 246 () -> '' : version '120' is not supported

000 #define _GLUMPY__VERTEX_SHADER__ 001 // --- Snippets code : start --- // 002 // --- Snippets code : end --- //`

and then once that worked having the above conxext errors

[98265:48643:0318/153756.431182:ERROR:gl_context_cgl.cc(136)] Error creating context. [98265:48643:0318/153756.431192:ERROR:gles2_command_buffer_stub.cc(262)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.

i was able to get it working by removing pyqywebengine and pyqt5 and reinstall specific versions:

pip uninstall pyqt5
pip uninstall pyqtwebengine
pip install PyQtWebEngine==5.15 pip install PyQt5==5.15

osx 12.2.1, M1 Mac 2020, python 3.9 Screen Shot 2022-03-18 at 4 34 30 PM