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

Cannot import OMP-based library on mac osx by installing thorugh pip #217

Open
lllaurensss opened this issue Jul 18, 2024 · 2 comments
Open

Comments

@lllaurensss
Copy link

Hello i'm trying to install dtaidistance library but it keeps on failing. After reading some other (solved) bugs i decided to create a new ticket as the solutions provided were not able to solve it. When i install dtaidistance through pip it seems installed but when i test the installation i throws the following error:

Python 3.10.14 (main, Mar 19 2024, 21:46:16) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import dtaidistance.dtw as dtw
dtw.try_import_c()
Cannot import OMP-based library (dtw_cc_omp)
Cannot import Numpy-based library (dtw_cc_numpy)

Not all libraries are available in your installation.
You can rerun the compilation from source or pip install in verbose mode:
pip install -vvv --upgrade --force-reinstall --no-deps --no-binary dtaidistance dtaidistance
In case you need to use an older version of numpy, compile against your current installation:
pip install -vvv --upgrade --force-reinstall --no-deps --no-build-isolation --no-binary dtaidistance dtaidistance

Share the following information when submitting a bug report:
== Packages ==

  • Cannot import OMP-based library (dtw_cc_omp)
  • dlopen(/Users/qa/qa_projects/Site.Simulation/venv/lib/python3.10/site-packages/dtaidistance/dtw_cc_omp.cpython-310-darwin.so, 0x0002): Library not loaded: /usr/local/lib/libomp.dylib
    Referenced from: <98471F9E-8556-3226-98BC-2F461A21F1D5> /Users/qa/qa_projects/Site.Simulation/venv/lib/python3.10/site-packages/dtaidistance/dtw_cc_omp.cpython-310-darwin.so
    Reason: tried: '/usr/local/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libomp.dylib' (no such file), '/usr/local/lib/libomp.dylib' (no such file)
  • Cannot import Numpy-based library (dtw_cc_numpy)
  • dlopen(/Users/qa/qa_projects/Site.Simulation/venv/lib/python3.10/site-packages/dtaidistance/dtw_cc_numpy.cpython-310-darwin.so, 0x0002): Library not loaded: /usr/local/lib/libomp.dylib
    Referenced from: /Users/qa/qa_projects/Site.Simulation/venv/lib/python3.10/site-packages/dtaidistance/dtw_cc_numpy.cpython-310-darwin.so
    Reason: tried: '/usr/local/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libomp.dylib' (no such file), '/usr/local/lib/libomp.dylib' (no such file)
  • Numpy version: 1.23.4
  • Matplotlib version: 3.6.3
  • Scipy version: 1.10.1
    == System information ==
    namespace(name='cpython', cache_tag='cpython-310', version=sys.version_info(major=3, minor=10, micro=14, releaselevel='final', serial=0), hexversion=50990832, _multiarch='darwin')
    == Compilation information ==
    Compiler type: unix
    --noopenmp: 0
    --forceopenmp: 0
    --noxpreprocessor: 0
    --forcellvm: 0
    --forcegnugcc: 0
    --forcestatic: 0
    Cython found (during compilation)
  • Version: 3.0.10
  • Locations: <module 'Cython' from '/private/var/folders/dm/88b38gj92jj53dgxdsm12qf00000gn/T/build-env-2os_lx3p/lib/python3.10/site-packages/Cython/init.py'>
    Numpy found (during compilation):
  • Version: 1.26.4
  • Location: <module 'numpy' from '/private/var/folders/dm/88b38gj92jj53dgxdsm12qf00000gn/T/build-env-2os_lx3p/lib/python3.10/site-packages/numpy/init.py'>
    Using LLVM settings (clang)
    Checking for OpenMP availability for clang
    clang -dM -E -Xpreprocessor -fopenmp - # with stdout=-1, stderr=-1, input=, encoding=ascii

#define _OPENMP 201811
... found OpenMP
All extensions:
[<setuptools.extension.Extension('dtaidistance.dtw_cc') at 0x1056a7af0>, <setuptools.extension.Extension('dtaidistance.ed_cc') at 0x105813d60>, <setuptools.extension.Extension('dtaidistance.dtw_cc_omp') at 0x1058182b0>, <setuptools.extension.Extension('dtaidistance.dtw_cc_numpy') at 0x105819cf0>]

==
False

I tried several things also upgraded gcc (for what it is worth)... when i installed it through conda it did work but still i need to be able to install it through pip

