theislab / anndata2ri

Convert between AnnData and SingleCellExperiment
https://icb-anndata2ri.readthedocs-hosted.com/
GNU General Public License v3.0
124 stars 16 forks source link

Jupyter notebook - kernel crashes when importing anndata2ri #158

Closed Gokhan169 closed 6 months ago

Gokhan169 commented 6 months ago

Hi,

It seems that I am unable to import anndata2ri. Whenever I tried in the jupyter notebook, I get the following error. I would be really glad if you can help me with this issue. Thanks.

Kernel Restarting The kernel for Desktop/Merfish analysis/Untitled8.ipynb appears to have died. It will restart automatically.

flying-sheep commented 6 months ago

Hi, please give me something to work with, like a traceback.

You could e.g. try setting the environment variable PYTHONFAULTHANDLER=1 before starting jupyter lab.

I’ll close this since it has no actionable information, but please comment if you have anything workable and I’ll reopen

Urja25 commented 3 months ago

I am facing the same problem. This is my code: ` import anndata2ri import logging

import rpy2.rinterface_lib.callbacks as rcb import rpy2.robjects as ro

rcb.logger.setLevel(logging.ERROR) ro.pandas2ri.activate() anndata2ri.activate()

%load_ext rpy2.ipython `

Traceback:

ImportError Traceback (most recent call last) File ~/.local/lib/python3.10/site-packages/pandas/init.py:23, in 21 try: 22 # numpy compat ---> 23 from pandas.compat import ( 24 is_numpy_dev as _is_numpy_dev, # pyright: ignore[reportUnusedImport] # noqa: F401,E501 25 ) 26 except ImportError as _err: # pragma: no cover

File ~/.local/lib/python3.10/site-packages/pandas/compat/init.py:26, in 25 import pandas.compat.compressors ---> 26 from pandas.compat.numpy import is_numpy_dev 27 from pandas.compat.pyarrow import ( 28 pa_version_under7p0, 29 pa_version_under8p0, (...) 32 pa_version_under13p0, 33 )

File ~/.local/lib/python3.10/site-packages/pandas/compat/numpy/init.py:17, in 16 if _nlv < Version(_min_numpy_ver): ---> 17 raise ImportError( 18 f"this version of pandas is incompatible with numpy < {_min_numpy_ver}\n" 19 f"your numpy version is {_np_version}.\n" 20 f"Please upgrade numpy to >= {_min_numpy_ver} to use this pandas version" 21 ) 24 all = [ 25 "np", 26 "_np_version", 27 "is_numpy_dev", 28 ]

ImportError: this version of pandas is incompatible with numpy < 1.22.4 your numpy version is 1.22.3. Please upgrade numpy to >= 1.22.4 to use this pandas version

The above exception was the direct cause of the following exception:

ImportError Traceback (most recent call last) Input In [2], in <cell line: 1>() ----> 1 import anndata2ri 2 import logging 4 import rpy2.rinterface_lib.callbacks as rcb

File ~/.local/lib/python3.10/site-packages/anndata2ri/init.py:20, in 17 from pathlib import Path 18 from typing import TYPE_CHECKING ---> 20 from . import _py2r, _r2py # noqa: F401 21 from ._conv import activate, converter, deactivate 24 if TYPE_CHECKING:

File ~/.local/lib/python3.10/site-packages/anndata2ri/_py2r.py:8, in 5 from warnings import warn 7 import numpy as np ----> 8 from anndata import AnnData 9 from rpy2.robjects import conversion, default_converter, pandas2ri 10 from rpy2.robjects.conversion import localconverter

File ~/.local/lib/python3.10/site-packages/anndata/init.py:7, in 5 if not within_flit(): 6 del within_flit ----> 7 from ._core.anndata import AnnData 8 from ._core.merge import concat 9 from ._core.raw import Raw

File ~/.local/lib/python3.10/site-packages/anndata/_core/anndata.py:21, in 19 import numpy as np 20 from numpy import ma ---> 21 import pandas as pd 22 from pandas.api.types import infer_dtype, is_string_dtype, is_categorical_dtype 23 from scipy import sparse

File ~/.local/lib/python3.10/site-packages/pandas/init.py:28, in 26 except ImportError as _err: # pragma: no cover 27 _module = _err.name ---> 28 raise ImportError( 29 f"C extension: {_module} not built. If you want to import " 30 "pandas from the source directory, you may need to run " 31 "'python setup.py build_ext' to build the C extensions first." 32 ) from _err 34 from pandas._config import ( 35 get_option, 36 set_option, (...) 40 options, 41 ) 43 # let init-time option registration happen

ImportError: C extension: None not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext' to build the C extensions first.