I can't install this package - Install.packages("openssl")

Installing package into ‘/home/shaam/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/openssl_1.4.4.tar.gz'
Content type 'application/x-gzip' length 1311285 bytes (1.3 MB)
downloaded 1.3 MB

* installing *source* package ‘openssl’ ...
 package ‘openssl’ successfully unpacked and MD5 sums checked
 using staged installation
--------------------------- [ANTICONF] --------------------------------
Configuration failed because openssl was not found. Try installing:
 * deb: libssl-dev (Debian, Ubuntu, etc)
 * rpm: openssl-devel (Fedora, CentOS, RHEL)
 * csw: libssl_dev (Solaris)
 * brew: openssl@1.1 (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.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=...'
-------------------------- [ERROR MESSAGE] ---------------------------
tools/version.c:1:10: fatal error: openssl/opensslv.h: No such file or directory
    1 | #include <openssl/opensslv.h>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
ERROR: configuration failed for package ‘openssl’
* removing ‘/home/shaam/R/x86_64-pc-linux-gnu-library/3.6/openssl’
Warning in install.packages :
  installation of package ‘openssl’ had non-zero exit status

The downloaded source packages are in

Have a look at the error message. What happens after you follow these instructions?

I try to install every time I get the same error

If you get the same error message message then you haven't installed the missing package dependency in your system successfully.

Can you please be more specific? What Linux distribution are you using? What command are you using to install openssl in your system (not in R)? Do you get any error message while installing the openssl system library?

I'm using Ubuntu the command I type in R is install.package I don't install packages via system but I was able to download the bnlearn package

The error message is telling you that you are missing a system dependency so in order to install the R package (which is a wrapper for the system library) you need to install the system library first. On ubuntu you should run this command in a system terminal.

sudo apt install libssl-dev

Ok I will try but I have a question about conflict data What are the commands or methods in bnlearn library about conflict data

That is a very different question, we like to keep things tidy around here so please ask it on a new topic providing a relevant REPRoducible EXample (reprex) illustrating your issue.

I'm having the same issue to OP. From what I can see in the terminal OpenSSL is installed:

$ openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017
$ locate opensslv.h

Anyone know if these are the wrong versions, and should I be asking my sysadmin to install libssl-dev? Or is it a matter of getting R Studio to search for OpenSSL in the right location when installing the package? Any help much appreciated.

I think you have openssl R and Python packages installed but not the system library, I don't know about python but at least the R package is just a wraper for the system library so it is mandatory.

1 Like

You could be right, but from what I can see the system library is installed. Maybe it's just the wrong version of OpenSSL. I'll try installing it on my own PC, see if I can make it work in an environment where I have a bit more control.