mcneel / rhino3dm

Libraries based on OpenNURBS with a RhinoCommon style
MIT License
573 stars 135 forks source link

rhino3dm.py import error on arm64 architecture (M1) #607

Closed antalvarenga-ic closed 2 months ago

antalvarenga-ic commented 2 months ago

Hi,

I am trying to use rhino3dm inside a poetry project, but it's throwing an error:

...
File "/path/to/project/.venv/lib/python3.11/site-packages/rhino3dm/__init__.py", line 5, in <module>
    from ._rhino3dm import *
ImportError: dlopen(/path/to/project/.venv/lib/python3.11/site-packages/rhino3dm/_rhino3dm.cpython-311-darwin.so, 0x0002): tried: '/path/to/project/.venv/lib/python3.11/site-packages/rhino3dm/_rhino3dm.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/path/to/project/.venv/lib/python3.11/site-packages/rhino3dm/_rhino3dm.cpython-311-darwin.so' (no such file), '/path/to/project/.venv/lib/python3.11/site-packages/rhino3dm/_rhino3dm.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

I installed rhino3dm using poetry: poetry add rhino3dm

poetry env info output:

Virtualenv
Python:         3.11.7
Implementation: CPython
Path:           /path/to/project/.venv
Executable:     /path/to/project/.venv/bin/python
Valid:          True

System
Platform:   darwin
OS:         posix
Python:     3.11.7
Path:       /Library/Frameworks/Python.framework/Versions/3.11
Executable: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11

OS is macOS 14.2.1 M1

EDIT: Even installing on the global python environment using pip, the issue persists.

fraguada commented 2 months ago

I am not familiar with poetry. How do I create such a project to duplicate your issue?

fraguada commented 2 months ago

Seeing this issue. Seems we never actually build a multi architecture native library for macos.

fraguada commented 2 months ago

Tried a few things. GitHub has arm64 runners so I was able to build on that. I tested on my M1 and it installs and runs. Try it and let me know if it works for you: https://github.com/mcneel/rhino3dm/actions/runs/8869285668/artifacts/1454749544

and install with: pip install rhino3dm-8.6.1-cp311-cp311-macosx_14_0_universal2.whl

antalvarenga-ic commented 2 months ago

Sorry for the delay. I just tested it and it works. Thank you.

fraguada commented 1 month ago

@antalvarenga-ic I just published rhino3dm 8.6.1 which includes macos arm64 wheels: https://pypi.org/project/rhino3dm/8.6.1/