question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to create / install universal2 pip packages on Darwin

See original GitHub issue

What’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

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
uranusjrcommented, Mar 23, 2022

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.

0reactions
pfmoorecommented, Mar 23, 2022

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”).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found