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 fails (m1 mac, aarch64) and workaround #3

Open
jwmay2012 opened this issue Aug 18, 2022 · 2 comments
Open

pip install fails (m1 mac, aarch64) and workaround #3

jwmay2012 opened this issue Aug 18, 2022 · 2 comments

Comments

@jwmay2012
Copy link

mprofile is failing to compile when I try to pip install pyproff inside a container, running on Apple M1 Max.

Dockerfile

FROM python:3.9-slim

RUN apt-get -qqy update
RUN apt-get install gcc g++ -y

RUN pip install -U pip
RUN pip install pypprof

docker build .

#8 4.219   × Running setup.py install for mprofile did not run successfully.
#8 4.219   │ exit code: 1
#8 4.219   ╰─> [23 lines of output]
#8 4.219       running install
#8 4.219       running build
#8 4.219       running build_py
#8 4.219       creating build
#8 4.219       creating build/lib.linux-aarch64-3.9
#8 4.219       creating build/lib.linux-aarch64-3.9/mprofile
#8 4.219       copying mprofile/__init__.py -> build/lib.linux-aarch64-3.9/mprofile
#8 4.219       running build_ext
#8 4.219       building 'mprofile._profiler' extension
#8 4.219       creating build/temp.linux-aarch64-3.9
#8 4.219       creating build/temp.linux-aarch64-3.9/src
#8 4.219       creating build/temp.linux-aarch64-3.9/third_party
#8 4.219       creating build/temp.linux-aarch64-3.9/third_party/google
#8 4.219       creating build/temp.linux-aarch64-3.9/third_party/google/tcmalloc
#8 4.219       gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPY_SSIZE_T_CLEAN -I/tmp/pip-install-sdxxkev3/mprofile_cf51baac42a347ae9f7457a4d8ea7eb2 -Isrc -I/usr/local/include/python3.9 -c src/_profiler.cc -o build/temp.linux-aarch64-3.9/src/_profiler.o -std=c++11
#8 4.219       In file included from src/heap.h:12,
#8 4.219                        from src/_profiler.cc:7:
#8 4.219       src/spinlock.h: In member function ‘void SpinLock::lock()’:
#8 4.219       src/spinlock.h:30:9: error: ‘__builtin_ia32_pause’ was not declared in this scope; did you mean ‘__builtin_iswspace’?
#8 4.219          30 |         __builtin_ia32_pause();
#8 4.219             |         ^~~~~~~~~~~~~~~~~~~~
#8 4.219             |         __builtin_iswspace
#8 4.219       error: command '/usr/bin/gcc' failed with exit code 1
#8 4.219       [end of output]
#8 4.219   
#8 4.219   note: This error originates from a subprocess, and is likely not a problem with pip.
#8 4.221 error: legacy-install-failure
#8 4.221 
#8 4.221 × Encountered error while trying to install package.
#8 4.221 ╰─> mprofile

I don't know much about this problem, but a workaround I've found is to change the initial container image to
FROM --platform=linux/amd64 python:3.9-slim
as it usually defaults to aarch64.
There's also this DOCKER_DEFAULT_PLATFORM=linux/amd64

I felt compelled to document and share this.

@jwmay2012
Copy link
Author

Well. I'm trying to use pypprof for a Django application and apparently my 'fix' --platform=linux/amd64 breaks Django completely in the local environment.

Does anyone have any ideas on how to get this compiling in aarch64?

Thanks

simonswine added a commit to simonswine/phlare that referenced this issue Nov 22, 2022
The python example only works on linux/amd64 or at least linux/arm64 is
not supported. Also see timpalpant/mprofile#3.
@SergeyPoznyakAkvelon
Copy link

Opened a PR to fix this #5. I haven't tested it too much yet, so please use with caution.

simonswine added a commit to simonswine/pyroscope that referenced this issue Jun 30, 2023
The python example only works on linux/amd64 or at least linux/arm64 is
not supported. Also see timpalpant/mprofile#3.
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

2 participants