2

I've been trying import a Module using:

import pyexiv2

which yields an error

Aruns-MacBook-Air:scripts arun$ python3 99-new-camera.py crop_field
Traceback (most recent call last):
  File "99-new-camera.py", line 7, in <module>
    import pyexiv2                  # dnf install python3-exiv2 (py3exiv2)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyexiv2/__init__.py", line 60, in <module>
    import libexiv2python
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/libexiv2python.cpython-37m-darwin.so, 2): Symbol not found: _PyCMethod_New
  Referenced from: /usr/local/opt/boost-python3/lib/libboost_python39.dylib
  Expected in: flat namespace
 in /usr/local/opt/boost-python3/lib/libboost_python39.dylib

I already have all the dependencies installed, I don't see why this error is being raised. I'm running Python 3.7 on macOS Big Sur. Are there any workarounds for this issue?

I believe I've found a solution to the problem from this post which suggests a fix by adding a linker flag -lboost-python3. How do I add a linker flag and fix this issue?

The Singularity
  • 2,428
  • 3
  • 19
  • 48
  • did you try `-lboost-python37` ? Maybe `libboost_python39` means it tries to use version for `Python 3.9` but you use `Python 3.7`. I can't help more because I don't use MacOS and I can't test it on my computer. – furas Jan 28 '21 at 13:22
  • maybe you should download [py3exiv2 source code](https://pypi.org/project/py3exiv2/#files), uncompress it and run `python setup.py`. Inside `setup.py` there is `extra_compile_args=['-g']` and maybe you could add this flag to this list. – furas Jan 28 '21 at 13:33
  • in source code you can find also `README` which describes how to build it - and I see it has option `--libboost=FILE`. Maybe it helps to use `libboost_python37` instead of `libboost_python39`. – furas Jan 28 '21 at 13:35

0 Answers0