I’m working with Ubuntu 20.04 using Plasma KDE Desktop.
I’m setting up a data analysis and ML/DL environment using Miniconda3 where I can use both R and Python via rpy2. Specifically, I use pymc3, pystan, bambi libraries to build advanced Bayesian models. I recently found out about pybrms library that allows me to call brms R package that simplifies Bayesian model development using Stan probabilistic language.
After I created the new environment with python==3.6 (a rpy2 requirement, I installed the following:
conda install -c r r-base # version 3.6.1 of R
conda install -c r rpy2==3.1.0 # pybrms needs rpy2==3.1.0 or higher
pip install pybrms
I had corresponded with the developer of pybrms Adam Haber via the library github site after I ran into some issues. I used to the code below after successfully installing r-base, rpy2, and pybrms
import rpy2.robjects as robjects
import rpy2.robjects.packages as rpackages
from rpy2.robjects.vectors import StrVector
utils = rpackages.importr(“utils”)
utils.install_packages(StrVector((‘rsconnect’, ‘brms’))) # this command installs brms and its dependencies
This is where all things go haywire: brms has dependencies that are curl-dependent and independent of curl. All packages independent of curl and compiled and installed.
curl failed the first time with the following error:
Found pkg-config cflags and libs!
————————- ANTICONF ERROR —————————
Configuration failed because libcurl was not found. Try installing:
deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
rpm: libcurl-devel (Fedora, CentOS, RHEL)
csw: libcurl_dev (Solaris)
If libcurl is already installed, check that ‘pkg-config’ is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL –configure-vars=’INCLUDE_DIR=… LIB_DIR=…’
So I tried to install libcurl4-openssl-dev using sudo apt install libcurl4-openssl-dev.
I got the following message:
libcurl4-openssl-dev is already the newest version (7.68.0-1ubuntu2.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Searching on Stack Overflow users suggested that curl needs to be manually compiled if R in a conda environment is unable to recognize libcurl4 ( https://stackoverflow.com/questions/42115972/configuration-failed-because-libcurl-was-not-found )
So I used the code given there (I’m a beginner with Linux / Unix env)
In the new environment in miniconda3 where I installed rpy2 I checked that the file libcurl.pc was present in the pkgconfig folder and it is, but I’m unable to install curl.
Solution 3 – Since rpy2 and pybrms were in a conda environment i tried both of these steps:
conda install -c anaconda curl & conda install -c anaconda libcurl successfully
I tried to install curl again using rpy2 and pybrms – The same Config Error came about
I removed libcurl4-openssl-dev and reinstalled it and tried to install curl again and I failed.
What am I doing wrong? What else can I do? Thanks in advance.
As an Ubuntu newbie, this forum has been an invaluable resource – Thank You!!!