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

Import error with anndata 0.10.9 on Python 3.9 #82

Open
jkanche opened this issue Oct 1, 2024 · 4 comments
Open

Import error with anndata 0.10.9 on Python 3.9 #82

jkanche opened this issue Oct 1, 2024 · 4 comments
Assignees

Comments

@jkanche
Copy link

jkanche commented Oct 1, 2024

Describe the bug
Running into an import error, seems like its limited to Python 3.9. Python 3.9 EOL is 2025. Is there a reason why the package only supports 3.10 and above. Atleast thats my understanding here - https://github.com/scverse/mudata/blob/main/pyproject.toml#L8

To Reproduce
Install the package version running in one of my github actions here:
anndata==0.10.9
mudata==0.2.4 (last version of the package compatible with Python 3.9)

ImportError while importing test module '/home/runner/work/SingleCellExperiment/SingleCellExperiment/tests/test_sce_combine_cols.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_sce_combine_cols.py:9: in <module>
    from mudata import MuData
.tox/default/lib/python3.9/site-packages/mudata/__init__.py:3: in <module>
    from ._core.mudata import MuData
.tox/default/lib/python3.9/site-packages/mudata/_core/mudata.py:21: in <module>
    from anndata._core.aligned_mapping import (
E   ImportError: cannot import name 'AlignedViewMixin' from 'anndata._core.aligned_mapping' (/home/runner/work/SingleCellExperiment/SingleCellExperiment/.tox/default/lib/python3.9/site-packages/anndata/_core/aligned_mapping.py)

Expected behaviour
Expected no import errors

System

  • OS: linux
  • Python version: 3.9
  • Versions of libraries involved: anndata==0.10.9 and mudata==0.2.4
@Zethson
Copy link
Member

Zethson commented Oct 3, 2024

I'll leave it to @gtca to answer the rest but in general, scverse follows https://scientific-python.org/specs/spec-0000/ where Python 3.9 is already EOL and even 3.10 is getting there.

Numpy, Pandas, Scipy, and others are moving at an increasingly pace and we cannot maintain our packages if we don't follow their support schedules.

@jkanche
Copy link
Author

jkanche commented Oct 3, 2024

Python 3.9 still gets security updates till the end of 2025 - https://devguide.python.org/versions/.

It seems to be inconsistent within the scverse ecosystem since anndata still supports 3.9. I am not suggesting you support Python 3.9, but may be there's better way of setting up dependencies - https://github.com/scverse/mudata/blob/main/pyproject.toml#L26

@gtca
Copy link
Collaborator

gtca commented Oct 3, 2024

Thanks both!

On the consistency: there was a recent discussion on trying to be more aligned with the version support across packages. Broadly speaking, the SPEC 0 seems to be a good rule of thumb.

On the error and dependencies: the pyproject.toml that you linked specifies python >= 3.10 (since v0.3), and there seems to be nothing wrong with requiring newer versions irrespective of what the dependencies can tolerate. With Python 3.9, you won't be able to use the recent NumPy releases either so the timing looks reasonable.

Seems like this experience is also related to anndata changing the related (private) API in 0.10.9 so its previous patch release should already work for you.

@gtca gtca removed the bug Something isn't working label Oct 3, 2024
@jkanche
Copy link
Author

jkanche commented Oct 6, 2024

Regardless of the drop in support for specific Python versions, it's generally good practice to restrict package versions.

For example, the last supported version for Python 3.9 appears to be v0.2.4. However, if you try to install it now, it will attempt to download the most recent release of the anndata package due to the use of >= in the dependencies, as seen here: https://github.com/scverse/mudata/blob/v0.2.4/pyproject.toml#L24.

To avoid compatibility issues, the version should likely be restricted to 0.10.8 if that's the last known version that works with the package.

For reference, I resolved a similar issue in my packages by locking the versions of dependencies that were known to work, as shown here: https://github.com/BiocPy/SingleCellExperiment/pull/47/files (in my case, I used 0.9.2).

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

3 participants