Leiden algorithm not working R studio scRNAseq
1
0
Entering edit mode
16 months ago
camillab. ▴ 160

Hi,

I would like to use the Leiden algorithm on my scRNAseq to identify the clusters but I cannot run the algorithm. If I use the default one I have no problem. I tried :

 FindClusters(immune.combined, resolution = 0.3, algorithm = 4)

but it gives me this error:

Error: Cannot find Leiden algorithm, please install through pip (e.g. pip install leidenalg).


In addition: Warning message:
In system2(command = python, args = shQuote(script), stdout = TRUE,  :
  running command ''/Users/camilla/.virtualenvs/r-reticulate/bin/python' '/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/reticulate/config/config.py' 2>/dev/null' had status 1

I have reticulate package but when I try to install leidenAlg it install it in a folder I have never seen

The downloaded binary packages are in
    /var/folders/w2/826prqh14cq_pjljhh87q2lh0000gq/T//RtmpkPBi5K/downloaded_packages

and when I try to load it :

library(reticulate)
library('leidenAlg')
library(Matrix)

it gives me this error:

Loading required package: Matrix
Error in value[[3L]](cond) : 
  Package ‘Matrix’ version 1.5.4.1 cannot be unloaded:
 Error in unloadNamespace(package) : namespace ‘Matrix’ is imported by ‘SummarizedExperiment’, ‘SeuratObject’, ‘uwot’, ‘S4Arrays’, ‘spatstat.data’, ‘survival’, ‘spatstat.explore’, ‘DelayedArray’, ‘leiden’, ‘TFisher’, ‘irlba’, ‘reticulate’, ‘spatstat.sparse’, ‘sctransform’, ‘Seurat’ so cannot be unloaded

Why it gives me so many errors? How can I solve it? How can I install pip install leidenalg on R studio?

Thank you

Camilla

scRNAseq R leidenAlg reticulate • 2.4k views
ADD COMMENT
2
Entering edit mode
16 months ago
library(reticulate)
py_install("leidenalg")
leidenalg<- import("leidenalg")

See the reticulate docs for more info.

ADD COMMENT
0
Entering edit mode

thank you! but now it gives me this error :

note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for leidenalg
Failed to build leidenalg
ERROR: Could not build wheels for leidenalg, which is required to install pyproject.toml-based projects
Error: Error installing package(s): "'leidenalg'"
In addition: Warning message:
In system2(command = python, args = shQuote(script), stdout = TRUE,  :
  running command ''/Users/camilla/.virtualenvs/r-reticulate/bin/python' '/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/reticulate/config/config.py' 2>/dev/null' had status 1
ADD REPLY
1
Entering edit mode

Maybe a compiler error, impossible to know without more info. Make sure gcc and g++ are installed on your system.

I'd probably just make a new environment and install it with conda. Read more here. leidenalg is available via conda in conda-forge.

ADD REPLY

Login before adding your answer.

Traffic: 2357 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6