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

update: Fixes to allow compatability with newer numpy & pandas #191

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pettyalex
Copy link

@pettyalex pettyalex commented Mar 10, 2024

Hello,

I cloned MetaXcan and tried to get it running on a modern Mac, and ran into a couple of problems that seem really easy to fix, so I took a shot at fixing them.

Scipy <1.3 is too old to work on Python 3.9 on an Apple Silicon Mac, but all the tests pass with a much newer scipy so I removed the maximum version requirement.

Numpy 1.20 removed numpy.str and numpy.object, but those were just references to str and object so I updated those.

pandas.to_numeric() is removing support for errors='ignore'. It still works as of pandas 2.2.1, but is covered in warnings. If exceptions aren't preferred, maybe we could check if the first value in the column is numeric before attempting to convert?
https://pandas.pydata.org/docs/reference/api/pandas.to_numeric.html

I also added sqlalchemy as an extra requirement if installing to run tests. Would you be interested in moving to pyproject.toml instead of setup.py? I'd be glad to do so: https://packaging.python.org/en/latest/guides/modernize-setup-py-project/

All of these changes together make the project installable with pip install on a modern system, and all the tests pass.

For reference, after removing the scipy max version requirement, these are the package versions I got from a pip install . on python 3.9.16 on MacOS 14:

appdirs==1.4.4
bgen-reader==4.0.8
cachetools==5.3.3
cbgen==1.0.4
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
cloudpickle==3.0.0
coloredlogs==15.0.1
cyvcf2==0.30.28
dask==2024.2.1
exceptiongroup==1.2.0
fsspec==2024.2.0
h5py==3.10.0
h5py-cache==1.0
humanfriendly==10.0
idna==3.6
importlib_metadata==7.0.2
iniconfig==2.0.0
locket==1.0.0
MetaXcan==0.7.5
numpy==1.26.4
packaging==23.2
pandas==2.2.1
partd==1.4.1
patsy==0.5.6
platformdirs==4.2.0
pluggy==1.4.0
pooch==1.8.1
pycparser==2.21
pytest==8.1.1
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.1
requests==2.31.0
scipy==1.12.0
six==1.16.0
SQLAlchemy==2.0.28
statsmodels==0.14.1
texttable==1.7.0
tomli==2.0.1
toolz==0.12.1
tqdm==4.66.2
typing_extensions==4.10.0
tzdata==2024.1
urllib3==2.2.1
xarray==2024.2.0
zipp==3.17.0

…deprecated references to numpy.str with str, and numpy.object with object. Handle exceptions coming from pandas.to_numeric, as errors can no longer be ignored. Fix a broken call to pandas.read_table.
Copy link
Collaborator

@Heroico Heroico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good.
@hakyim I recommend this update is merged, however it requires some testing on your end to verify no workflow currently in use breaks.

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

Successfully merging this pull request may close these issues.

2 participants