cortex-lab / phy

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

zsh: segmentation fault phy template-gui params.py (Mac M1, MacOS 13.4.1 (22F82)) #1260

Closed dingyun321 closed 4 months ago

dingyun321 commented 6 months ago

Hi,

I am using a M1 Macbook, the current OS version is 13.4.1. I fail to open phy GUI and get this error: "zsh: segmentation fault phy template-gui params.py”.

As I read the previous issue, I get the information by running "conda list":

packages in environment at /opt/anaconda3/envs/phy2:

#

Name Version Build Channel

abseil-cpp 20230802.0 h313beb8_2
appnope 0.1.2 py311hca03da5_1001
arrow-cpp 14.0.2 hc7aafb3_1
asttokens 2.0.5 pyhd3eb1b0_0
aws-c-auth 0.6.19 h80987f9_0
aws-c-cal 0.5.20 h80987f9_0
aws-c-common 0.8.5 h80987f9_0
aws-c-compression 0.2.16 h80987f9_0
aws-c-event-stream 0.2.15 h313beb8_0
aws-c-http 0.6.25 h80987f9_0
aws-c-io 0.13.10 h80987f9_0
aws-c-mqtt 0.7.13 h80987f9_0
aws-c-s3 0.1.51 h80987f9_0
aws-c-sdkutils 0.1.6 h80987f9_0
aws-checksums 0.1.13 h80987f9_0
aws-crt-cpp 0.18.16 h313beb8_0
aws-sdk-cpp 1.10.55 h313beb8_0
blas 1.0 openblas
bokeh 3.3.4 py311hb6e6a13_0
boost-cpp 1.82.0 h48ca7d4_2
bottleneck 1.3.7 py311hb9f6ed7_0
brotli 1.0.9 h1a28f6b_7
brotli-bin 1.0.9 h1a28f6b_7
brotli-python 1.0.9 py311h313beb8_7
bzip2 1.0.8 h80987f9_5
c-ares 1.19.1 h80987f9_0
ca-certificates 2023.12.12 hca03da5_0
certifi 2024.2.2 py311hca03da5_0
charset-normalizer 2.0.4 pyhd3eb1b0_0
click 8.1.7 py311hca03da5_0
cloudpickle 2.2.1 py311hca03da5_0
colorcet 3.1.0 pypi_0 pypi comm 0.2.1 py311hca03da5_0
contourpy 1.2.0 py311h48ca7d4_0
cycler 0.11.0 pyhd3eb1b0_0
cyrus-sasl 2.1.28 h9131b1a_1
cython 3.0.8 py311h80987f9_0
cytoolz 0.12.2 py311h80987f9_0
dask 2023.11.0 py311hca03da5_0
dask-core 2023.11.0 py311hca03da5_0
debugpy 1.6.7 py311h313beb8_0
decorator 5.1.1 pyhd3eb1b0_0
distributed 2023.11.0 py311hca03da5_0
executing 0.8.3 pyhd3eb1b0_0
expat 2.5.0 h313beb8_0
fonttools 4.25.0 pyhd3eb1b0_0
freetype 2.12.1 h1192e45_0
fsspec 2023.10.0 py311hca03da5_0
gettext 0.21.0 h13f89a0_1
gflags 2.2.2 h313beb8_1
ghp-import 2.1.0 pypi_0 pypi glib 2.78.4 h313beb8_0
glib-tools 2.78.4 h313beb8_0
glog 0.5.0 h313beb8_1
grpc-cpp 1.48.2 hc60591f_4
gst-plugins-base 1.14.1 h313beb8_1
gstreamer 1.14.1 h80987f9_1
gtest 1.14.0 h48ca7d4_0
h5py 3.9.0 py311hba6ad2f_0
hdf5 1.12.1 h05c076b_3
heapdict 1.0.1 pyhd3eb1b0_0
icu 73.1 h313beb8_0
idna 3.4 py311hca03da5_0
importlib-metadata 7.0.1 py311hca03da5_0
iniconfig 1.1.1 pyhd3eb1b0_0
ipykernel 6.28.0 py311hca03da5_0
ipython 8.20.0 py311hca03da5_0
jedi 0.18.1 py311hca03da5_1
jinja2 3.1.3 py311hca03da5_0
joblib 1.2.0 py311hca03da5_0
jpeg 9e h80987f9_1
jupyter_client 8.6.0 py311hca03da5_0
jupyter_core 5.5.0 py311hca03da5_0
kiwisolver 1.4.4 py311h313beb8_0
krb5 1.20.1 hf3e1bf2_1
lcms2 2.12 hba8e193_0
lerc 3.0 hc377ac9_0
libboost 1.82.0 h0bc93f9_2
libbrotlicommon 1.0.9 h1a28f6b_7
libbrotlidec 1.0.9 h1a28f6b_7
libbrotlienc 1.0.9 h1a28f6b_7
libclang 14.0.6 default_h1b80db6_1
libclang13 14.0.6 default_h24352ff_1
libcurl 8.5.0 h3e2b118_0
libcxx 14.0.6 h848a8c0_0
libdeflate 1.17 h80987f9_1
libedit 3.1.20230828 h80987f9_0
libev 4.33 h1a28f6b_1
libevent 2.1.12 h02f6b3c_1
libffi 3.4.4 hca03da5_0
libgfortran 5.0.0 11_3_0_hca03da5_28
libgfortran5 11.3.0 h009349e_28
libglib 2.78.4 h0a96307_0
libiconv 1.16 h1a28f6b_2
libllvm14 14.0.6 h7ec7a93_3
libnghttp2 1.57.0 h62f6fdd_0
libopenblas 0.3.21 h269037a_0
libpng 1.6.39 h80987f9_0
libpq 12.17 h02f6b3c_0
libprotobuf 3.20.3 h514c7bf_0
libsodium 1.0.18 h1a28f6b_0
libssh2 1.10.0 h02f6b3c_2
libthrift 0.15.0 h73c2103_2
libtiff 4.5.1 h313beb8_0
libwebp-base 1.3.2 h80987f9_0
libxml2 2.10.4 h0dcf63f_1
llvm-openmp 14.0.6 hc6e5704_0
locket 1.0.0 py311hca03da5_0
lz4 4.3.2 py311h80987f9_0
lz4-c 1.9.4 h313beb8_0
markdown 3.6 pypi_0 pypi markupsafe 2.1.3 py311h80987f9_0
matplotlib 3.8.0 py311hca03da5_0
matplotlib-base 3.8.0 py311h7aedaa7_0
matplotlib-inline 0.1.6 py311hca03da5_0
mergedeep 1.3.4 pypi_0 pypi mkdocs 1.5.3 pypi_0 pypi msgpack-python 1.0.3 py311h48ca7d4_0
mtscomp 1.0.2 pypi_0 pypi munkres 1.1.4 py_0
mysql 5.7.24 ha71a6ea_2
ncurses 6.4 h313beb8_0
nest-asyncio 1.6.0 py311hca03da5_0
numexpr 2.8.7 py311h6dc990b_0
numpy 1.24.3 py311hb57d4eb_0
numpy-base 1.24.3 py311h1d85a46_0
openjpeg 2.3.0 h7a6adac_2
openssl 3.0.13 h1a28f6b_0
orc 1.7.4 hdca1487_1
packaging 23.1 py311hca03da5_0
pandas 2.2.1 py311h7aedaa7_0
parso 0.8.3 pyhd3eb1b0_0
partd 1.4.1 py311hca03da5_0
pathspec 0.12.1 pypi_0 pypi pcre2 10.42 hb066dcc_0
pexpect 4.8.0 pyhd3eb1b0_3
phy 2.0b5 pypi_0 pypi phylib 2.4.3 pypi_0 pypi pillow 10.2.0 py311h80987f9_0
pip 23.3.1 py311hca03da5_0
platformdirs 3.10.0 py311hca03da5_0
pluggy 1.0.0 py311hca03da5_1
ply 3.11 py311hca03da5_0
prompt-toolkit 3.0.43 py311hca03da5_0
prompt_toolkit 3.0.43 hd3eb1b0_0
psutil 5.9.0 py311h80987f9_0
ptyprocess 0.7.0 pyhd3eb1b0_2
pure_eval 0.2.2 pyhd3eb1b0_0
pyarrow 14.0.2 py311ha07b5f9_0
pygments 2.15.1 py311hca03da5_1
pyopengl 3.1.1a1 py311hca03da5_0
pyparsing 3.0.9 py311hca03da5_0
pyqt 5.15.10 py311h313beb8_0
pyqt5-sip 12.13.0 py311h80987f9_0
pyqtwebengine 5.15.10 py311h313beb8_0
pysocks 1.7.1 py311hca03da5_0
pytest 7.4.0 py311hca03da5_0
python 3.11.8 hb885b13_0
python-dateutil 2.8.2 pyhd3eb1b0_0
python-lmdb 1.4.1 py311h313beb8_0
python-tzdata 2023.3 pyhd3eb1b0_0
pytz 2023.3.post1 py311hca03da5_0
pyyaml 6.0.1 py311h80987f9_0
pyyaml-env-tag 0.1 pypi_0 pypi pyzmq 25.1.2 py311h313beb8_0
qt-main 5.15.2 h0917680_10
qt-webengine 5.15.9 h2903aaf_7
qtconsole 5.5.1 py311hca03da5_0
qtpy 2.4.1 py311hca03da5_0
re2 2022.04.01 hc377ac9_0
readline 8.2 h1a28f6b_0
requests 2.31.0 py311hca03da5_1
responses 0.13.3 pyhd3eb1b0_0
scikit-learn 1.3.0 py311h7aedaa7_1
scipy 1.11.4 py311hc76d9b0_0
setuptools 68.2.2 py311hca03da5_0
sip 6.7.12 py311h313beb8_0
six 1.16.0 pyhd3eb1b0_1
snappy 1.1.10 h313beb8_1
sortedcontainers 2.4.0 pyhd3eb1b0_0
sqlite 3.41.2 h80987f9_0
stack_data 0.2.0 pyhd3eb1b0_0
tblib 1.7.0 pyhd3eb1b0_0
threadpoolctl 2.2.0 pyh0d69192_0
tk 8.6.12 hb8d0fd4_0
toolz 0.12.0 py311hca03da5_0
tornado 6.3.3 py311h80987f9_0
tqdm 4.66.2 pypi_0 pypi traitlets 5.7.1 py311hca03da5_0
tzdata 2024a h04d1e81_0
urllib3 2.1.0 py311hca03da5_1
utf8proc 2.6.1 h80987f9_1
watchdog 4.0.0 pypi_0 pypi wcwidth 0.2.5 pyhd3eb1b0_0
wheel 0.41.2 py311hca03da5_0
xyzservices 2022.9.0 py311hca03da5_1
xz 5.4.6 h80987f9_0
yaml 0.2.5 h1a28f6b_0
zeromq 4.3.5 h313beb8_0
zict 3.0.0 py311hca03da5_0
zipp 3.17.0 py311hca03da5_0
zlib 1.2.13 h5a0b063_0
zstd 1.5.5 hd90d995_0

By running "phy template-gui ./params.py --debug", I get: 20:33:49.793 [D] init:68 Start capturing exceptions. 20:33:49.800 [D] model:619 Loading spike clusters. 20:33:49.804 [D] model:569 No channel shank file found. 20:33:49.804 [D] model:692 Loading templates. 20:33:49.818 [D] model:724 Templates are dense. 20:33:49.818 [W] model:667 Skipping spike waveforms that do not exist, they will be extracted on the fly from the raw data as needed. 20:33:49.818 [D] model:730 Loading the whitening matrix. 20:33:49.818 [D] model:737 Loading the inverse of the whitening matrix. 20:33:49.819 [D] model:766 Loading features. 20:33:49.820 [D] model:781 Features are sparse. 20:33:49.820 [D] model:803 Loading template features. 20:33:49.821 [D] model:813 Template features are sparse. 20:33:49.821 [D] model:504 Load cluster_Amplitude.tsv. 20:33:49.821 [D] model:504 Load cluster_group.tsv. 20:33:49.821 [D] model:504 Load cluster_ContamPct.tsv. 20:33:49.822 [D] model:504 Load cluster_KSLabel.tsv. 20:33:50.101 [D] context:100 Initialize joblib cache dir at /Users/yunding/Downloads/Pen4a/ks2/sorter_output/.phy. 20:33:50.101 [D] context:101 Reducing the size of the cache if needed. 20:33:50.108 [D] base:102 Add filter high_pass. 20:33:50.108 [D] config:31 Load config file /Users/yunding/.phy/phy_config.py. 20:33:50.109 [D] plugin:145 Loading 0 plugins. 20:33:50.109 [D] context:126 Load memcache for phy.apps.base._get_mean_waveforms. 20:33:50.109 [D] context:126 Load memcache for phy.apps.base._get_mean_waveforms. 20:33:50.109 [D] context:126 Load memcache for phy.apps.base._get_template_waveforms. 20:33:50.110 [D] context:126 Load memcache for phy.apps.base.get_mean_spike_template_amplitudes. 20:33:50.110 [D] context:126 Load memcache for phy.apps.base.get_template_counts. 20:33:50.110 [D] context:126 Load memcache for phy.apps.base.get_template_for_cluster. 20:33:50.110 [D] context:126 Load memcache for phy.apps.template.gui.get_template_amplitude. 20:33:50.111 [D] context:126 Load memcache for phy.apps.base.get_cluster_amplitude. 20:33:50.111 [D] context:126 Load memcache for phy.apps.base.get_mean_firing_rate. 20:33:50.111 [D] context:126 Load memcache for phy.apps.base.get_best_channel. 20:33:50.111 [D] context:126 Load memcache for phy.apps.template.gui.get_best_channels. 20:33:50.111 [D] context:126 Load memcache for phy.apps.base.get_channel_shank. 20:33:50.112 [D] context:126 Load memcache for phy.apps.base.get_probe_depth. 20:33:50.112 [D] context:126 Load memcache for phy.apps.base.peak_channel_similarity. 20:33:50.115 [D] context:185 Save data to /Users/yunding/Downloads/Pen4a/ks2/sorter_output/.phy/spikes_per_cluster.pkl. 20:33:50.119 [D] gui:463 Creating GUI. 20:33:50.169 [D] state:46 Load /Users/yunding/.phy/TemplateGUI/state.json for GUIState. 20:33:50.170 [D] state:46 Load /Users/yunding/Downloads/Pen4a/ks2/sorter_output/.phy/state.json for GUIState. 20:33:50.317 [D] gui:718 Add view ClusterView to GUI. 20:33:50.346 [D] gui:718 Add view SimilarityView to GUI. 20:33:50.369 [D] gui:718 Add view WaveformView to GUI. 20:33:50.394 [D] base:337 Set state for WaveformView. 20:33:50.401 [D] gui:718 Add view CorrelogramView to GUI. 20:33:50.403 [D] base:337 Set state for CorrelogramView. 20:33:50.414 [D] gui:718 Add view ISIView to GUI. 20:33:50.416 [D] base:337 Set state for ISIView.

I sincerely appreciate your feedback! Yun

zm711 commented 6 months ago

@dingyun321, Unfortunately under the hood Phy relies on openGL. Since Phy is in maintenance mode and not in active development I doubt this will be fixed for you (ie Apple deprecated openGL support many versions ago in Macs).

dingyun321 commented 6 months ago

I see. Do you know the last system version on a Mac that can run Phy?

Thank you very much!

zm711 commented 6 months ago

I don't off the top of my head. Mac's deprecated openGL quite a while ago. So I think one issue you would run into is that the old macOS would also only accept a very old version of openGL which would require a lot of work on getting all the other packages in phy working (which aren't pinned to old openGL) so it would end up being a giant undertaking to get it working. Most people end up just finding a linux or windows computer to do their phy.

louiskang commented 5 months ago

I'm using an Intel Mac with MacOS 14.3.1, and somehow this installation worked for me. I use Intel MKL as my BLAS library, so maybe it would work for you if you remove "libblas=*=*mkl"?

conda create -n phy python=3.9 numpy=1.23 "libblas=*=*mkl"
conda activate phy
pip install phy --pre --upgrade
pip uninstall pyqt5 pyqtwebengine
pip install pyqt5==5.14.2 pyqtwebengine==5.14.0
YufeiSi commented 3 weeks ago

I'm using an Intel Mac with MacOS 14.3.1, and somehow this installation worked for me. I use Intel MKL as my BLAS library, so maybe it would work for you if you remove "libblas=*=*mkl"?

conda create -n phy python=3.9 numpy=1.23 "libblas=*=*mkl"
conda activate phy
pip install phy --pre --upgrade
pip uninstall pyqt5 pyqtwebengine
pip install pyqt5==5.14.2 pyqtwebengine==5.14.0

This helped my Mac (MacOS 13.0.1, Intel) when removed "libblas==mkl". I wasn't able to install the versions listed here for pyqt5 and pyqtwebengine on my M1 Mac with MacOS 14.4.1 though.