rvest read_html function does not work RRS feed

  • Question

  • When trying to use read_html, I receive the following error:

    Error in open.connection(x, "rb") : error setting certificate verify locations: CAfile: microsoft-r-cacert.pem CApath: none

    This function works on my MacBook running standard R 3.4.3 on OSX El Capitan. I'm now trying to use it on a server running MRO 3.4.3 on Ubuntu 16.04.

    Sunday, February 4, 2018 7:47 PM

All replies

  • I would check a few things, in addition you may need to set an environment variable on Linux to get things to work:

    1).  Make sure that the file 'microsoft-r-cacert.pem' exists in the following directory and has a size greater than 0 bytes:


    2). Try setting the following environment variable in the R console, before running your code:

    Sys.setenv(CURL_CA_BUNDLE = "/opt/Microsoft/ropen/3.4.3/lib64/R/lib/microsoft-r-cacert.pem")

    Hope this helps.

    Stephen Weller

    Microsoft R Product Team

    Thursday, February 8, 2018 9:33 PM
  • I have the same problem, Just installed  Microsoft R3.4.3 on Red Hat Centos 6.8, and trying to install the tokenizer library from github using install_github("ropensci/tokenizer") to get the fix that eliminates the c++11 flag and substitutes  the c++0x flag.

    > install_github("ropensci/tokenizer")
    Installation failed: error setting certificate verify locations:

    error setting certificate verify locations:

    CAfile: microsoft-r-cacert.pem CApath: none

    I have double checked the location and contents of the pem file. It is fine.

    Any ideas?

    Tuesday, April 3, 2018 3:44 PM
  • We have determined that the problem is due to a change in the R package 'curl'.

    You can workaround the issue as follows:

    1). Open a new MRO session and remove the packages 'curl' and 'httr':


    2). Restart MRO and install the packages again, this time using 'install.packages()' function:

    install.packages(c("curl", "httr"))

    3).  Set the environment variable 'CURL_CA_BUNDLE':


    4). Try installing a package using install_github() from github(this should now work):

    For example:

    Wednesday, April 4, 2018 10:54 PM
  • Just a note: this also worked using the `conda` installation, and when encountering a similar issue with `tidycensus::get_acs`. Installing packages outside of conda makes me nervous, but no problems so far.

    Will this be fixed in the next version of MRO?

    • Edited by Max Ghenis Wednesday, July 18, 2018 7:50 PM
    Wednesday, July 18, 2018 7:50 PM
  • I found a very simple hack. My variable PKG_CONFIG_PATH was unset

    export PKG_CONFIG_PATH=/home/easysadmin/anaconda3/envs/py34/lib/pkgconfig:$PKG_CONFIG_PATH

    run R

    and then it installs


    Friday, August 17, 2018 10:11 AM