Skip to content
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

Getting ImportError: cannot import name 'splat' with setuptools 75.0.0 #190

Open
sschuberth opened this issue Sep 17, 2024 · 2 comments
Open

Comments

@sschuberth
Copy link
Contributor

sschuberth commented Sep 17, 2024

We started to see this in ORT:

    java.io.IOException: Running 'python-inspector --python-version 311 --operating-system linux --json-pdt /tmp/ort-PythonInspector15711813311588694259/python-inspector5969974550712099055.json --requirement /workspace/plugins/package-managers/python/src/funTest/assets/projects/synthetic/python-inspector-no-analyze-setup-py/requirements.txt --verbose' in '/workspace/plugins/package-managers/python/src/funTest/assets/projects/synthetic/python-inspector-no-analyze-setup-py' failed with exit code 1:
    Traceback (most recent call last):
      File "/opt/python/versions/3.11.9/bin/python-inspector", line 8, in <module>
        sys.exit(resolve_dependencies())
                 ^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/python/versions/3.11.9/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
        return self.main(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/python/versions/3.11.9/lib/python3.11/site-packages/click/core.py", line 1078, in main
        rv = self.invoke(ctx)
             ^^^^^^^^^^^^^^^^
      File "/opt/python/versions/3.11.9/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
        return ctx.invoke(self.callback, **ctx.params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/python/versions/3.11.9/lib/python3.11/site-packages/click/core.py", line 783, in invoke
        return __callback(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/python/versions/3.11.9/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
        return f(get_current_context(), *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/python/versions/3.11.9/lib/python3.11/site-packages/python_inspector/resolve_cli.py", line 224, in resolve_dependencies
        from python_inspector.api import resolve_dependencies as resolver_api
      File "/opt/python/versions/3.11.9/lib/python3.11/site-packages/python_inspector/api.py", line 33, in <module>
        from python_inspector.package_data import get_pypi_data_from_purl
      File "/opt/python/versions/3.11.9/lib/python3.11/site-packages/python_inspector/package_data.py", line 22, in <module>
        from python_inspector.resolution import get_python_version_from_env_tag
      File "/opt/python/versions/3.11.9/lib/python3.11/site-packages/python_inspector/resolution.py", line 41, in <module>
        from python_inspector.setup_py_live_eval import iter_requirements
      File "/opt/python/versions/3.11.9/lib/python3.11/site-packages/python_inspector/setup_py_live_eval.py", line 21, in <module>
        import distutils.core
      File "/opt/python/versions/3.11.9/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 13, in <module>
        from .cmd import Command
      File "/opt/python/versions/3.11.9/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 12, in <module>
        from . import _modified, archive_util, dir_util, file_util, util
      File "/opt/python/versions/3.11.9/lib/python3.11/site-packages/setuptools/_distutils/_modified.py", line 6, in <module>
        from jaraco.functools import splat
    ImportError: cannot import name 'splat' from 'jaraco.functools' (/opt/python/versions/3.11.9/lib/python3.11/site-packages/jaraco/functools.py)

Is this a known issue with Python 3.11.9?

@sschuberth
Copy link
Contributor Author

BTW, this is for PI version 0.10.0 which we're still stuck on due to this regression.

@sschuberth
Copy link
Contributor Author

sschuberth commented Sep 20, 2024

As @mnonnenmacher found out, this seemingly is related to setuptools 75.0.0 adding jaraco.collections.

@sschuberth sschuberth changed the title Getting ImportError: cannot import name 'splat' with Python 3.11.9 Getting ImportError: cannot import name 'splat' with setuptools 75.0.0 Sep 20, 2024
mnonnenmacher added a commit to oss-review-toolkit/ort that referenced this issue Sep 20, 2024
Version 75.0.0 of setuptools adds a dependency on jaraco.collections [1]
which causes the following error when running python-inspector [2]:

    ImportError: cannot import name 'splat' from 'jaraco.functools'

[1]: https://setuptools.pypa.io/en/latest/history.html#v75-0-0
[2]: aboutcode-org/python-inspector#190

Signed-off-by: Martin Nonnenmacher <[email protected]>
sschuberth pushed a commit to oss-review-toolkit/ort that referenced this issue Sep 20, 2024
Version 75.0.0 of setuptools adds a dependency on jaraco.collections [1]
which causes the following error when running python-inspector [2]:

    ImportError: cannot import name 'splat' from 'jaraco.functools'

[1]: https://setuptools.pypa.io/en/latest/history.html#v75-0-0
[2]: aboutcode-org/python-inspector#190

Signed-off-by: Martin Nonnenmacher <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant