yfinance
yfinance copied to clipboard
0.2.40: not ready for `numpy` 1.26.4? 🤔
Describe bug
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
-
python3 -sBm build -w --no-isolation - because I'm calling
buildwith--no-isolationI'm using during all processes only locally installed modules - install .whl file in </install/prefix> using
installermodule - run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
- build is performed in env which is
cut off from access to the public network(pytest is executed with-m "not network")
Looks like yfinance test suite is not ready for numpy 1.26.4.
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-yfinance-0.2.40-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-yfinance-0.2.40-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network' tests/__init__.py tests/context.py tests/test_prices.py tests/test_ticker.py tests/test_utils.py
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/tkloczko/rpmbuild/BUILD/yfinance-0.2.40
plugins: time-machine-2.14.1, typeguard-4.2.1, flaky-3.8.1, mock-3.14.0, requests-mock-1.12.1, rerunfailures-12.0
collected 0 items / 4 errors
========================================================================================== ERRORS ===========================================================================================
_____________________________________________________________________________ ERROR collecting tests/context.py _____________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/yfinance-0.2.40/tests/context.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/context.py:7: in <module>
import yfinance
yfinance/__init__.py:22: in <module>
from .ticker import Ticker
yfinance/ticker.py:25: in <module>
import pandas as _pd
/usr/lib64/python3.10/site-packages/pandas/__init__.py:19: in <module>
raise ImportError(
E ImportError: Unable to import required dependencies:
E numpy: Error importing numpy: you should not try to import numpy from
E its source directory; please exit the numpy source tree, and relaunch
E your python interpreter from there.
___________________________________________________________________________ ERROR collecting tests/test_prices.py ___________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/yfinance-0.2.40/tests/test_prices.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_prices.py:1: in <module>
from .context import yfinance as yf
tests/context.py:7: in <module>
import yfinance
yfinance/__init__.py:22: in <module>
from .ticker import Ticker
yfinance/ticker.py:25: in <module>
import pandas as _pd
/usr/lib64/python3.10/site-packages/pandas/__init__.py:19: in <module>
raise ImportError(
E ImportError: Unable to import required dependencies:
E numpy: cannot import name 'set_module' from 'numpy.core.overrides' (/usr/lib64/python3.10/site-packages/numpy/core/overrides.py)
___________________________________________________________________________ ERROR collecting tests/test_ticker.py ___________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/yfinance-0.2.40/tests/test_ticker.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_ticker.py:11: in <module>
import pandas as pd
/usr/lib64/python3.10/site-packages/pandas/__init__.py:19: in <module>
raise ImportError(
E ImportError: Unable to import required dependencies:
E numpy: cannot import name 'set_module' from 'numpy.core.overrides' (/usr/lib64/python3.10/site-packages/numpy/core/overrides.py)
___________________________________________________________________________ ERROR collecting tests/test_utils.py ____________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/yfinance-0.2.40/tests/test_utils.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_utils.py:16: in <module>
from .context import yfinance as yf
tests/context.py:7: in <module>
import yfinance
yfinance/__init__.py:22: in <module>
from .ticker import Ticker
yfinance/ticker.py:25: in <module>
import pandas as _pd
/usr/lib64/python3.10/site-packages/pandas/__init__.py:19: in <module>
raise ImportError(
E ImportError: Unable to import required dependencies:
E numpy: cannot import name 'set_module' from 'numpy.core.overrides' (/usr/lib64/python3.10/site-packages/numpy/core/overrides.py)
================================================================================== short test summary info ==================================================================================
ERROR tests/context.py
ERROR tests/test_prices.py
ERROR tests/test_ticker.py
ERROR tests/test_utils.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 4 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
===================================================================================== 4 errors in 0.30s =====================================================================================
List of installed modules in build env:
Package Version
------------------ -----------
appdirs 1.4.4
attrs 23.2.0
beautifulsoup4 4.12.3
build 1.2.1
cattrs 23.2.3
charset-normalizer 3.3.2
exceptiongroup 1.1.3
frozendict 2.4.4
idna 3.7
importlib_metadata 7.1.0
iniconfig 2.0.0
installer 0.7.0
multitasking 0.0.11
numpy 1.26.4
packaging 24.0
pandas 2.2.1
peewee 3.17.5
platformdirs 4.2.2
pluggy 1.4.0
pyproject_hooks 1.0.0
pytest 8.1.1
python-dateutil 2.9.0.post0
pytz 2024.1
requests 2.31.0
requests-cache 1.2.0
setuptools 69.4.0
soupsieve 2.5
tokenize_rt 5.2.0
tomli 2.0.1
typing_extensions 4.11.0
url-normalize 1.4.3
urllib3 2.2.1
wheel 0.43.0
zipp 3.18.2
Simple code that reproduces your problem
N/A
Debug log
N/A
Bad data proof
No response
yfinance version
0.2.40
Python version
3.10.14
Operating system
Linux/x86_64
Does this happen with 0.2.38?
Have no idea because it is my first approach to package your module.