Is there a way to create / install universal2 pip packages on Darwin
See original GitHub issueWhat’s the problem this feature will solve?
I’m attempting to create a portable python environment for Mac. Should be a core python package similar to virtual environment, with a couple of pip packages installed in it.
The problem is on Macos, where I need the package to be portable between M1 and x86_64 Macs. The core python package is built as a universal binary. I’m not seeing a way to install a pip package (say, numpy) in a similar manner; the pip install
command always installs the binaries with the singular host architecture.
Describe the solution you’d like
Some sort of CLI control allowing functionality similar to --enable-universalsdk --with-universal-archs=universal2
configuration flags when building python
Alternative Solutions
none
Additional context
none
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
`pip install - Discussions on Python.org
To my eyes, it looks like pip install -e .[dev] tries to compile for x86 and arm64 at the same time, to create...
Read more >How to run wxPython with the python.org ... - Stack Overflow
Install python 3.9.13 using the macOS 64-bit universal2 installer; Install wxPython using pip - pip3 install -U wxPython; Start python in a ...
Read more >Support for universal2 (#517) · Issues · PyPy / cffi - Projects
We want to package our application to support both old and new Mac's. ... (from inside root of cffi source) python3.10 -m pip...
Read more >Tips and tricks - cibuildwheel - Read the Docs
The native wheel for macOS on Apple Silicon. Requires Pip 20.3+ (or packaging 20.5+) to install. universal2 ¶. This wheel contains both architectures,...
Read more >Bug #1980575 “4.9.1 on macOS M1: incompatible architecture ...
Building wheels for collected packages: lxml ... If you have pip-run installed, it's much easier to reproduce the error in one line without ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
From what I understand (I’m not that familiar with M1 cross-compilation, this is just what I heard from others), yes there is a way to build universal2 on x86-64. Once you’ve built the wheel, pip can happily install the URL directly (
pip install "numpy@https://....whl"
). As for how universal2 can be built for a given project, you’ll need to ask Numpy maintainers;pip install
merely asks the Numpy tar to build itself, and whatever the package does is opaque to pip.Note that pip will only install wheels that have supported tags, so it’s also important that the Python installation (via the packaging library) and the wheel builder agree on what tags apply.
I don’t believe that multi-architecture wheels were common before the M1 became available, so a lot of this has probably only had limited use so far. So bugs are possible (but it’s likely that any such bugs are with other projects - in this context pip mostly just “does what it’s told to”).