Build error for Python 3.7 on two different projects

Hi folks,

I updated the readme of two of my python projects on Github and the triggered buildings from Travis CI were both failed under Python 3.7. Other buildings under Python 3.X were passed. Here is a snippet of the error message:

Preparing metadata ( ... error
  error: subprocess-exited-with-error
  × python egg_info did not run successfully.
  │ exit code: 1
  ╰─> [22 lines of output]
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 14, in <module>
        File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/setuptools/", line 18, in <module>
          from setuptools.dist import Distribution
        File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/setuptools/", line 34, in <module>
          from ._importlib import metadata
        File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/setuptools/", line 28, in <module>
        File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/setuptools/", line 12, in disable_importlib_metadata_finder
          import importlib_metadata
        File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/importlib_metadata/", line 471, in <module>
          __version__ = version(__name__)
        File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/importlib_metadata/", line 438, in version
          return distribution(package).version
        File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/importlib_metadata/", line 411, in distribution
          return Distribution.from_name(package)
        File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/importlib_metadata/", line 179, in from_name
          dists = resolver(name)
        File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/", line 886, in find_distributions
          found = self._search_paths(, context.path)
      AttributeError: 'str' object has no attribute 'name'
      [end of output]
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Here is the link for the failed build.

Does anyone know how to resolve this issue? Many thanks!

Hiya- this is the same issue I am having here: Build errors installing a common dependency (docopt) on python 3.7 but not other versions - #4 by mustafa

It appears to have something to do with importlib_metadata, but I don’t know anything about that package. I am not sure what triggers it to be installed or used, but you can see that I had the same error. also on 3.7 only.

In fact, pip install -U importlib_metadata solved the problem for me

Thanks for your answer! the error message is informative, I did not check its detail.