1

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.

1
  • 1
    I was able to fix this after installing python again with python dev dependencies, however now I get the below error : <Rcpp::exception in py_run_file_impl(file, local, convert): ModuleNotFoundError: No module named 'pandas' File "/usr/local/lib/R/site-library/reticulate/python/rpytools/loader.py", line 19, in _import_hook module = _import * Note the pandas library in installed in the python but reticulate is looking into some other library, I tried to print the RETICULATE PYTHON path but it is showing the correct python path to /usr/bin/python3 Commented Feb 3, 2021 at 7:29

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

1 Comment

Have extracted the python files in the same directory as python and r scripts, but still same error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.