Skip to content

Commit

Permalink
Add temporary "escape hatch" envvar for setuptools v50.0.0
Browse files Browse the repository at this point in the history
Without this workaround we just started receiving the
following error during build now.

```
Traceback (most recent call last):
  File "manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
  File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 1, in <module>
    from django.utils.version import get_version
  File "/usr/local/lib/python3.5/dist-packages/django/utils/version.py", line 6, in <module>
    from distutils.version import LooseVersion
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "/usr/local/lib/python3.5/dist-packages/_distutils_hack/__init__.py", line 82, in create_module
    return importlib.import_module('._distutils', 'setuptools')
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 981, in _gcd_import
  File "<frozen importlib._bootstrap>", line 931, in _sanity_check
SystemError: Parent module 'setuptools' not loaded, cannot perform relative import
```

see [setuptools changelog](https://github.com/pypa/setuptools/blob/17cb9d6bf249cefe653d3bdb712582409035a7db/CHANGES.rst#v5000)
and this [setuptools issue](pypa/setuptools#2352) for
details
  • Loading branch information
jsugarman committed Sep 1, 2020
1 parent 8cc0ec2 commit 8e36145
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Expand Up @@ -55,6 +55,10 @@ ENV APP_GIT_COMMIT=${COMMIT_ID}
ENV APP_BUILD_DATE=${BUILD_DATE}
ENV APP_BUILD_TAG=${BUILD_TAG}

# temporary "escape hatch" for setuputools > 50.0
# https://github.com/pypa/setuptools/issues/2352
ENV SETUPTOOLS_USE_DISTUTILS=stdlib

# clearing data to prevent UNIQUE constraint violations when rebuilding locally, at least
RUN python3 manage.py migrate --no-input \
&& python3 manage.py cleardata \
Expand Down

0 comments on commit 8e36145

Please sign in to comment.