Skip to content

Dockerfile build failed with pip/setuptools versioning issues #529

@sputnick1124

Description

@sputnick1124

Trying to build the docker container on an Ubuntu 16.04 laptop fails. All signs point to similar issues pypa/setuptools#937 and pypa/setuptools#942.

...
    
Downloading/unpacking py>=1.4.25 (from pytest==2.6.4->sbp==0.29)
Installing collected packages: setuptools, pyserial, pylibftdi, pyparsing, pygments, intelhex, construct, sbp, appdirs, six, packaging, cov-core, coverage, flake8, futures, pep8, pyftdi, pytest, pytest-cov, tox, virtualenv, pyflakes, mccabe, pyusb, py
  Found existing installation: setuptools 3.3
    Not uninstalling setuptools at /usr/lib/python2.7/dist-packages, owned by OS
  Running setup.py install for pyparsing
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 12, in <module>
        import setuptools.version
      File "/usr/local/lib/python2.7/dist-packages/setuptools/version.py", line 1, in <module>
        import pkg_resources
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 70, in <module>
        import packaging.version
    ImportError: No module named packaging.version
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/pyparsing/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-684ATU-record/install-record.txt --single-version-externally-managed --compile:
    Traceback (most recent call last):

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

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

    import setuptools.version

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

    import pkg_resources

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

    import packaging.version

ImportError: No module named packaging.version

Adding packaging and appdirs to the pip install list in the Dockerfile gets past that error and results in a different one.

...
Downloading/unpacking py>=1.4.25 (from pytest==2.6.4->sbp==0.29)
Installing collected packages: packaging, appdirs, setuptools, pyserial, pylibftdi, pyparsing, pygments, intelhex, construct, sbp, cov-core, coverage, flake8, futures, pep8, pyftdi, pytest, pytest-cov, tox, virtualenv, pyflakes, mccabe, pyusb, py
  Found existing installation: setuptools 3.3
    Not uninstalling setuptools at /usr/lib/python2.7/dist-packages, owned by OS
  Running setup.py install for pyparsing
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 12, in <module>
        import setuptools.version
      File "/usr/local/lib/python2.7/dist-packages/setuptools/version.py", line 1, in <module>
        import pkg_resources
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 72, in <module>
        import packaging.requirements
      File "/usr/local/lib/python2.7/dist-packages/packaging/requirements.py", line 59, in <module>
        MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
    TypeError: __call__() takes exactly 2 arguments (1 given)
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/pyparsing/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lFSM2q-record/install-record.txt --single-version-externally-managed --compile:
    Traceback (most recent call last):

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

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

    import setuptools.version

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

    import pkg_resources

  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 72, in <module>

    import packaging.requirements

  File "/usr/local/lib/python2.7/dist-packages/packaging/requirements.py", line 59, in <module>

    MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")

TypeError: __call__() takes exactly 2 arguments (1 given)

Upgrading pip in the container with RUN pip install --upgrade pip gets farther, but then fails similarly:

...
Collecting distribute==0.7.3 (from -r requirements.txt (line 3))
  Downloading distribute-0.7.3.zip (145kB)
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run
    wb.build(autobuilding=True)
  File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 634, in _prepare_file
    abstract_dist.prep_for_dist()
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 129, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 412, in run_egg_info
    self.setup_py, self.name,
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 387, in setup_py
    import setuptools  # noqa
  File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 12, in <module>
    import setuptools.version
  File "/usr/local/lib/python2.7/dist-packages/setuptools/version.py", line 1, in <module>
    import pkg_resources
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 72, in <module>
    import packaging.requirements
  File "/usr/local/lib/python2.7/dist-packages/packaging/requirements.py", line 59, in <module>
    MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 2

Any ideas what's going on?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions