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

BUG: scipy 1.15.0 breaking validation #1165

Open
Bento007 opened this issue Jan 7, 2025 · 0 comments
Open

BUG: scipy 1.15.0 breaking validation #1165

Bento007 opened this issue Jan 7, 2025 · 0 comments
Labels
bug Something isn't working tech Tech issues that do not require product prioritization. Tech debt, tooling, ops, etc.

Comments

@Bento007
Copy link
Contributor

Bento007 commented Jan 7, 2025

Description

Here in the code when slicing the X matrix with a Pandas.Series and attribute error is thrown.

n_nonzero = self.adata.X[:, column].count_nonzero()

../cellxgene_schema/validate.py:2092: in validate_adata
    self._deep_check()
../cellxgene_schema/validate.py:2044: in _deep_check
    self._validate_dataframe(component_name)
../cellxgene_schema/validate.py:968: in _validate_dataframe
    self._validate_column(column, column_name, df_name, column_def)
../cellxgene_schema/validate.py:684: in _validate_column
    self._validate_column_feature_is_filtered(column, column_name, df_name)
../cellxgene_schema/validate.py:614: in _validate_column_feature_is_filtered
    n_nonzero = self.adata.X[:, column].count_nonzero()
../.venv/lib/python3.10/site-packages/anndata/_core/sparse_dataset.py:414: in __getitem__
    row_sp_matrix_validated, col_sp_matrix_validated = mtx._validate_indices(
../.venv/lib/python3.10/site-packages/scipy/sparse/_index.py:269: in _validate_indices
    index.extend(ix.nonzero())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = gene_ids-Harvard-Nuclei
ERCC-00002          True
ENSG00000127472    False
ENSG00000142798    False
ENSG00000127603    ...00198938    False
ENSG00000198840    False
ENSG00000198727    False
Name: feature_is_filtered, Length: 136, dtype: bool
name = 'nonzero'

    @final
    def __getattr__(self, name: str):
        """
        After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
        if (
            name not in self._internal_names_set
            and name not in self._metadata
            and name not in self._accessors
            and self._info_axis._can_hold_identifiers_and_holds_name(name)
        ):
            return self[name]
>       return object.__getattribute__(self, name)
E       AttributeError: 'Series' object has no attribute 'nonzero'

This failure started occurring with scipy version 1.15.0. Rolling back to scipy version 1.14.1 fixes the issue. There maybe migration steps needs to support the new scipy sparse format see https://docs.scipy.org/doc/scipy/reference/sparse.migration_to_sparray.html#recommended-steps-for-migration

@Bento007 Bento007 added bug Something isn't working tech Tech issues that do not require product prioritization. Tech debt, tooling, ops, etc. labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tech Tech issues that do not require product prioritization. Tech debt, tooling, ops, etc.
Projects
None yet
Development

No branches or pull requests

1 participant