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
BUG: <ImportError when running container on M1 mac laptop> #24114
Comments
On 5/7/23 00:50, janeswh wrote:
Describe the issue:
I built a multiplatform Docker image using Linux and installed numpy
via requirements.txt file. The container runs fine on both Windows and
Linux but when running it on Mac (linux/arm64), the following error is
displayed. Forcing Docker on Mac to use the linux/amd64 platform
resolves the error, so I'm wondering whether it's a Python
3.11/arm/numpy interaction issue?
python version: 3.11
numpy version: 1.25.0
Mac OS 12.5
Are you using exactly the same binary image in each run (windows, linux,
mac) from an image hub or rebuilding for each platform's docker?
How did you install python?
What is reported for `python3.10 -c "from packaging import tags;
print([str(t) for t in tags.sys_tags()][:10])"` in each of the docker
runs (windows, linux, macos, macos-x86_64)?
Matti
… Message ID: ***@***.***>
|
I'm rebuilding for each platform's docker using
Not sure what you mean.. for the Docker image, it's a multistage build with On the Linux computer where I'm doing the building, it was
I changed the above command to python3.11 Windows
Linux
M1 macbook pro
macos-x86_64
|
Weird. According to that, you should already be running a x86_64-only python, so I am not sure how setting the arch to x86_64 helps "convince" the docker to use x86_64 mode. |
I'm a newbie to all this.. could you explain what you mean? Everything listed in the M1 macbook pro is aarch64, and that's where I'm setting the arch to x86_64 to (but then it just runs in emulation and everything is slow/defeats the purpose of the multiplatform build). The macos-x86_64 doesn't have problems running the image. |
Ahh, no, I was reading on my phone and missed something. Look at the output from the M1 macbook pro. Note the tag names have |
Ah okay, that makes sense. Does this mean that my docker multi-platform build was done incorrectly, then? Here is the beginning part of my Dockerfile:
I assumed that by the time pip3 install is run, the arm64 image would do pip install numpy and get the arm64 package. How should I instead be telling the arm64 image in the Dockerfile to get arm64 numpy? Apologies in advance if I'm still misunderstanding anything! |
We are off-topic for the NumPy issue tracker, sorry. Maybe stackoverflow could help? As a parting hint, I would carefully look at how you are setting things like I will close this since it really has little to do with NumPy. We often get these kind of issues since NumPy is typically the first package installed, and sometimes can even help a bit, but I think we have gone as far as we can. |
Describe the issue:
I built a multiplatform Docker image using Linux and installed numpy via requirements.txt file. The container runs fine on both Windows and Linux but when running it on Mac (linux/arm64), the following error is displayed. Forcing Docker on Mac to use the linux/amd64 platform resolves the error, so I'm wondering whether it's a Python 3.11/arm/numpy interaction issue?
python version: 3.11
numpy version: 1.25.0
Mac OS 12.5
Reproduce the code example:
Error message:
Runtime information:
numpy doesn't run on Mac docker container
Context for the issue:
No response
The text was updated successfully, but these errors were encountered: