fastlib / fCWT

The fast Continuous Wavelet Transform (fCWT) is a library for fast calculation of CWT.
Apache License 2.0
283 stars 55 forks source link

Running fcwt on Macbook M3 #69

Open Rievil opened 2 months ago

Rievil commented 2 months ago

I am trying to run fcwt on Macbook M3 chip, (Python 3.12.6), OS Sonoma 14.6.1. I am have created venv (Envs/base) for testing fcwt. I am trying to run the very first python example on repo of fcwt. On windows it runs perfectly. On M3 Macbook I get error:

Traceback (most recent call last):

File ~/Documents/Envs/base/lib/python3.12/site-packages/fcwt/init.py:1 from .fcwt import Morlet, Scales, FCWT, FCWT_LINSCALES, FCWT_LOGSCALES, FCWT_LINFREQS

File ~/Documents/Envs/base/lib/python3.12/site-packages/fcwt/fcwt.py:13 from . import _fcwt

ImportError: dlopen(/Users/user/Documents/Envs/base/lib/python3.12/site-packages/fcwt/_fcwt.cpython-312-darwin.so, 0x0002): symbol not found in flat namespace '_omp_get_max_threads

Did anybody else get the same error? When I run:

import os print(f"OMP_NUM_THREADS: {os.getenv('OMP_NUM_THREADS')}")

I got OMP_NUM_THREADS: None so it seems its is perhaps problem of OpenMP, but I am really stuck at this moment. Can someone help?

freekv commented 3 weeks ago

I had success with brew install libomp CFLAGS="-Xpreprocessor -fopenmp" LDFLAGS="-L/opt/homebrew/opt/libomp/lib -lomp" pip install --force-reinstall --no-cache-dir fcwt