Home > Enterprise >  Trying to dockerize Django app, Docker cannot find ft2build.h
Trying to dockerize Django app, Docker cannot find ft2build.h

Time:11-22

I'm new to Docker and I'm trying to dockerize a Django app but when I run docker build -t sometag . I receive the following error:

#9 23.05   Preparing metadata (setup.py): started
#9 23.32   Preparing metadata (setup.py): finished with status 'error'
#9 23.33   error: subprocess-exited-with-error
#9 23.33
#9 23.33   × python setup.py egg_info did not run successfully.
#9 23.33   │ exit code: 1
#9 23.33   ╰─> [10 lines of output]
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: ================================================
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: Attempting build of _rl_accel
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: extensions from 'src/rl_addons/rl_accel'
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: ================================================
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: ===================================================
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: Attempting build of _renderPM
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: extensions from 'src/rl_addons/renderPM'
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: ===================================================
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: will use package libart 2.3.21
#9 23.33       !!!!! cannot find ft2build.h
#9 23.33       [end of output]
#9 23.33
#9 23.33   note: This error originates from a subprocess, and is likely not a problem with pip.
#9 23.33 error: metadata-generation-failed
#9 23.33
#9 23.33 × Encountered error while generating package metadata.
#9 23.33 ╰─> See above for output.
#9 23.33
#9 23.33 note: This is an issue with the package mentioned above, not pip.
#9 23.33 hint: See above for details.
------
executor failed running [/bin/sh -c pip install -r requirements.txt]: exit code: 1

I'm not sure if it is related to ft2build.h.I'm I missing something on my dockerfile?

This is my requirements.txt:

arabic-reshaper==2.1.3
asn1crypto==1.5.1
attrs==20.3.0
azure-core==1.23.1
azure-storage-blob==12.11.0
certifi==2021.10.8
cffi==1.15.0
charset-normalizer==2.0.12
click==8.1.2
colorama==0.4.4
cryptography==36.0.2
cssselect2==0.5.0
distlib==0.3.5
Django==4.0.3
django-crispy-forms==1.14.0
django-storages==1.12.3
djangorestframework==3.14.0
filelock==3.8.0
future==0.18.2
html5lib==1.1
idna==3.3
isodate==0.6.1
jellyfish==0.9.0
lib50==3.0.4
lxml==4.8.0
markdown2==2.4.2
msrest==0.6.21
oauthlib==3.2.0
oscrypto==1.3.0
pexpect==4.8.0
Pillow==9.1.0
platformdirs==2.5.2
psycopg2-binary==2.9.3
ptyprocess==0.7.0
pycparser==2.21
pyHanko==0.12.1
pyhanko-certvalidator==0.19.5
PyPDF2==1.27.3
PyPDF3==1.0.6
python-bidi==0.4.2
pytz==2022.1
PyYAML==5.4.1
qrcode==7.3.1
reportlab==3.6.9
requests==2.27.1
requests-oauthlib==1.3.1
six==1.16.0
submit50==3.1.1
svglib==1.2.1
termcolor==1.1.0
tinycss2==1.1.1
tk==0.1.0
tqdm==4.64.0
typing_extensions==4.1.1
tzdata==2022.1
tzlocal==4.2
uritools==4.0.0
urllib3==1.26.9
virtualenv==20.16.3
webencodings==0.5.1
whitenoise==6.0.0
xhtml2pdf==0.2.7

Note: I had to remove the dockerfile as Stackoverflow wouldn't allow me to publish so much code but I'm running this RUN apk update \&& apk add --no-cache gcc musl-dev postgresql-dev python3-dev libffi-dev \&& pip install --upgrade pip

CodePudding user response:

I'm not sure if it is related to ft2build.h.I'm I missing something on my dockerfile?

To solve the problem with the error ft2build.h. in the compile process, you need the freetype library installed

I assume you are using the last version of Alpine, and I can see you can install pip packages without problems.

As a result, the missing part should be the freetype-dev package to install.

RUN apk update \ 
 && apk add --no-cache gcc musl-dev postgresql-dev python3-dev libffi-dev freetype-dev\
  • Related