theislab / cellrank

CellRank: dynamics from multi-view single-cell data
https://cellrank.org
BSD 3-Clause "New" or "Revised" License
347 stars 46 forks source link

Cellrank can't find petsc4py #592

Closed emdann closed 3 years ago

emdann commented 3 years ago

Hi, I recently had to reinstall cellrank in a conda environment and since reinstalling the cellrank functions seem unable to load petsc4py.

I've followed the tutorial to install petsc4py via conda:

# update
sudo apt-get update
sudo apt-get upgrade

# install a message passing interface and mpi4py
sudo apt-get install libopenmpi-dev  # alt.: conda install -c conda-forge openmpi
pip install --user mpi4py  # alt.: conda install -c anaconda mpi4py

# install petsc and and petsc4py
conda install -c conda-forge petsc
conda install -c conda-forge petsc4py

Then installed the development version of cellrank (but the same issue remains if I install with pip install cellrank[krylov])

pip install git+https://github.com/theislab/cellrank@dev

In python I am able to import both cellrank and petsc4py without issues, but the schur decomposition function can't load the petsc4py library.

ctk = cellrank.tl.kernels.ConnectivityKernel(adata)
g = cellrank.tl.estimators.GPCCA(ctk)
g.compute_schur(method="krylov")
WARNING: Unable to import `petsc4py` or `slepc4py`. Using `method='brandts'`
WARNING: For `method='brandts'`, dense matrix is required. Densifying

Any suggestions on why this might be happening? I am working with a large dataset so using brandts is not sustainable.

Versions:

cellrank==1.3.1+ga966e79 scanpy==1.7.2 anndata==0.7.6 numpy==1.20.2 numba==0.51.2 scipy==1.5.2 pandas==1.1.2 pygpcca==1.0.2 scikit-learn==0.23.2 statsmodels==0.12.0 python-igraph==0.9.0 scvelo==0.2.3 pygam==0.8.0 matplotlib==3.3.2 seaborn==0.11.0

michalk8 commented 3 years ago

Hi @emdann ,

is both petsc4py and slepc4py installed, i.e. could you try running

python -c "import petsc4py; import slepc4py; print(petsc4py.__version__); print(slepc4py.__version__)"

to verify (mine prints out 3.14.1 3.14.0)? For reference, the check is being done here.

emdann commented 3 years ago

A-ha I knew there was a simple explanation, it was indeed a problem with the slepc4py installation. I reinstalled it as by installation instructions and all is well now. The warning message somehow made me think I only needed one of the two. Thanks a lot!