PridaLab / cnn-matlab

CNN-matlab is the MATLAB version of CNN-ripple. It uses a 1D convolutional neural network (CNN) operating over LFP recordings to detect hippocampal SWR.
6 stars 1 forks source link

issue between matlab and python #1

Open pplenck opened 1 year ago

pplenck commented 1 year ago

Hello I am super excited to test your cnn!

I created my environment as you proposed and got no issue, keras and tensorflow installed using the required versions. ( - h5py=2.10

Echoing the exec_path did not work echo %CONDA_PREFIX%

gives %CONDA_PREFIX% so I used conda env list to see where my cnn-env was: exec_env='C:\ProgramData\Anaconda3\envs\cnn-env';

I got the data and samplingfreq prepared, however when I ran in matlab (launched from conda):

Ripl_Proba=detect_ripples_cnn(data, fs, 'exec_env',exec_env );

I got the following isue on matlab : any idea of what I missed? thanks!

Error using h5>init h5py.h5 (line 41) Python Error: AttributeError: type object 'h5py.h5.H5PYConfig' has no attribute '__reduce_cython__'

Error in version> (line 17) from . import h5 as _h5

Error in init> (line 34) from . import version

Error in hdf5_format> (line 41) import h5py

Error in training> (line 53) from tensorflow.python.keras.saving import hdf5_format

Error in functional> (line 38) from tensorflow.python.keras.engine import training as training_lib

Error in models> (line 26) from tensorflow.python.keras.engine import functional

Error in init> (line 27) from tensorflow.python.keras import models

Error in init> (line 47) from tensorflow.python import keras

Error in init> (line 41) from tensorflow.python.tools import module_util as _module_util

Error in model_class> (line 1) import tensorflow.keras.backend as K

Error in cnn> (line 7) import model_class

Error in _call_with_frames_removed (line 219)

Error in exec_module (line 843)

Error in _load_unlocked (line 671)

Error in _find_and_load_unlocked (line 975)

Error in _find_and_load (line 991)

Error in _gcd_import (line 1014)

Error in init>import_module (line 127) return _bootstrap._gcd_import(name[level:], package, level)

pplenck commented 1 year ago

'fixed it' by pip uninstalling h5py but had lots of incopatibilities reported:

Installing collected packages: h5py ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. tensorflow 2.3.0 requires gast==0.3.3, but you have gast 0.4.0 which is incompatible. tensorflow 2.3.0 requires h5py<2.11.0,>=2.10.0, but you have h5py 3.9.0 which is incompatible. tensorflow 2.3.0 requires scipy==1.4.1, but you have scipy 1.6.2 which is incompatible. tensorflow 2.3.0 requires tensorflow-estimator<2.4.0,>=2.3.0, but you have tensorflow-estimator 2.6.0 which is incompatible.

but now it runs. however, In matlab I now get Error using py.cnn.predict Conversion of MATLAB 'double' to Python is only supported for 1-N vectors.

btw on what verision of Matlab do you run this?