-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModuleNotFoundError: No module named 'setuptools_scm._integration' #145
Comments
Hmm okay this is useful: running just the external project tests ( $ tox -e py312 --force-dep setuptools==66.1 --force-dep setuptools_scm==3.4.1 --force-dep typing-extensions==4 -- 'tests/distribution/test_distribution_packages.py::TestExternalProject' --tb=no --runxfail
.pkg-cpython312: _optional_hooks> python /home/diazona/.local/pipx/venvs/tox/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg-cpython312: get_requires_for_build_editable> python /home/diazona/.local/pipx/venvs/tox/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg-cpython312: build_editable> python /home/diazona/.local/pipx/venvs/tox/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
py312: install_package> python -I -m pip install --force-reinstall --no-deps /home/diazona/programming/setuptools-pyproject-migration/.tox/.tmp/package/400/setuptools_pyproject_migration-0.1.1.dev71+g43d9538-0.editable-py3-none-any.whl
py312: commands[0]> pytest tests/distribution/test_distribution_packages.py::TestExternalProject --tb=no --runxfail
=================================================================================================================== test session starts ====================================================================================================================
platform linux -- Python 3.12.1, pytest-7.4.3, pluggy-1.3.0 -- /home/diazona/programming/setuptools-pyproject-migration/.tox/py312/bin/python
cachedir: .tox/py312/.pytest_cache
rootdir: /home/diazona/programming/setuptools-pyproject-migration
configfile: pytest.ini
plugins: console-scripts-1.4.1, cov-4.1.0, enabler-3.0.0
collected 42 items
tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[pytest==7.3.0] ERROR [ 2%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_version[pytest==7.3.0] ERROR [ 4%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_description[pytest==7.3.0] ERROR [ 7%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_license[pytest==7.3.0] ERROR [ 9%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_readme[pytest==7.3.0] ERROR [ 11%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_requires_python[pytest==7.3.0] ERROR [ 14%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_dependencies[pytest==7.3.0] ERROR [ 16%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_optional_dependencies[pytest==7.3.0] ERROR [ 19%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_authors[pytest==7.3.0] ERROR [ 21%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_maintainers[pytest==7.3.0] ERROR [ 23%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_urls[pytest==7.3.0] ERROR [ 26%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_classifiers[pytest==7.3.0] ERROR [ 28%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_keywords[pytest==7.3.0] ERROR [ 30%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_dynamic[pytest==7.3.0] ERROR [ 33%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[pytest-localserver==0.8.0] ERROR [ 35%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_version[pytest-localserver==0.8.0] ERROR [ 38%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_description[pytest-localserver==0.8.0] ERROR [ 40%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_license[pytest-localserver==0.8.0] ERROR [ 42%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_readme[pytest-localserver==0.8.0] ERROR [ 45%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_requires_python[pytest-localserver==0.8.0] ERROR [ 47%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_dependencies[pytest-localserver==0.8.0] ERROR [ 50%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_optional_dependencies[pytest-localserver==0.8.0] ERROR [ 52%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_authors[pytest-localserver==0.8.0] ERROR [ 54%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_maintainers[pytest-localserver==0.8.0] ERROR [ 57%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_urls[pytest-localserver==0.8.0] ERROR [ 59%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_classifiers[pytest-localserver==0.8.0] ERROR [ 61%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_keywords[pytest-localserver==0.8.0] ERROR [ 64%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_dynamic[pytest-localserver==0.8.0] ERROR [ 66%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[aioax25==0.0.11.post0] ERROR [ 69%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_version[aioax25==0.0.11.post0] ERROR [ 71%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_description[aioax25==0.0.11.post0] ERROR [ 73%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_license[aioax25==0.0.11.post0] ERROR [ 76%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_readme[aioax25==0.0.11.post0] ERROR [ 78%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_requires_python[aioax25==0.0.11.post0] ERROR [ 80%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_dependencies[aioax25==0.0.11.post0] ERROR [ 83%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_optional_dependencies[aioax25==0.0.11.post0] ERROR [ 85%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_authors[aioax25==0.0.11.post0] ERROR [ 88%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_maintainers[aioax25==0.0.11.post0] ERROR [ 90%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_urls[aioax25==0.0.11.post0] ERROR [ 92%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_classifiers[aioax25==0.0.11.post0] ERROR [ 95%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_keywords[aioax25==0.0.11.post0] ERROR [ 97%]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_dynamic[aioax25==0.0.11.post0] ERROR [100%]
===================================================================================================================== warnings summary =====================================================================================================================
tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[pytest==7.3.0]
/home/diazona/programming/setuptools-pyproject-migration/test_support/test_support/distribution.py:446: UserWarning: No hash available for pytest==7.3.0
warnings.warn(f"No hash available for {self._distribution.package_spec}")
tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[pytest==7.3.0]
/home/diazona/programming/setuptools-pyproject-migration/.tox/py312/lib/python3.12/site-packages/setuptools/config/setupcfg.py:515: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[pytest==7.3.0]
/home/diazona/programming/setuptools-pyproject-migration/.tox/py312/lib/python3.12/site-packages/setuptools/dist.py:885: UserWarning: Module setuptools_scm was already imported from /home/diazona/programming/setuptools-pyproject-migration/.tox/py312/lib/python3.12/site-packages/setuptools_scm/__init__.py, but /tmp/pytest-of-diazona/pytest-150/pytest==7.3.00/project/pytest-7.3.0/.eggs/setuptools_scm-8.0.4-py3.12.egg is being added to sys.path
pkg_resources.working_set.add(dist, replace=True)
tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[pytest-localserver==0.8.0]
<string>:10: EncodingWarning: 'encoding' argument not specified
tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[pytest-localserver==0.8.0]
<string>:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/pytest-of-diazona/pytest-150/pytest-localserver==0.8.00/project/pytest-localserver-0.8.0/README.rst' mode='r' encoding='UTF-8'>
Enable tracemalloc to get traceback where the object was allocated.
See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[aioax25==0.0.11.post0]
<string>:30: EncodingWarning: 'encoding' argument not specified
tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[aioax25==0.0.11.post0]
<string>:30: ResourceWarning: unclosed file <_io.TextIOWrapper name='README.md' mode='r' encoding='UTF-8'>
Enable tracemalloc to get traceback where the object was allocated.
See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
---------- coverage: platform linux, python 3.12.1-final-0 -----------
Name Stmts Miss Cover Missing
-----------------------------------------------------------------------------------------------------------------------------------------
/tmp/pytest-of-diazona/pytest-150/aioax25==0.0.11.post00/project/aioax25-0.0.11.post0/aioax25/__init__.py 5 0 100%
src/setuptools_pyproject_migration/__init__.py 155 119 23% 47-51, 69-77, 116-127, 135, 138, 153-157, 181-192, 226-241, 248-396, 403
test_support/test_support/__init__.py 77 29 62% 23-24, 68, 112-123, 132, 141-147, 159-162, 176-177, 186, 205-207, 220-222
test_support/test_support/distribution.py 277 39 86% 35-46, 51-52, 67, 87, 125, 132, 138, 176, 311-314, 350, 356-357, 361, 412-413, 447-448, 472, 507, 509, 515-516, 536-540, 558-559, 564-567, 570-572, 592
test_support/test_support/metadata.py 135 30 78% 15-18, 23-41, 53, 58-60, 63, 65, 110, 121, 123, 136, 147, 176, 184, 199, 210-211, 215, 222
-----------------------------------------------------------------------------------------------------------------------------------------
TOTAL 649 217 67%
================================================================================================================= short test summary info ==================================================================================================================
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_version[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_description[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_license[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_readme[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_requires_python[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_dependencies[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_optional_dependencies[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_authors[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_maintainers[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_urls[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_classifiers[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_keywords[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_dynamic[pytest==7.3.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_version[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_description[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_license[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_readme[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_requires_python[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_dependencies[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_optional_dependencies[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_authors[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_maintainers[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_urls[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_classifiers[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_keywords[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_dynamic[pytest-localserver==0.8.0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_version[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_description[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_license[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_readme[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_requires_python[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_dependencies[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_optional_dependencies[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_authors[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_maintainers[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_urls[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_classifiers[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_keywords[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
ERROR tests/distribution/test_distribution_packages.py::TestExternalProject::test_dynamic[aioax25==0.0.11.post0] - ModuleNotFoundError: No module named 'setuptools_scm._integration'
============================================================================================================= 7 warnings, 42 errors in 10.21s ==============================================================================================================
py312: exit 1 (11.69 seconds) /home/diazona/programming/setuptools-pyproject-migration> pytest tests/distribution/test_distribution_packages.py::TestExternalProject --tb=no --runxfail pid=7202
.pkg-cpython312: _exit> python /home/diazona/.local/pipx/venvs/tox/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
py312: FAIL code 1 (12.85=setup[1.16]+cmd[11.69] seconds)
evaluation failed :( (12.95 seconds) |
If I run just one test, this warning shows up in the output - I have a feeling it might be related, at least indirectly (in the sense that it indicates how the packages under test are messing with the import system): $ tox -e py312 --force-dep setuptools==66.1 --force-dep setuptools_scm==3.4.1 --force-dep typing-extensions==4 -- 'tests/distribution/test_distribution_packages.py::TestExternalProject' --exitfirst --runxfail
[...]
-------------------------------------------------------------------------------------------------------------------- Captured log setup --------------------------------------------------------------------------------------------------------------------
[...]
tests/distribution/test_distribution_packages.py::TestExternalProject::test_name[pytest==7.3.0]
/home/diazona/programming/setuptools-pyproject-migration/.tox/py312/lib/python3.12/site-packages/setuptools/dist.py:885: UserWarning: Module setuptools_scm was already imported from /home/diazona/programming/setuptools-pyproject-migration/.tox/py312/lib/python3.12/site-packages/setuptools_scm/__init__.py, but /tmp/pytest-of-diazona/pytest-152/pytest==7.3.00/project/pytest-7.3.0/.eggs/setuptools_scm-8.0.4-py3.12.egg is being added to sys.path
pkg_resources.working_set.add(dist, replace=True) |
I still can't account for why the |
Aha, I found something by loading up the debugger when this failure occurs:
Evidently the pytest installation includes an egg of setuptools_scm 8.0.4 (maybe just whatever happens to be the latest version) outside of the normal package installation system. And that egg includes the entry point causing the error: $ grep integration /tmp/pytest-of-diazona/pytest-166/pytest\=\=7.3.00/project/pytest-7.3.0/.eggs/setuptools_scm-8.0.4-py3.12.egg/EGG-INFO/entry_points.txt
use_scm_version = setuptools_scm._integration.setuptools:version_keyword
setuptools_scm = setuptools_scm._integration.setuptools:infer_version I suspect that when pytest's |
Here is a small script that reproduces the error in an isolated environment (should be run in an empty directory): #!/bin/bash
mkdir downloads
pushd downloads
curl 'https://files.pythonhosted.org:443/packages/2b/a6/22c1138c2a7b60c9eb9ddeac017d82a58dfd9661651c721e7466af648764/pytest-7.3.0.tar.gz' -O -fsSL
popd
python3.12 -m venv venv
source venv/bin/activate
python -m pip install packaging pep508-parser 'setuptools==66.1' 'setuptools_scm[toml]==3.4.1' tomlkit 'typing-extensions>=4,<5'
mkdir project
cd project
tar -zxf ../downloads/pytest-7.3.0.tar.gz
tree -a >../before.txt
cd pytest-7.3.0
python -c 'import distutils.core; distutils.core.run_setup("setup.py", script_args=["pyproject"], stop_after="commandline")'
tree -a >../../after.txt |
I've been looking into this in more detail and basically confirmed my earlier suspicion. An overview of what happens is:
What I take from all this is that we really shouldn't be trying to run pytest's setup script in an environment which already has an older version of setuptools-scm (or, really, any of its build dependencies) installed, because it will involve two different versions of the same package potentially clashing. So skipping the tests for pytest when the installed version of setuptools-scm is too old, as we do now, is the way to go, at least in the short term. I'm inclined to just leave that like it is for the 0.3 release. There are a couple of alternatives we could explore in the future:
TL;DR I think we should do nothing about this issue in version 0.3, and for a future release look into running distribution package tests using a virtual environment. That clears us up to release version 0.3 soon. @sjlongland any thoughts? |
@diazona That seems sane… I'm actually surprised Truly is a bizzare edge case. I'd be fine with shelving this until after v0.3. |
Oh it's not - I'm pretty confident at this point that |
Apparently this happens on Python versions less than 3.8 as well. (example). Which I guess makes more sense than it only happening on Python 3.12, but I'm kind of kicking myself for not having noticed that before. |
I'm seeing an error
ModuleNotFoundError: No module named 'setuptools_scm._integration'
when running the package distribution tests foraioax25
, but only under very specific circumstances: it only happens with Python 3.12, and only when running all the tests or some large subset of them - if I try to rerun with the specific tests that fail, the error doesn't show up.but
This originally showed up during a manual workflow run.
The text was updated successfully, but these errors were encountered: