Bug 266488 - math/py-pandas: Fails to print version
Summary: math/py-pandas: Fails to print version
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-python (Nobody)
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2022-09-18 23:57 UTC by Yuri Victorovich
Modified: 2023-11-16 23:41 UTC (History)
3 users (show)

See Also:
koobs: maintainer-feedback+
koobs: maintainer-feedback? (yuri)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2022-09-18 23:57:16 UTC
This script:
> import pandas as pd
> print(pd.show_versions())

fails:
> Traceback (most recent call last):
>   File "/disk-samsung/freebsd-ports/misc/py-eemeter/v.py", line 5, in <module>
>     print(pd.show_versions())
>   File "/usr/local/lib/python3.9/site-packages/pandas/util/_print_versions.py", line 109, in show_versions
>     deps = _get_dependency_info()
>   File "/usr/local/lib/python3.9/site-packages/pandas/util/_print_versions.py", line 88, in _get_dependency_info
>     mod = import_optional_dependency(modname, errors="ignore")
>   File "/usr/local/lib/python3.9/site-packages/pandas/compat/_optional.py", line 115, in import_optional_dependency
>     module = importlib.import_module(name)
>   File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
>     return _bootstrap._gcd_import(name[level:], package, level)
>   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
>   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
>   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
>   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
>   File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 8, in <module>
>     import _distutils_hack.override  # noqa: F401
>   File "/usr/local/lib/python3.9/site-packages/_distutils_hack/override.py", line 1, in <module>
>     __import__('_distutils_hack').do_override()
>   File "/usr/local/lib/python3.9/site-packages/_distutils_hack/__init__.py", line 77, in do_override
>     ensure_local_distutils()
>   File "/usr/local/lib/python3.9/site-packages/_distutils_hack/__init__.py", line 64, in ensure_local_distutils
>     assert '_distutils' in core.__file__, core.__file__
> AssertionError: /usr/local/lib/python3.9/distutils/core.py

Version: 1.3.5,1
Python-3.9
FreeBSD 13.1 STABLE
Comment 1 Wen Heping freebsd_committer freebsd_triage 2022-09-20 12:44:02 UTC
I cannnot reproduce the error, after I update pandas to 1.4.4.

wen
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2022-09-21 00:10:18 UTC
(In reply to Yuri Victorovich from comment #0)

 - Is/was there any additional lines after 'AssertionError', seems truncated?
 - Does the latest version (1.4.4) reproduce the issue too ?
Comment 3 Ruslan Makhmatkhanov freebsd_committer freebsd_triage 2023-11-16 10:23:09 UTC
I suppose this should be closed as resolved. pandas is now 2.0.3 in ports and show_versions() works fine there:

In [1]: import pandas as pd

In [2]: print(pd.show_versions())
/usr/local/lib/python3.9/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")

INSTALLED VERSIONS
------------------
commit           : 0f437949513225922d851e9581723d82120684a6
python           : 3.9.18.final.0
python-bits      : 64
OS               : FreeBSD
OS-release       : 15.0-CURRENT

[skip]
Comment 4 Yuri Victorovich freebsd_committer freebsd_triage 2023-11-16 18:31:03 UTC
The same script fails because apparently the numba dependency is missing:
> $ python3.9 test-pandas.py
> /usr/local/lib/python3.9/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
>   warnings.warn("Setuptools is replacing distutils.")
> Traceback (most recent call last):
>   File "/usr/ports/test-pandas.py", line 2, in <module>
>     print(pd.show_versions())
>   File "/usr/local/lib/python3.9/site-packages/pandas/util/_print_versions.py", line 109, in show_versions
>     deps = _get_dependency_info()
>   File "/usr/local/lib/python3.9/site-packages/pandas/util/_print_versions.py", line 88, in _get_dependency_info
>     mod = import_optional_dependency(modname, errors="ignore")
>   File "/usr/local/lib/python3.9/site-packages/pandas/compat/_optional.py", line 157, in import_optional_dependency
>     version = get_version(module_to_get)
>   File "/usr/local/lib/python3.9/site-packages/pandas/compat/_optional.py", line 84, in get_version
>     raise ImportError(f"Can't determine version for {module.__name__}")
> ImportError: Can't determine version for numba
Comment 5 Ruslan Makhmatkhanov freebsd_committer freebsd_triage 2023-11-16 23:22:19 UTC
Ok, I was able to reproduce after installing py39-numba. Anyway, it's not listed as a default (or optional) dependency of pandas, so I'd report that upstream instead. Works just fine w/o numba installed.
Comment 6 Ruslan Makhmatkhanov freebsd_committer freebsd_triage 2023-11-16 23:31:22 UTC
According to the docs [1], numba 0.56.2 that we have in ports need numpy =< 1.24, while we have version 1.25 in ports. So the problem port is numba, not pandas. Solution would be to upgrade numba to at least 0.57.0, that added support for numpy 1.25.


[1] https://github.com/numba/numba/blob/f0be9696dbc7427cd218dcea23363fe01745aea8/docs/source/user/installing.rst#version-support-information
Comment 7 Ruslan Makhmatkhanov freebsd_committer freebsd_triage 2023-11-16 23:41:54 UTC
(In reply to Yuri Victorovich from comment #0)

that message actually can be triggered by just import numba