question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

importlib_metadata breaks TravisCI builds

See original GitHub issue

Hi all,

I’ve noticed my builds started to fail because importlib_metadata couldn’t not be found by pluggy:

Here is an example https://travis-ci.org/chaostoolkit-incubator/chaostoolkit-aws/jobs/529280278

running build_ext
Traceback (most recent call last):
  File "setup.py", line 97, in <module>
    main()
  File "setup.py", line 93, in main
    setuptools.setup(**setup_params)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/opt/python/3.6.3/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/opt/python/3.6.3/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/opt/python/3.6.3/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/pytest_runner-4.4-py3.6.egg/ptr.py", line 190, in run
    return self.run_tests()
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/pytest_runner-4.4-py3.6.egg/ptr.py", line 201, in run_tests
    result_code = __import__('pytest').main()
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/pytest-4.4.1-py3.6.egg/pytest.py", line 7, in <module>
    from _pytest.assertion import register_assert_rewrite
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/pytest-4.4.1-py3.6.egg/_pytest/assertion/__init__.py", line 12, in <module>
    from _pytest.assertion import rewrite
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/pytest-4.4.1-py3.6.egg/_pytest/assertion/rewrite.py", line 23, in <module>
    from _pytest.assertion import util
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/pytest-4.4.1-py3.6.egg/_pytest/assertion/util.py", line 10, in <module>
    import _pytest._code
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/pytest-4.4.1-py3.6.egg/_pytest/_code/__init__.py", line 6, in <module>
    from .code import Code  # noqa
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/pytest-4.4.1-py3.6.egg/_pytest/_code/code.py", line 15, in <module>
    import pluggy
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/pluggy-0.10.0-py3.6.egg/pluggy/__init__.py", line 16, in <module>
    from .manager import PluginManager, PluginValidationError
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/pluggy-0.10.0-py3.6.egg/pluggy/manager.py", line 6, in <module>
    import importlib_metadata
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/importlib_metadata-0.9-py3.6.egg/importlib_metadata/__init__.py", line 20, in <module>
    __version__ = version(__name__)
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/importlib_metadata-0.9-py3.6.egg/importlib_metadata/api.py", line 348, in version
    return distribution(package).version
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/importlib_metadata-0.9-py3.6.egg/importlib_metadata/api.py", line 313, in distribution
    return Distribution.from_name(package)
  File "/home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/importlib_metadata-0.9-py3.6.egg/importlib_metadata/api.py", line 160, in from_name
    raise PackageNotFoundError(name)
importlib_metadata.api.PackageNotFoundError: importlib_metadata

It happens on Python 3.6 and 3.7, but not on 3.5 because, on that one, pytest (which imports pluggy) remains on an older version.

But then again, I’m confused because, importlib_metadata is indeed installed first:

Searching for pluggy>=0.9
Reading https://pypi.python.org/simple/pluggy/
Downloading https://files.pythonhosted.org/packages/57/ba/54c93ac55084bde8f9195ed5cd04223b3c0d30d300801bf556565cb7675a/pluggy-0.10.0-py2.py3-none-any.whl#sha256=1c0b297d4d41bc9bdfbdc17991b35f9e1d2cfe8eaa4d7c118e86d705870d34c8
Best match: pluggy 0.10.0
Processing pluggy-0.10.0-py2.py3-none-any.whl
Installing pluggy-0.10.0-py2.py3-none-any.whl to /home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs
writing requirements to /home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/pluggy-0.10.0-py3.6.egg/EGG-INFO/requires.txt
Installed /home/travis/build/chaostoolkit-incubator/chaostoolkit-aws/.eggs/pluggy-0.10.0-py3.6.egg

Bizarrely, I fail to reproduce locally.

I’m wondering if this is something you folks have run into by any chance? Likely on my side but I fail to figure out what’s different.

Thanks for any tips!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:25 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
asottilecommented, May 7, 2019

0.11.0 has been released – sorry again for the breakage!

I’ll be following up with documenting how to avoid eggs in setup.py test for pytest and perhaps even implementing egg support in importlib-metadata.

2reactions
RonnyPfannschmidtcommented, May 7, 2019

@asottile i bevel this makes importlib-metadata a absolutely breaking change until that’s sorted out

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't deploy to PyPI anymore: pkg_resources ...
I face this issue on .com. Did anyone ported / deployed the fix to .com? Here is the broken build https://travis-ci.com/github/ets-labs ...
Read more >
Common Build Problems - Travis CI Docs
Common Build Problems. My tests broke but were working yesterday; My build script is killed without any error; My build fails unexpectedly; Segmentation...
Read more >
apache/openwhisk-runtime-python - Travis CI
Script to build docker images locally * add license header * Refactor tutorial. Refactoring structure of the tutorial for ease of ...
Read more >
Travis CI Tutorial
1) Travis CI's system synchronizes certain metadata with GitHub. · 2) In order to run builds, Travis CI's system clones a repository, from...
Read more >
Building a Python Project - Travis CI Docs
Clear, 12.04, 14.04, 16.04, 18.04, 20.04, 22.04 Clear, aarch64, ppc64le, s390x, x86_64 Release Arch Na... 12.04 x86_64 pyp... 12.04 x86_64 pyp...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found