0

I want to use a specific Python version: /Users/aviral.s/.pyenv/versions/3.5.2/bin/python. This version is not available for R.

I tried reading the documentation but following all the three steps(setting the env variable, using the API use_python() didn't help either.

With sudo, I run the following code:

library("reticulate")
py_config()
use_python("/Users/aviral.s/.pyenv/versions/3.5.2/bin/python")
py_config() # Unchanged.

I tried using any of the available ones in the py_config() which worked by setting the environment variable as in here

However, if I set the same env variable to my pyenv version, I get this error:

> library("reticulate")
> py_config()
Error in initialize_python(required_module, use_environment) :
  Python shared library not found, Python bindings not loaded.

My env variable is correct:

echo $RETICULATE_PYTHON
/Users/aviral.s/.pyenv/versions/3.5.2/bin/python
Aviral Srivastava
  • 4,058
  • 8
  • 29
  • 81

1 Answers1

1

I ran into the same problem a few days ago and i had to jump through all kinds of hoops to get where i wanted and i am not sure which one did it for me, but what definitely helped was using py_discover_config() instead of the regular py_config() command.

what might be another problem, is that apparently a python version with installed numpy will always be preferred by reticulate:

Python info

thmspl
  • 2,437
  • 3
  • 22
  • 48
D.J
  • 1,180
  • 1
  • 8
  • 17