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.

CI: Builds failing in ``pandas.show_versions()``

See original GitHub issue

Failing on all platofrms. E.g. https://github.com/pandas-dev/pandas/runs/4581277621

Run python -c "import pandas; pandas.show_versions();"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/runner/work/pandas/pandas/pandas/util/_print_versions.py", line 109, in show_versions
    deps = _get_dependency_info()
  File "/home/runner/work/pandas/pandas/pandas/util/_print_versions.py", line 88, in _get_dependency_info
    mod = import_optional_dependency(modname, errors="ignore")
  File "/home/runner/work/pandas/pandas/pandas/compat/_optional.py", line 115, in import_optional_dependency
    module = importlib.import_module(name)
  File "/opt/hostedtoolcache/Python/3.10.1/x64/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1002, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 945, in _find_spec
  File "/opt/hostedtoolcache/Python/3.10.1/x64/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 83, in find_spec
    return method()
  File "/opt/hostedtoolcache/Python/3.10.1/x64/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 104, in spec_for_pip
    if self.pip_imported_during_build():
  File "/opt/hostedtoolcache/Python/3.10.1/x64/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 115, in pip_imported_during_build
    return any(
  File "/opt/hostedtoolcache/Python/3.10.1/x64/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 116, in <genexpr>
    frame.f_globals['__file__'].endswith('setup.py')
KeyError: '__file__'
Error: Process completed with exit code 1.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
MarcoGorellicommented, Jan 29, 2022

Probably fine to just remove pip from the list of packages to print the version of then?

1reaction
phoflcommented, Dec 21, 2021

60.0.3 did not fix all problems for us unfortunately. When running this locally I get

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/testenv2/lib/python3.10/site-packages/pandas/util/_print_versions.py", line 109, in show_versions
    deps = _get_dependency_info()
  File "/tmp/testenv2/lib/python3.10/site-packages/pandas/util/_print_versions.py", line 88, in _get_dependency_info
    mod = import_optional_dependency(modname, errors="ignore")
  File "/tmp/testenv2/lib/python3.10/site-packages/pandas/compat/_optional.py", line 115, in import_optional_dependency
    module = importlib.import_module(name)
  File "/tmp/testenv2/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/tmp/testenv2/lib/python3.10/site-packages/setuptools/__init__.py", line 8, in <module>
    import _distutils_hack.override  # noqa: F401
  File "/tmp/testenv2/lib/python3.10/site-packages/_distutils_hack/override.py", line 1, in <module>
    __import__('_distutils_hack').do_override()
  File "/tmp/testenv2/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 76, in do_override
    ensure_local_distutils()
  File "/tmp/testenv2/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 63, in ensure_local_distutils
    assert '_distutils' in core.__file__, core.__file__
AssertionError: /tmp/testenv2/lib/python3.10/distutils/core.py

It looks like it tries to distutils from stdlib, but if running

import importlib
importlib.import_module("setuptools")

it is pulling the distutils from

'/tmp/testenv2/lib/python3.10/site-packages/setuptools/_distutils'

Not sure what is different when doing this via pandas.show_versions()

Read more comments on GitHub >

github_iconTop Results From Across the Web

Contributing to pandas — pandas 1.2.2 documentation
import pandas as pd >>> pd.show_versions() ... To test out code changes, you'll need to build pandas from source, which requires a C/C++...
Read more >
Contributing to pandas — pandas 0.24.1 documentation
Include the full version string of pandas and its dependencies. You can use the built in function: >>> import pandas as pd >>>...
Read more >
Contributing to pandas — pandas 0.19.0 documentation - PyData |
from pandas.util.print_versions import show_versions >>> show_versions() ... Generating any warnings will cause the build to fail; thus these are part of ...
Read more >
Contributing to pandas — pandas 0.23.1 documentation
Include the full version string of pandas and its dependencies. You can use the built in function: >>> import pandas as pd >>>...
Read more >
Contributing to pandas — pandas 0.21.1 documentation
import pandas as pd >>> pd.show_versions() ... the build dependencies python -m pip install -r ci/requirements_dev.txt # Build and install pandas python ...
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