Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Import error when building the docker image #16

Open
Wartz opened this issue Feb 14, 2017 · 1 comment
Open

Import error when building the docker image #16

Wartz opened this issue Feb 14, 2017 · 1 comment

Comments

@Wartz
Copy link

Wartz commented Feb 14, 2017

mac OS sierra
Python 3.5.2
Docker 1.13.1

One of the dependencies for slackclient in requirements.txt is setuptools. The docker build skips over installing it and then fails with the following error.

Found existing installation: setuptools 3.3
    Not uninstalling setuptools at /usr/lib/python3/dist-packages, owned by OS
  Running setup.py install for simplegeneric
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python3.4/dist-packages/setuptools/__init__.py", line 12, in <module>
        import setuptools.version
      File "/usr/local/lib/python3.4/dist-packages/setuptools/version.py", line 1, in <module>
        import pkg_resources
      File "/usr/local/lib/python3.4/dist-packages/pkg_resources/__init__.py", line 70, in <module>
        import packaging.version
    ImportError: No module named 'packaging'
    Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/simplegeneric/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-su8foqsj-record/install-record.txt --single-version-externally-managed --compile:
    Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/usr/local/lib/python3.4/dist-packages/setuptools/__init__.py", line 12, in <module>

    import setuptools.version

  File "/usr/local/lib/python3.4/dist-packages/setuptools/version.py", line 1, in <module>

    import pkg_resources

  File "/usr/local/lib/python3.4/dist-packages/pkg_resources/__init__.py", line 70, in <module>

    import packaging.version

ImportError: No module named 'packaging'

I got around the error by adding

RUN pip3 install setuptools==33.1.1

to requirements.txt above the line

RUN pip3 install -r /tmp/requirements.txt

The build works with setup tools 33.x, but not 34.x. I'm not sure if this is a bug on the part of this app or setup tools. vOv.

@vpontis
Copy link

vpontis commented May 8, 2017

I think this is caused by an old version of pip re pypa/setuptools#937

I made this change to Dockerfile:

diff --git a/Dockerfile b/Dockerfile
index 01f32e5..ee00f65 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -27,7 +27,9 @@ RUN apt-get update && \
 
 RUN mkdir -p /tmp
 COPY requirements.txt /tmp/requirements.txt
+RUN pip3 install -U pip
 RUN pip install -r /tmp/requirements.txt
 
 COPY deployment/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
 RUN mkdir -p /opt/wwc

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants