Pawan Rama Mali
Pawan Rama Mali

Reputation: 551

Reticulate python not recognizing local python : Error: Python shared library not found, Python bindings not loaded

I have downloaded the python tar and extracted locally in linux ubuntu /app folder, When I configure this python using the R reticulate I get the error message " Error: Python shared library not found, Python bindings not loaded. Use reticulate::install_miniconda() if you'd like to install a Miniconda Python environment."

Here is the code I am running on R


> Python_Script_version<<-paste0("/app/bin/Python-3.9.1")
> Sys.setenv(RETICULATE_PYTHON= Python_Script_version)
> reticulate ::use_python(Python_Script_version, required = TRUE)

> Sys.which("python")
                               python 
"/app/bin/Python-3.9.1/python" 

> library(reticulate)
> py_config()
Error in py_config() : could not find function "py_config"
> reticulate::py_config()
Error: Python shared library not found, Python bindings not loaded.
Use reticulate::install_miniconda() if you'd like to install a Miniconda Python environment.

Thank you for your time and response.

Upvotes: 1

Views: 2921

Answers (2)

Takuro Ikeda
Takuro Ikeda

Reputation: 178

This worked for me!

> apt-get update && apt-get upgrade -y  
> apt-get install -y r-base python3 python3-dev python3-pip python3-venv  
> R  
> install.packages("reticulate")  
> library(reticulate)  
> reticulate::py_discover_config()  
python:         /usr/bin/python3  
libpython:      /usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so  
pythonhome:     /usr:/usr  
version:        3.6.8 (default, Oct  7 2019, 12:59:55)  [GCC 8.3.0]  
numpy:           [NOT FOUND]  
> py_install("pandas") # install another python package as a test  
> pandas <- import("pandas")  

from this issue.
https://github.com/rstudio/reticulate/issues/637

Upvotes: 1

Mriti Agarwal
Mriti Agarwal

Reputation: 216

You need to extract the python files in the same directory as your python and r scripts

Upvotes: 0

Related Questions