Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 2.7: TypeError: unbound method materials() must be called with Path instance as first argument (got nothing instead) #93

Open
MarcoCode23 opened this issue Mar 12, 2019 · 2 comments

Comments

@MarcoCode23
Copy link

MarcoCode23 commented Mar 12, 2019

Trying to run the template I got the following error message:

Traceback (most recent call last):
File "neuroTest.py", line 10, in
bio = nk.bio_process(ecg=df["ECG"], sampling_rate=100)
File "/home/sisu/anaconda2/lib/python2.7/site-packages/neurokit/bio/bio_meta.py", line 125, in bio_process
ecg = ecg_process(ecg=ecg, rsp=rsp, sampling_rate=sampling_rate, filter_type=ecg_filter_type, filter_band=ecg_filter_band, filter_frequency=ecg_filter_frequency, segmenter=ecg_segmenter, quality_model=ecg_quality_model, hrv_features=ecg_hrv_features, age=age, sex=sex, position=position)
File "/home/sisu/anaconda2/lib/python2.7/site-packages/neurokit/bio/bio_ecg.py", line 119, in ecg_process
quality = ecg_signal_quality(cardiac_cycles=processed_ecg["ECG"]["Cardiac_Cycles"], sampling_rate=sampling_rate, rpeaks=processed_ecg["ECG"]["R_Peaks"], quality_model=quality_model)
File "/home/sisu/anaconda2/lib/python2.7/site-packages/neurokit/bio/bio_ecg.py", line 357, in ecg_signal_quality
model = sklearn.externals.joblib.load(Path.materials() + 'heartbeat_classification.model')
TypeError: unbound method materials() must be called with Path instance as first argument (got nothing instead)

Is python 2.7 fully supported?

@DominiqueMakowski
Copy link
Member

@marcofilippi, it seems like this issue is created when neurokit is trying to load the sklearn model (saved using sklearn for python 3). I am not sure that I can fix it, as it seems tied to scikitlearn 😕 Maybe try updating your version of scikit-learn?

The goal is being able to load this file... Does it work if you try only that?
model = sklearn.externals.joblib.load('heartbeat_classification.model')

@MarcoCode23
Copy link
Author

@DominiqueMakowski , I updated to scikit-learn-0.20.3 and I tried to load the file with the command you suggested! Now the message I received is the following:

Traceback (most recent call last):
File "classes.py", line 3, in
model = sklearn.externals.joblib.load('./heartbeat_classification.model')
File "/home/sisu/anaconda2/lib/python2.7/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 598, in load
obj = _unpickle(fobj, filename, mmap_mode)
File "/home/sisu/anaconda2/lib/python2.7/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 526, in _unpickle
obj = unpickler.load()
File "/home/sisu/anaconda2/lib/python2.7/pickle.py", line 864, in load
dispatchkey
File "/home/sisu/anaconda2/lib/python2.7/pickle.py", line 892, in load_proto
raise ValueError, "unsupported pickle protocol: %d" % proto
ValueError: unsupported pickle protocol: 3

Which is your scikitlearn version? I suppose I cannot avoid to jump to python3, since scikit-learn website says "Scikit-learn 0.21 will require Python 3.5 or newer."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants