dpeerlab / SEACells

SEACells algorithm for Inference of transcriptional and epigenomic cellular states from single-cell genomics data
GNU General Public License v2.0
145 stars 26 forks source link

RuntimeError: cannot cache function 'sparse_mean_var_minor_axis' #38

Closed simozhou closed 1 year ago

simozhou commented 1 year ago

I am running SEACells into a singularity environment, and installation is smooth with

pip3 install cmake
pip3 install SEACells

But when I then open a singularity shell and I try to import SEACells in the python terminal I get the following error:

$ apptainer run docker://registry.git.embl.de/procacci/seacells_docker:latest 
INFO:    Using cached SIF image
Python 3.8.16 (default, Apr 12 2023, 15:00:48) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import SEACells
Matplotlib created a temporary config/cache directory at /tmp/matplotlib-2opxlic0 because the default path (/home/procacci/.cache/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/SEACells/__init__.py", line 1, in <module>
    from . import core
  File "/usr/local/lib/python3.8/site-packages/SEACells/core.py", line 3, in <module>
    import palantir
  File "/usr/local/lib/python3.8/site-packages/palantir/__init__.py", line 3, in <module>
    from . import io
  File "/usr/local/lib/python3.8/site-packages/palantir/io.py", line 5, in <module>
    import scanpy as sc
  File "/usr/local/lib/python3.8/site-packages/scanpy/__init__.py", line 14, in <module>
    from . import tools as tl
  File "/usr/local/lib/python3.8/site-packages/scanpy/tools/__init__.py", line 1, in <module>
    from ..preprocessing import pca
  File "/usr/local/lib/python3.8/site-packages/scanpy/preprocessing/__init__.py", line 1, in <module>
    from ._recipes import recipe_zheng17, recipe_weinreb17, recipe_seurat
  File "/usr/local/lib/python3.8/site-packages/scanpy/preprocessing/_recipes.py", line 8, in <module>
    from ._deprecated.highly_variable_genes import (
  File "/usr/local/lib/python3.8/site-packages/scanpy/preprocessing/_deprecated/highly_variable_genes.py", line 11, in <module>
    from .._utils import _get_mean_var
  File "/usr/local/lib/python3.8/site-packages/scanpy/preprocessing/_utils.py", line 46, in <module>
    def sparse_mean_var_minor_axis(data, indices, major_len, minor_len, dtype):
  File "/usr/local/lib/python3.8/site-packages/numba/core/decorators.py", line 212, in wrapper
    disp.enable_caching()
  File "/usr/local/lib/python3.8/site-packages/numba/core/dispatcher.py", line 863, in enable_caching
    self._cache = FunctionCache(self.py_func)
  File "/usr/local/lib/python3.8/site-packages/numba/core/caching.py", line 601, in __init__
    self._impl = self._impl_class(py_func)
  File "/usr/local/lib/python3.8/site-packages/numba/core/caching.py", line 337, in __init__
    raise RuntimeError("cannot cache function %r: no locator available "
RuntimeError: cannot cache function 'sparse_mean_var_minor_axis': no locator available for file '/usr/local/lib/python3.8/site-packages/scanpy/preprocessing/_utils.py'

Has anyone had this problem before? I don't understand whether is a singularity-specific problem or a

sitarapersad commented 1 year ago

Can you try importing scanpy in python terminal and see if that works?

simozhou commented 1 year ago

Dear Sitara,

It is most likely a problem of scanpy installation within singularity, I managed to install seacells with a conda environment.

Might be useful to provide an installation .def file to the project or a dockerhub image to the project.

Closing the issue for now, thank you for the response anyway!