Seurat: Using RunUMAP with Anaconda Python

Created on 22 May 2018  路  4Comments  路  Source: satijalab/seurat

Hi,
I am trying to install the umap feature based on your instructions and lmcinnes/umap without any success. I installed the 'umap-learn' using _pip_, however, Seurat still not recognizing the package.
Any help/suggestion would be very appreciated. (I am using the last version of Seurat)
Thanks, HM

Most helpful comment

I think I have got a solution to this problem. Anaconda uses its own _pip_, and the default installation by pip (on Anaconda) goes to _~/.local/anaconda3/lib/python3.6/site-packages_ on my machine. Reticulate is not seeing modules at this path

Instead, I installed UMAP at the default pip (without anaconda) path (~/.local/lib/python3.6/site-packages ), which solved the problem

pip install -t ~/.local/lib/python3.6/site-packages umap-learn

All 4 comments

What was the exact command you used to install UMAP?

In Python, what happens when you run

>>> import umap

In R, what's the output of

> reticulate::py_config()

In the shell, what's the output of

echo $PYTHONPATH

I installed anaconda and then run the pip command. I assume something went bad with the installation of the package. Sorry in advance if I did something stupid. I have no experience in Python. Thanks. HM

The output of > reticulate::py_config() in R is: Error: Specified conda binary 'C:\Users\Hassan\AppData\Local\CONTIN~1\ANACON~1/Scripts/conda.exe' does not exist.

The output of >>> import umap in Python is:
Traceback (most recent call last): File "<input>", line 1, in <module> File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 19, in do_import module = self._system_import(name, *args, **kwargs) ImportError: No module named umap

No output for echo $PYTHONPATH in shell.

I don't think you can use Pip with Anaconda as Anaconda likes to do things its own way and become the dominant Python installation. It also looks like you can't use Anaconda with reticulate. I recommend getting rid of Anaconda, but if you need it for some reason, then use conda (Anaconda's package manager) to install UMAP (assuming UMAP is available on conda) or installing it by hand using Anaconda Python. You'll then be able to use UMAP by hand in Python, but not in R.

I think I have got a solution to this problem. Anaconda uses its own _pip_, and the default installation by pip (on Anaconda) goes to _~/.local/anaconda3/lib/python3.6/site-packages_ on my machine. Reticulate is not seeing modules at this path

Instead, I installed UMAP at the default pip (without anaconda) path (~/.local/lib/python3.6/site-packages ), which solved the problem

pip install -t ~/.local/lib/python3.6/site-packages umap-learn

Was this page helpful?
0 / 5 - 0 ratings