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.

[Forward compatibility][BUG] pkg_resources.extern.VendorImporter lacks find_spec() method

See original GitHub issue

setuptools version

54.1.2 and main

Python version

3.10.0a7

OS

All

Additional environment information

When running tests for setuptools_scm.

Description

We get:

<frozen importlib._bootstrap>:933: in _find_spec
    ???
E   AttributeError: 'VendorImporter' object has no attribute 'find_spec'

During handling of the above exception, another exception occurred:
/usr/lib/python3.10/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3.10/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3.10/site-packages/pluggy/manager.py:84: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3.10/site-packages/_pytest/doctest.py:129: in pytest_collect_file
    elif _is_doctest(config, path, parent):
/usr/lib/python3.10/site-packages/_pytest/doctest.py:147: in _is_doctest
    if path.check(fnmatch=glob):
/usr/lib/python3.10/site-packages/py/_path/local.py:387: in check
    return super(LocalPath, self).check(**kw)
/usr/lib/python3.10/site-packages/py/_path/common.py:241: in check
    return self.Checkers(self)._evaluate(kw)
/usr/lib/python3.10/site-packages/py/_path/common.py:108: in _evaluate
    if py.code.getrawcode(meth).co_argcount > 1:
/usr/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py:152: in __makeattr
    result = importobj(modpath, attrname)
/usr/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py:72: in importobj
    module = __import__(modpath, None, None, ['__doc__'])
/usr/lib/python3.10/site-packages/py/_code/code.py:7: in <module>
    reprlib = py.builtin._tryimport('repr', 'reprlib')
/usr/lib/python3.10/site-packages/py/_builtin.py:144: in _tryimport
    __import__(name)
<frozen importlib._bootstrap>:1021: in _find_and_load
    ???
<frozen importlib._bootstrap>:996: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _find_spec
    ???
<frozen importlib._bootstrap>:908: in _find_spec_legacy
    ???
E   ImportWarning: VendorImporter.find_spec() not found; falling back to find_module()

The traceback is not very helpful, but the VendorImporter is from pkg_resourecs.

Python added a warning: https://bugs.python.org/issue42134 but other packages treat it as error.

Expected behavior

No ImportWarning.

How to Reproduce

  1. Get Python 3.10.0a7 and tox (e.g. on Fedora via $ sudo dnf --enablerepo=updates-testing install python3.10 tox)
  2. git clone https://github.com/pypa/setuptools_scm.git and cd in
  3. Run tox -e py310-test

Output

py310-test develop-inst-nodeps: .../setuptools_scm
py310-test installed: attrs==20.3.0,iniconfig==1.1.1,packaging==20.9,pluggy==0.13.1,py==1.10.0,pyparsing==2.4.7,pytest==6.2.3,-e git+https://github.com/pypa/setuptools_scm.git@abb67b15985f380d8cf4451b9f2ef3dd11cb8a91#egg=setuptools_scm,toml==0.10.2
py310-test run-test-pre: PYTHONHASHSEED='1426720794'
py310-test run-test: commands[0] | pytest
============================= test session starts ==============================
platform linux -- Python 3.10.0a7, pytest-6.2.3, py-1.10.0, pluggy-0.13.1
cachedir: .tox/py310-test/.pytest_cache
setuptools version 53.0.0 from '.../setuptools_scm/.tox/py310-test/lib/python3.10/site-packages/setuptools/__init__.py'
setuptools_scm version 6.0.1 from '.../setuptools_scm/src/setuptools_scm/__init__.py'
rootdir: .../setuptools_scm, configfile: tox.ini, testpaths: testing
collected 0 items / 1 error

==================================== ERRORS ====================================
________________________ ERROR collecting test session _________________________
<frozen importlib._bootstrap>:933: in _find_spec
    ???
E   AttributeError: 'VendorImporter' object has no attribute 'find_spec'

During handling of the above exception, another exception occurred:
.tox/py310-test/lib/python3.10/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
.tox/py310-test/lib/python3.10/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
.tox/py310-test/lib/python3.10/site-packages/pluggy/manager.py:84: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
.tox/py310-test/lib/python3.10/site-packages/_pytest/doctest.py:129: in pytest_collect_file
    elif _is_doctest(config, path, parent):
.tox/py310-test/lib/python3.10/site-packages/_pytest/doctest.py:147: in _is_doctest
    if path.check(fnmatch=glob):
.tox/py310-test/lib/python3.10/site-packages/py/_path/local.py:387: in check
    return super(LocalPath, self).check(**kw)
.tox/py310-test/lib/python3.10/site-packages/py/_path/common.py:241: in check
    return self.Checkers(self)._evaluate(kw)
.tox/py310-test/lib/python3.10/site-packages/py/_path/common.py:108: in _evaluate
    if py.code.getrawcode(meth).co_argcount > 1:
.tox/py310-test/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py:152: in __makeattr
    result = importobj(modpath, attrname)
.tox/py310-test/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py:72: in importobj
    module = __import__(modpath, None, None, ['__doc__'])
.tox/py310-test/lib/python3.10/site-packages/py/_code/code.py:7: in <module>
    reprlib = py.builtin._tryimport('repr', 'reprlib')
.tox/py310-test/lib/python3.10/site-packages/py/_builtin.py:144: in _tryimport
    __import__(name)
<frozen importlib._bootstrap>:1021: in _find_and_load
    ???
<frozen importlib._bootstrap>:996: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _find_spec
    ???
<frozen importlib._bootstrap>:908: in _find_spec_legacy
    ???
E   ImportWarning: VendorImporter.find_spec() not found; falling back to find_module()
=========================== short test summary info ============================
ERROR  - ImportWarning: VendorImporter.find_spec() not found; falling back to...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.16s ===============================
ERROR: InvocationError for command .../setuptools_scm/.tox/py310-test/bin/pytest (exited with code 2)
___________________________________ summary ____________________________________
ERROR:   py310-test: commands failed

Code of Conduct

I agree to follow the PSF Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
webknjazcommented, Apr 8, 2021

@hroncok pro tip: you can mark code blocks that have tracebacks with python-traceback and they’ll be more colorful.

0reactions
webknjazcommented, Apr 8, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Forward compatibility][BUG] `pkg_resources.extern. ...
VendorImporter lacks exec_module [Forward compatibility][BUG] pkg_resources.extern.VendorImporter lacks exec_module() method on Dec 10, 2020.
Read more >
1911607 – python-setuptools fails to build with Python 3.10 ...
Github, pypa setuptools issues 2481, 0, None, closed, [Forward compatibility][BUG] `pkg_resources.extern.VendorImporter` lacks `exec_module()` method ...
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