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

Failure to import on MacOSX Arm64 #194

Closed
oren-weiss opened this issue Feb 3, 2023 · 3 comments
Closed

Failure to import on MacOSX Arm64 #194

oren-weiss opened this issue Feb 3, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@oren-weiss
Copy link

oren-weiss commented Feb 3, 2023

Describe the bug
Failure to import on MacOSX Arm64, either installed via git clone ... ; pip install -e .

Log

import plenoptic as po
Traceback (most recent call last):
  File "/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3442, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-31aae8407192>", line 1, in <module>
    import plenoptic as po
  File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/__init__.py", line 1, in <module>
    from . import simulate as simul
  File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/simulate/__init__.py", line 1, in <module>
    from .models import *
  File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/simulate/models/__init__.py", line 1, in <module>
    from .frontend import *
  File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/simulate/models/frontend.py", line 20, in <module>
    from .naive import Gaussian, CenterSurround
  File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/simulate/models/naive.py", line 8, in <module>
    from plenoptic.tools.conv import same_padding
  File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/tools/__init__.py", line 1, in <module>
    from .data import *
  File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/user/PycharmProjects/XXX/plenoptic/plenoptic/tools/data.py", line 8, in <module>
    from pyrtools import synthetic_images
  File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/__init__.py", line 1, in <module>
    from . import pyramids
  File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/__init__.py", line 1, in <module>
    from .GaussianPyramid import GaussianPyramid
  File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/GaussianPyramid.py", line 3, in <module>
    from .c.wrapper import corrDn
  File "/Users/user/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8617.48/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapper.py", line 17, in <module>
    lib = ctypes.cdll.LoadLibrary(libpath[0])
  File "/Users/user/mambaforge/envs/XXX/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "/Users/user/mambaforge/envs/XXX/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so, 0x0006): tried: '/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so' (no such file), '/Users/user/mambaforge/envs/XXX/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

System (please complete the following information):

  • OS: MacOS 13.2 Ventura (M1 Max chip)
  • Python 3.10 (Mambaforge)

Additional context
Can possibly be remedied using certain tricks, e.g. https://apple.stackexchange.com/questions/436801/m1-mac-mach-o-file-but-is-an-incompatible-architecture-have-x86-64-need-a
This issue seems to be primarily with pyrtools

@billbrod billbrod added the bug Something isn't working label Feb 6, 2023
@billbrod
Copy link
Collaborator

billbrod commented Feb 6, 2023

This does appear to be a pyrtools problem, can you double-check that's the case by just installing pyrtools by itself (in a clean environment) and seeing if you get the same error? So:

mamba create -n pyrtools_test python==3.10
conda activate  pyrtools_test
pip install pyrtools

@oren-weiss
Copy link
Author

oren-weiss commented Feb 6, 2023

Here it is: python -c "import pyrtools as pt" 2> pyrtools.log

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/__init__.py", line 1, in <module>
    from . import pyramids
  File "/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/__init__.py", line 1, in <module>
    from .GaussianPyramid import GaussianPyramid
  File "/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/GaussianPyramid.py", line 3, in <module>
    from .c.wrapper import corrDn
  File "/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapper.py", line 17, in <module>
    lib = ctypes.cdll.LoadLibrary(libpath[0])
  File "/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so, 0x0006): tried: '/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so' (no such file), '/Users/user/mambaforge/envs/pyrtools_test/lib/python3.10/site-packages/pyrtools/pyramids/c/wrapConv.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

@billbrod
Copy link
Collaborator

billbrod commented Feb 6, 2023

Alright, I opened an issue for this on the pyrtools issues tracker (I'm also a maintainer for that package), so let's continue the conversation there: LabForComputationalVision/pyrtools#21

@billbrod billbrod closed this as completed Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants