Search code examples
pythonrreticulate

use_config() is not changing my python configuration in R reticulate


I'm new to the reticulate package in R and i'm having an issue. I'm specifying the python version I want to use (anaconda3 - python3.7) using use_python but it's not working.

This is my code:

    library(reticulate)

    sys <- import("sys")

    sys$version
    [1] "2.7.10 (default, Oct  6 2017, 22:29:07) \n[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]"

    use_python("/anaconda3/bin/python3", required = TRUE)

    sys$version
    [1] "2.7.10 (default, Oct  6 2017, 22:29:07) \n[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]"

In the terminal, i entered the command which python and shows me: /anaconda3/bin/python

Also when I check for py_config() in R console i get: py_config

But when I use py_discover_config() in R console i get: py_discover_config

How can I use this python3.7 version in reticulate because I cant load any module of my anaconda3?


Solution

  • SOLVED.

    For anyone who has the same issue.

    library(reticulate)
    use_python("pathToPython", required = TRUE)
    

    Then you can try

    py_config()
    

    And should be working. It was only the order of the commands.