@wannesm
Copy link
Owner

wannesm commented Jul 19, 2024

It is only the parallel version that seems to fail loading. It appears you are using clang, not gcc? If you are using homebrew, make sure to install OMP first with brew install libomp.

@jensenojs
Copy link

same problem here

Cannot import Numpy-based library (dtw_cc_numpy)

Not all libraries are available in your installation. 
You can rerun the compilation from source or pip install in verbose mode:
pip install -vvv --upgrade --force-reinstall --no-deps --no-binary dtaidistance dtaidistance
In case you need to use an older version of numpy, compile against your current installation:
pip install -vvv --upgrade --force-reinstall --no-deps --no-build-isolation --no-binary dtaidistance dtaidistance

Share the following information when submitting a bug report:
== Packages ==
- Cannot import OMP-based library (dtw_cc_omp)
- dlopen(/Users/jensen/Projects/quant/evaluate-factor/.venv/lib/python3.12/site-packages/dtaidistance/dtw_cc_omp.cpython-312-darwin.so, 0x0002): Library not loaded: /usr/local/lib/libomp.dylib
  Referenced from: <F1D37DBE-A234-3783-B8E2-7B6547F05A30> /Users/jensen/Projects/quant/evaluate-factor/.venv/lib/python3.12/site-packages/dtaidistance/dtw_cc_omp.cpython-312-darwin.so
  Reason: tried: '/usr/local/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libomp.dylib' (no such file), '/usr/local/lib/libomp.dylib' (no such file)
- Cannot import Numpy-based library (dtw_cc_numpy)
- dlopen(/Users/jensen/Projects/quant/evaluate-factor/.venv/lib/python3.12/site-packages/dtaidistance/dtw_cc_numpy.cpython-312-darwin.so, 0x0002): Library not loaded: /usr/local/lib/libomp.dylib
  Referenced from: <252391D9-EFEE-3F57-BC91-46FAC8BCBF31> /Users/jensen/Projects/quant/evaluate-factor/.venv/lib/python3.12/site-packages/dtaidistance/dtw_cc_numpy.cpython-312-darwin.so
  Reason: tried: '/usr/local/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libomp.dylib' (no such file), '/usr/local/lib/libomp.dylib' (no such file)
- Numpy version: 2.0.2
- Matplotlib version: 3.9.2
- Scipy version: 1.14.1
== System information ==
namespace(name='cpython', cache_tag='cpython-312', version=sys.version_info(major=3, minor=12, micro=6, releaselevel='final', serial=0), hexversion=51119856, _multiarch='darwin')
== Compilation information ==
Compiler type: unix
--noopenmp: 0
--forceopenmp: 0
--noxpreprocessor: 0
--forcellvm: 0
--forcegnugcc: 0
--forcestatic: 0
Cython found (during compilation)
- Version: 3.0.10
- Locations: <module 'Cython' from '/private/var/folders/vy/h7r6h43j203gstfh6fj9_tyh0000gn/T/build-env-1b0ihl5m/lib/python3.12/site-packages/Cython/__init__.py'>
Numpy found (during compilation):
- Version: 1.26.4
- Location: <module 'numpy' from '/private/var/folders/vy/h7r6h43j203gstfh6fj9_tyh0000gn/T/build-env-1b0ihl5m/lib/python3.12/site-packages/numpy/__init__.py'>
Using LLVM settings (clang)
Checking for OpenMP availability for clang
clang -dM -E -Xpreprocessor -fopenmp - # with stdout=-1, stderr=-1, input=, encoding=ascii

#define _OPENMP 201811
... found OpenMP
All extensions:
[<setuptools.extension.Extension('dtaidistance.dtw_cc') at 0x112e7eff0>, <setuptools.extension.Extension('dtaidistance.ed_cc') at 0x1158c2810>, <setuptools.extension.Extension('dtaidistance.dtw_cc_omp') at 0x1158c2ae0>, <setuptools.extension.Extension('dtaidistance.dtw_cc_numpy') at 0x1158e4aa0>]


==
The compiled dtaidistance C library is not available.
See the documentation for alternative installation options.
ERROR

and i did install libomp firstly

Done!
> brew install libomp
==> Downloading https://formulae.brew.sh/api/formula.jws.json
########################################################################################################################################################################################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
########################################################################################################################################################################################################################################### 100.0%
Warning: libomp 19.1.1 is already installed and up-to-date.
To reinstall 19.1.1, run:
  brew reinstall libomp

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