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

pip install antspyx installs arm-compiled ANTsPy on intel-based mac (py=3.9) #524

Closed
dipterix opened this issue Jan 17, 2024 · 18 comments
Closed

Comments

@dipterix
Copy link

pip install antspyx
python
>>> import ants
ImportError: ... addNoiseToImage.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64' but ...)

Not working setups:

Python version: 3.9
ANTsPyx version: 0.4.2, 0.3.8
OSX version: 13.4, Intel CPU

Working setups:

Python version: 3.8
ANTsPyx version: 0.4.2, 0.3.8
OSX version: 13.4, Intel CPU

@cookpa
Copy link
Member

cookpa commented Jan 17, 2024

Cannot reproduce with an Intel Mac running OS 12.7. I wonder if it's a problem with pip detecting the right package to install, or maybe it's an issue with Mac OS 13 vs 12.

% python             
Python 3.9.18 (main, Sep 11 2023, 08:38:23) 
[Clang 14.0.6 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ants
>>> img = ants.image_read( ants.get_ants_data('r16') )
>>> print(img)
ANTsImage
	 Pixel Type : float (float32)
	 Components : 1
	 Dimensions : (256, 256)
	 Spacing    : (1.0, 1.0)
	 Origin     : (0.0, 0.0)
	 Direction  : [1. 0. 0. 1.]

>>> 

Can you paste the output of pip install antspyx? Might be some clues there

@dipterix
Copy link
Author

dipterix commented Jan 23, 2024

I built a reproducible github action here https://github.com/dipterix/ravemanager/actions/runs/7630738677/job/20787088190#step:7:1466

+ '/Users/runner/Library/r-rpymat/miniconda/envs/rpymat-conda-env/bin/python' -m pip install --upgrade --no-user antspynet
Collecting antspynet
  Downloading antspynet-0.2.3-py3-none-any.whl.metadata (8.6 kB)
Collecting antspyx (from antspynet)
  Downloading antspyx-0.4.2-cp39-cp39-macosx_12_0_universal2.whl.metadata (781 bytes)
...
  ImportError: dlopen(/Users/runner/Library/r-rpymat/miniconda/envs/rpymat-conda-env/lib/python3.9/site-packages/ants/lib/addNoiseToImage.cpython-39-darwin.so, 0x0002): tried: '/Users/runner/Library/r-rpymat/miniconda/envs/rpymat-conda-env/lib/python3.9/site-packages/ants/lib/addNoiseToImage.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64h)))

The runner itself is running under intel chip, and the enclosing conda, including pip are built under conda-forge/osx-64

@cookpa
Copy link
Member

cookpa commented Jan 23, 2024

Thanks, I tried installing antspynet, rather than antspyx directly, as in the runner. For me, it installs correctly (I'm running Monterey, 12.7)

% conda activate antspynettest_nocache
(antspynettest_nocache) pcook@athena NOT_BACKED_UP % pip install --no-cache-dir antspynet
Collecting antspynet
  Downloading antspynet-0.2.3-py3-none-any.whl.metadata (8.6 kB)
Collecting antspyx (from antspynet)
  Downloading antspyx-0.4.2-cp39-cp39-macosx_10_9_x86_64.whl.metadata (781 bytes)

From your runner output,

Collecting antspynet
  Downloading antspynet-0.2.3-py3-none-any.whl.metadata (8.6 kB)
Collecting antspyx (from antspynet)
  Downloading antspyx-0.4.2-cp39-cp39-macosx_12_0_universal2.whl.metadata (781 bytes)
Collecting keras (from antspynet)

It pulls from antspyx-0.4.2-cp39-cp39-macosx_12_0_universal2.whl.metadata. I'll take a look at that wheel next

@cookpa
Copy link
Member

cookpa commented Jan 23, 2024

pip install --no-cache-dir antspyx-0.4.2-cp39-cp39-macosx_12_0_universal2.whl 
ERROR: antspyx-0.4.2-cp39-cp39-macosx_12_0_universal2.whl is not a supported wheel on this platform.

I can't even install the wheel, it says right away it's not compatible. Not sure what's happening with the runner.

@cookpa
Copy link
Member

cookpa commented Jan 23, 2024

Pinging pypi maintainers @stnava @ravnoor @ntustison

It looks like the universal wheel

https://files.pythonhosted.org/packages/fb/10/fd8a11f410edccbaf2d62b70a008aefe2b7ae79dbd2366d7a479a8b7076f/antspyx-0.4.2-cp39-cp39-macosx_12_0_universal2.whl

only provides arm64 binaries. It's causing an Intel Github runner to fail to install (as above), though on my Intel mac machine pip selects a different wheel, which works.

@dipterix
Copy link
Author

I removed antspynet from installation and the problem still exists: https://github.com/dipterix/ravemanager/actions/runs/7635397131/job/20800760019#step:7:1848

@ravnoor
Copy link
Contributor

ravnoor commented Jan 24, 2024

I setup a minimal conda environment with the results identical to @cookpa's testing. Probably the universal wheel in question is corrupted or wasn't built/tested properly. It's the only universal binary on PyPi so it's hard to determine if this was a systemic or a one-off issue.

The easiest fix would be to delete the universal binary from PyPi, since it's made redundant by more recently built/tested cp39-macosx_10_9_x86_64 and cp39-macosx_11_0_arm64 wheels.

@ravnoor
Copy link
Contributor

ravnoor commented Jan 24, 2024

#527 should make scenarios such as this less likely.

@cookpa
Copy link
Member

cookpa commented Jan 25, 2024

I'm good with deleting, is that OK @stnava ? Specifically, removing antspyx-0.4.2-cp39-cp39-macosx_12_0_universal2.whl (f62c8751d817d5c458d2867f36fec58442907dda7a95ae112c38f6c953121ce9)

@stnava
Copy link
Member

stnava commented Jan 25, 2024

sure whatever works

@cookpa
Copy link
Member

cookpa commented Feb 2, 2024

@stnava @ntustison could I please be added as an antspyx PyPI maintainer?

@stnava
Copy link
Member

stnava commented Feb 2, 2024

what is your pypi user name?

@cookpa
Copy link
Member

cookpa commented Feb 2, 2024

Sorry cookpa over there too

@cookpa
Copy link
Member

cookpa commented Feb 2, 2024

Thanks @stnava - looks like deletions are only available to "owners", would you be able to remove antspyx-0.4.2-cp39-cp39-macosx_12_0_universal2.whl? I think that should solve this issue.

Thanks

@stnava
Copy link
Member

stnava commented Feb 2, 2024

done

@cookpa
Copy link
Member

cookpa commented Feb 2, 2024

Thanks! @dipterix hopefully you can install on x86 now

@dipterix
Copy link
Author

dipterix commented Feb 2, 2024

Great! Do I need to compile on the fly? (Btw I just realized we are at the same building!

@cookpa
Copy link
Member

cookpa commented Feb 2, 2024

I think it should get a pre-compiled binary, on my Intel Mac it gets antspyx-0.4.2-cp39-cp39-macosx_10_9_x86_64.whl.

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

5 participants