简体   繁体   中英

Problems running reticulate under Anaconda Windows install

I'm having trouble doing even the most basic things with the reticulate library in R Studio. My code looks as follows:

library(reticulate)
use_python("C:\\Users\\User2017\\AppData\\Local\\Programs\\Python\\Python36\\python.exe")
 req <- import("requests")

With the last line I get an error

 parse error: trailing garbage 2017\\\\Documents\\\\.condarc" } Using Anaconda Cloud api site h (right here) ------^ 

How can I get this working? Using requests is just for example, every other package fails. The python I'm pointing the reticulate package to is the system wide python that has various packages already installed.

My specs from running sessionInfo() :

R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252    LC_MONETARY=English_Australia.1252
[4] LC_NUMERIC=C                       LC_TIME=English_Australia.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] reticulate_1.11.1

loaded via a namespace (and not attached):
[1] compiler_3.5.3  Matrix_1.2-15   tools_3.5.3     yaml_2.2.0      Rcpp_1.0.1      grid_3.5.3      jsonlite_1.6   
[8] lattice_0.20-38

The same problem on my side:

pandas <- import("pandas") 
Error: parse error: trailing garbage
      Documents\\.condarc" } Using Anaconda Cloud api site h
                 (right here) ------^

I have followed the suggestions of smci: after removing Anaconda from my computer and re-linking to another python installation, the problem has disappeared:

use_python("~/Python36/python")
os <- import("os")

Hope that helps!

Addition: Python 2.7.11, Anaconda2 4.0.0 64-bit

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM