CellChat
CellChat copied to clipboard
Cannot find UMAP!
Hi, We are using R 4.0.3 on a HPC cluster. umap-learn is installed as a module in a shared file system for python 3.6.5. But as the user issues cellchat.all <- netEmbedding(cellchat.all, type = "functional")
he encounters prompt to install umap: Manifold learning of the signaling networks for datasets 1 2 3 No non-system installation of Python could be found. Would you like to download and install Miniconda? Miniconda is an open source environment management system for Python. See https://docs.conda.io/en/latest/miniconda.html for more details.
Would you like to install Miniconda? [Y/n]
and even installing it in user home directory (via r-miniconda) ends up with:
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "/gpfs/share/apps/python/cpu/3.6.5/lib/python3.6/site-packages/site.py", line 73, in
- '/gpfs/home/barcij03/.local/share/r-miniconda/bin/conda' 'create' '--yes' '--name' 'r-reticulate' 'python=3.8' 'numpy' '--quiet' '-c' 'conda-forge'
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "/gpfs/share/apps/python/cpu/3.6.5/lib/python3.6/site-packages/site.py", line 73, in
__boot() File "/gpfs/share/apps/python/cpu/3.6.5/lib/python3.6/site-packages/site.py", line 26, in __boot import imp # Avoid import loop in Python >= 3.3 File "/gpfs/home/barcij03/.local/share/r-miniconda/lib/python3.9/imp.py", line 23, in from importlib import util File "/gpfs/home/barcij03/.local/share/r-miniconda/lib/python3.9/importlib/util.py", line 2, in from . import abc File "/gpfs/home/barcij03/.local/share/r-miniconda/lib/python3.9/importlib/abc.py", line 17, in from typing import Protocol, runtime_checkable File "/gpfs/share/apps/python/cpu/3.6.5/lib/python3.6/site-packages/typing.py", line 1347, in class Callable(extra=collections_abc.Callable, metaclass=CallableMeta): File "/gpfs/share/apps/python/cpu/3.6.5/lib/python3.6/site-packages/typing.py", line 1003, in new self._abc_registry = extra._abc_registry AttributeError: type object 'Callable' has no attribute '_abc_registry' Error in runUMAP(Similarity, min_dist = min_dist, n_neighbors = n_neighbors, : Cannot find UMAP, please install through pip (e.g. pip install umap-learn or reticulate::py_install(packages = 'umap-learn')).
I should mention that user modifies PYTHONPATH to point to the "site-packages" installed in his home directory.
We appreciate your help.
I encountered the same problem, solved by specifying $RETICULATE_PYTHON by add this line to my .Renviron file (change the path to the actual python executable in your cluster):
RETICULATE_PYTHON="/gpfs/share/apps/python/cpu/3.6.5/bin/python"
Your home directory may not have a .Renviron file, in which case just create it.
This is actually a problem caused by the Reticulate pacakge (which is the interface between python and R), check their manual if you want to learn more.
Note that this will load this version of python everytime you start Reticulate, which may interfere other packages that use python (for example Seurat). If you just want to use this version on the fly, you can use the use_python()
function in the Reticulate package.
I encountered the same problem, solved by specifying $RETICULATE_PYTHON by add this line to my .Renviron file (change the path to the actual python executable in your cluster):
RETICULATE_PYTHON="/gpfs/share/apps/python/cpu/3.6.5/bin/python"
Your home directory may not have a .Renviron file, in which case just create it. This is actually a problem caused by the Reticulate pacakge (which is the interface between python and R), check their manual if you want to learn more. Note that this will load this version of python everytime you start Reticulate, which may interfere other packages that use python (for example Seurat). If you just want to use this version on the fly, you can use theuse_python()
function in the Reticulate package.
Great! I solved mine with your solution. Thanks!