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

fooof import error #23

Open
4srihy opened this issue Sep 1, 2021 · 3 comments
Open

fooof import error #23

4srihy opened this issue Sep 1, 2021 · 3 comments

Comments

@4srihy
Copy link

4srihy commented Sep 1, 2021

Hi!
I am getting the following error and could not able to resolve it
"_Unable to resolve the name py.fooof.FOOOF.

Error in fooof (line 48)
fm = py.fooof.FOOOF(settings.peak_width_limits, ...

Error in fooof_example_one_spectrum (line 24)
fooof_results = fooof(freqs, psd, f_range, settings);_"

@TomDonoghue
Copy link
Member

This suggests that Matlab is not finding FOOOF. Are you sure it's properly installed and Matlab is looking at the correct Python? There are some notes in the README about checking that Matlab is "seeing" the correct Python. If you are using Anaconda for the Python install, then you can use conda list in a terminal to see the installed packages, and check that fooof is installed.

@4srihy
Copy link
Author

4srihy commented Oct 2, 2021 via email

@nb-bu
Copy link

nb-bu commented Jan 17, 2024

Hi both! I run into the same error, but unfortunately, it wasn't resolved by the change from anaconda to normal Python..

I'm using Matlab 2023b on a Mac (M1). Have tried both with Anaconda and now more recently with the "normal" Python 3.10 from python.org. Matlab's pyenv recognizes the correct Python version and (after some troubleshooting) finally lets me use numpy; but still can't recognize fooof (shooting the same error as above), even though it's installed in the correct folder.

Spent all day yesterday and today trying to find solutions, also testing out proposed solutions to these related issues:
https://de.mathworks.com/matlabcentral/answers/487329-unable-to-resolve-the-name-py-module
https://de.mathworks.com/matlabcentral/answers/1966239-why-do-i-receive-python-error-importerror-when-importing-python-s-numpy-library-on-an-apple-m-se
https://de.mathworks.com/matlabcentral/answers/1977529-how-to-use-python-from-matlab-on-mac-with-apple-silicon

Unfortunately, nothing seemed to work and I'm still getting the error when running the example script:
fooof_example_multi_spectra
Unable to resolve the name 'py.fooof.FOOOF'.

Error in fooof (line 48)
fm = py.fooof.FOOOF(settings.peak_width_limits, ...

When I try to import the fooof module in Matlab to test the access, it shoots this error:
py.importlib.import_module('fooof')
Error using Image>
Python Error: ImportError:
dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so,
0x0002): tried:
'/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so'
(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')),
'/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so'
(no such file),
'/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so'
(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

All these suggested solutions didn't solve the issue:
https://stackoverflow.com/questions/72920577/mach-o-file-but-is-an-incompatible-architecture-have-arm64-need-x86-64
https://apple.stackexchange.com/questions/436801/m1-mac-mach-o-file-but-is-an-incompatible-architecture-have-x86-64-need-a

Any ideas how to resolve this?

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

3 participants