Running setup.py install for onigurumacffi did not run successfully.

이지훈·2022년 11월 22일
0

docker

목록 보기
2/2

m1에서 docker build를 하는데 빌드 실패가 계속해서 이뤄졌다.

#0 60.69   Running setup.py install for onigurumacffi: started
#0 61.73   Running setup.py install for onigurumacffi: finished with status 'error'
#0 61.77   error: subprocess-exited-with-error
#0 61.77
#0 61.77   × Running setup.py install for onigurumacffi did not run successfully.
#0 61.77   │ exit code: 1
#0 61.77   ╰─> [22 lines of output]
#0 61.77       /usr/local/lib/python3.9/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
#0 61.77         warnings.warn(msg, warning_class)
#0 61.77       running install
#0 61.77       /usr/local/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
#0 61.77         warnings.warn(
#0 61.77       running build
#0 61.77       running build_py
#0 61.77       creating build
#0 61.77       creating build/lib.linux-aarch64-cpython-39
#0 61.77       copying onigurumacffi.py -> build/lib.linux-aarch64-cpython-39
#0 61.77       running build_ext
#0 61.77       generating cffi module 'build/temp.linux-aarch64-cpython-39/_onigurumacffi.c'
#0 61.77       creating build/temp.linux-aarch64-cpython-39
#0 61.77       building '_onigurumacffi' extension
#0 61.77       creating build/temp.linux-aarch64-cpython-39/build
#0 61.77       creating build/temp.linux-aarch64-cpython-39/build/temp.linux-aarch64-cpython-39
#0 61.77       gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.9 -c build/temp.linux-aarch64-cpython-39/_onigurumacffi.c -o build/temp.linux-aarch64-cpython-39/build/temp.linux-aarch64-cpython-39/_onigurumacffi.o
#0 61.77       build/temp.linux-aarch64-cpython-39/_onigurumacffi.c:569:10: fatal error: oniguruma.h: No such file or directory
#0 61.77         569 | #include <oniguruma.h>
#0 61.77             |          ^~~~~~~~~~~~~
#0 61.77       compilation terminated.
#0 61.77       error: command '/usr/bin/gcc' failed with exit code 1
#0 61.77       [end of output]
#0 61.77
#0 61.77   note: This error originates from a subprocess, and is likely not a problem with pip.
#0 61.78 error: legacy-install-failure
#0 61.78
#0 61.78 × Encountered error while trying to install package.
#0 61.78 ╰─> onigurumacffi
#0 61.78
#0 61.78 note: This is an issue with the package mentioned above, not pip.
#0 61.78 hint: See above for output from the failure.
------
error: failed to solve: executor failed running [/bin/sh -c pip3 install -r file.txt]: exit code: 1

첫번째.

error: command '/usr/bin/gcc' failed with exit code 1

여기에 집중을 했고. dockerfile에 다음과 같이 추가했다.
https://linuxtect.com/the-error-command-gcc-failed-with-exit-status-1-error-and-solution/

RUN sudo apt-get install -y build-essential libssl-dev libffi-dev python3-dev gcc

그래도 실패였다.


그래서 다음은 No package ‘oniguruma’ found를 보았다.
https://www.kua.kr/103

공식문서에서 to build from source, libonig-dev must be installed prior to installation
라고 필수적으로 설치하라고 한다.

RUN sudo apt-get install -y libonig-dev

위를 추가했는데도 에러가 똑같았다.


3번째
그래서 마지막으로 이걸 추가했다.
왜냐면 error: legacy-install-failure 를 봤기 때문이다.

https://www.pythonpool.com/error-legacy-install-failure/

RUN python3 -m pip install --upgrade pip
RUN pip3 install --upgrade setuptools
RUN pip3 install --upgrade wheel

성공~

도커파일은 다음과 같다.

FROM python:3.9.13

RUN mkdir -p /home/ubuntu/mysite
WORKDIR /home/ubuntu/mysite

COPY package-file.txt /home/ubuntu/mysite/package-file.txt

RUN apt-get -y update && apt-get install -y \
sudo \
wget \
libgl1-mesa-glx

RUN apt-get install libxml2-utils

RUN pip3 install wheel
RUN pip3 install uwsgi
RUN pip3 install --ignore-installed PyYAML
RUN sudo apt-get install -y build-essential libssl-dev libffi-dev python3-dev gcc

RUN python3 -m pip install --upgrade pip
RUN pip3 install --upgrade setuptools
RUN pip3 install --upgrade wheel
RUN sudo apt-get install -y libonig-dev

RUN pip3 install -r package-file.txt

COPY . .

RUN pip3 install -r new-package.txt


EXPOSE 8000
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
profile
꾸준하게 🐌

0개의 댓글