olimac
olimac

Reputation: 11

How to recognize Conda using Reticulate for installing SpacyR

I'm trying to install spacyr on a Windows 10 machine with R 3.6.1. and Visual Studio Community 2019.

When trying to spacy_install() I get this error:

"Error: Conda installation failed (no conda binary found)

Install Anaconda 3.x for Windows (https://www.anaconda.com/download/#windows) before installing spaCy"

I had already installed Miniconda3 4.7.12 and after failing I installed Anaconda3 2019.10 (Python 3.7.4 64-bit).

Looking at the code in https://github.com/quanteda/spacyr/blob/master/R/spacy_install.R I tried reticulate::py_versions_windows() and I get:

    type hive               install_path                        executable_path version arch

1 PythonCore HCU C:\Users\user\ANACON~1 C:\Users\camil\ANACON~1\python.exe 3.7 x64 2 Anaconda HCU C:\Users\user\ANACON~1 C:\Users\camil\ANACON~1\python.exe 3.7 x64

But when I try reticulate::conda_binary("auto") I get: Error: Unable to find conda binary. Is Anaconda installed?

I also tried installing spacy in Python through pip and conda (not both at the same time) and that doesn't work either.

Upvotes: 1

Views: 386

Answers (1)

Caddisfly
Caddisfly

Reputation: 1319

I was having the same issue. I fixed it by doing the following (adapted from this answer)

Find the path to your miniconda bin by looking in the path from here: path.expand(reticulate::py_versions_windows()$install_path)

Then:

original_path <- Sys.getenv("PATH")

Sys.setenv("PATH" = paste("path\\to\\anaconda\\bin", original_path, sep = ";"))

Notice "PATH" is in quotes, double slashes \\ and sep = ; - these are what worked for me, but are different than given in this answer

Then proceed as per spacyr instructions:

library(spacyr)

spacy_install()

Upvotes: 0

Related Questions