ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: ‘…/certifi

During the building of a Docker container for a Python application we may get the following error message

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

This is caused by an out of date path in the requirements file for “certifi”. To fix the issue

  • Uninstall and reinstall certifi
pip uninstall certifi
pip install certifi
  • Regenerate the requirements.txt file
pip freeze > requirements.txt

Leave a comment

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