Python build error: ERROR: Could not install packages due to an OSError.

When we build a Python application Docker image using the requirements.txt file we may get the error message like this

Processing /private/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_477u68wvzm/croot/certifi_1671487773341/work/certifi

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: ‘/private/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_477u68wvzm/croot/certifi_1671487773341/work/certifi’


The requirements.tx file contains the following line

certifi @ file:///private/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_477u68wvzm/croot/certifi_1671487773341/work/certifi


Comment out the line in the requirements.txt file with a hash

# certifi @ file:///private/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_477u68wvzm/croot/certifi_1671487773341/work/certifi

If you regenerate the requirements.txt file with the
pip freeze > requirements.txt
command, make sure to comment the line out again before you build the next Docker image of your Python application.

Leave a comment

Your email address will not be published. Required fields are marked *