fooof-tools / fooof_mat

A Matlab wrapper for spectral parameterization.
MIT License
41 stars 20 forks source link

fooof import error #23

Open 4srihy opened 3 years ago

4srihy commented 3 years ago

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, frange, settings);"

TomDonoghue commented 3 years ago

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 commented 3 years ago

Hello,

Thanks. There is some issue with anaconda python with matlab. I removed anaconda and download normal Python and then it worked.

In the link that you provide in documentation, It is written that anaconda python doesn't work with matlab fooof. So it is better to make it explicit on the fooof site.

Regards Srishty

On Sat, Oct 2, 2021, 11:04 PM Tom @.***> wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fooof-tools/fooof_mat/issues/23#issuecomment-932789734, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVOC44UUP4C6RKI2TN6QT53UE47D3ANCNFSM5DGW2D7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

nb-bu commented 9 months ago

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?