I am trying to install Rjags on Ubuntu, I have first installed this
sudo apt-get install JAGS
Then I have tried
R
install.packages("rjags")
I have the following error
> install.packages("rjags")
Installing package into ‘/home/louis/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 71719 100 71719 0 0 46062 0 0:00:01 0:00:01 --:--:-- 46032
* installing *source* package ‘rjags’ ...
** package ‘rjags’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/bin/pkg-config
configure: Setting compile and link flags according to pkg-config
configure: Compile flags are -I/usr/include/JAGS
configure: Link flags are -ljags
checking for gcc... x86_64-conda_cos6-linux-gnu-cc
checking whether we are using the GNU C compiler... no
checking whether x86_64-conda_cos6-linux-gnu-cc accepts -g... no
checking for x86_64-conda_cos6-linux-gnu-cc option to accept ISO C89... unsupported
checking for jags_version in -ljags... no
configure: error: "cannot link to JAGS library in /usr/lib."
ERROR: configuration failed for package ‘rjags’
* removing ‘/home/charlie/R/x86_64-pc-linux-gnu-library/3.4/rjags’
The downloaded source packages are in
‘/tmp/Rtmp9yfeon/downloaded_packages’
Warning message:
In install.packages("rjags") :
installation of package ‘rjags’ had non-zero exit status
I don't know how to solve this issue, thanks for your help
Andrey Kolyadin, I have followed your instruction, after installing I got this
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
r-cran-rjags
1 upgraded, 0 newly installed, 0 to remove and 296 not upgraded.
Need to get 88,6 kB of archives.
After this operation, 1 024 B of additional disk space will be used.
Get:1 http://ppa.launchpad.net/marutter/rrutter/ubuntu xenial/main amd64 r-cran-rjags amd64 1:4.6-1cran4ubuntu1ppa1~ubuntu16.04.1~ppa1 [88,6 kB]
Fetched 88,6 kB in 1s (68,8 kB/s)
(Reading database ... 250343 files and directories currently installed.)
Preparing to unpack .../r-cran-rjags_1%3a4.6-1cran4ubuntu1ppa1~ubuntu16.04.1~ppa1_amd64.deb ...
Unpacking r-cran-rjags (1:4.6-1cran4ubuntu1ppa1~ubuntu16.04.1~ppa1) over (1:4-5-1) ...
Setting up r-cran-rjags (1:4.6-1cran4ubuntu1ppa1~ubuntu16.04.1~ppa1) ...
THen I have tried to call the library in R but it is not detected, unfortunately ...
If you installed it from the ppa suggested by andrey, remove it with
sudo apt-add-repository --remove ppa:marutter/rrutter
(Then) update your data:
sudo apt update
and then install it from the default
sudo apt install r-cran-rjags
Test it in R.
R
In R:
>library(rjags)
# Loading required package: coda
# Linked to JAGS 4.2.0
# Loaded modules: basemod,bugs
(probably redundant, just for SEO^^:) Works also for Linux Mint
Related
OK, this is driving me crazy.
I'm attempting to use Conda as a quasi-package manager for R on my Mac (OS 10.15) as I have done (successfully) on other Unix installations.
Repeatedly, the error I get is the following
Before the creation of a new conda environment, we have:
$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
and
$ which clang
/usr/bin/clang
We create a new empty environment and check again
$ conda create --name r_env
$ conda activate r_env
$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ which clang
/usr/bin/clang
Great. So far so good.
Now we install R and check again.
$ conda install r=3.6
$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ which clang
/Users/dgarfield/miniconda3/envs/r_env/bin/clang
$ clang -v
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin19.2.0
Thread model: posix
InstalledDir: /Users/dgarfield/miniconda3/envs/r_env/bin
It appears that we have a new clang!
Why is this a problem?
$ R
> install.packages("XML")
trying URL 'https://cran.uni-muenster.de/src/contrib/XML_3.98-1.20.tar.gz'
Content type 'application/x-gzip' length 1600829 bytes (1.5 MB)
==================================================
downloaded 1.5 MB
* installing *source* package ‘XML’ ...
** package ‘XML’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... x86_64-apple-darwin13.4.0-clang
checking whether the C compiler works... no
configure: error: in `/private/var/folders/dg/hbvl43fn0b7flfk6l__3bwth0000gq/T/Rtmplh4pEL/R.INSTALL12b2d7b634136/XML':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘XML’
* removing ‘/Users/dgarfield/miniconda3/envs/r_env/lib/R/library/XML’
The downloaded source packages are in
‘/private/var/folders/dg/hbvl43fn0b7flfk6l__3bwth0000gq/T/RtmpaiTLe8/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("XML") :
installation of package ‘XML’ had non-zero exit status
This works perfectly fine on a standard (non-Conda) installation. My guess is that the culprit is this new clang.
Following what I have seen elsewhere, I have tried this with
CONDA_BUILD_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
and
CONDA_BUILD_SYSROOT=/opt/MacOSX10.9.sdk
So it doesn't seem to be anything too weird with the headers (??). But I'm out of ideas and could use some guidance.
(and yes, I know that in the case of XML, conda could to the install for me, but that isn't the case for all packages).
Thanks!
Trying to install the XML package as follows I get the error configure: error: "libxml not found". It seems that R is picking up the libxml2 installation from Anaconda. How can I fix this?
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
> install.packages("XML")
Installing package into ‘/home/bravegag/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/XML_3.98-1.19.tar.gz'
Content type 'application/x-gzip' length 1600788 bytes (1.5 MB)
==================================================
downloaded 1.5 MB
* installing *source* package ‘XML’ ...
** package ‘XML’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for sed... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking for xml2-config... /opt/dev/anaconda/2018.12/bin/xml2-config
USE_XML2 = yes
SED_EXTENDED_ARG: -E
Minor 9, Patch 8 for 2.9.8
Located parser file -I/opt/dev/anaconda/2018.12/include/libxml2 -I/opt/dev/anaconda/2018.12/include/parser.h
Checking for 1.8: -I/opt/dev/anaconda/2018.12/include/libxml2 -I/opt/dev/anaconda/2018.12/include
Using libxml2.*
checking for gzopen in -lz... yes
checking for xmlParseFile in -lxml2... no
checking for xmlParseFile in -lxml... no
configure: error: "libxml not found"
ERROR: configuration failed for package ‘XML’
* removing ‘/home/bravegag/R/x86_64-pc-linux-gnu-library/3.4/XML’
The downloaded source packages are in
‘/tmp/RtmpannHh6/downloaded_packages’
Warning message:
In install.packages("XML") :
installation of package ‘XML’ had non-zero exit status
>
I also get this:
$ type xml2-config
xml2-config is /opt/dev/anaconda/2018.12/bin/xml2-config
but setting the config in the R environment doesn't help:
Sys.setenv(XML_CONFIG="/opt/dev/anaconda/2018.12/bin/xml2-config")
UPDATE I already had libxml2 installed in the system see:
bravegag#zeus:~$ sudo apt-get install libxml2
Reading package lists... Done
Building dependency tree
Reading state information... Done
libxml2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
bravegag#zeus:~$ sudo apt-get install libxml2-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libxml2-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
Make sure your system has the libxml-dev or libxml2-dev package installed. i.e.
sudo apt-get install libxml2-dev
I'm unable to determine which is the right version (libxml or libxml2) for 14.04 but you'll want to make sure you have the -dev version installed.
I had the same error but libxml2-dev was already installed so that didn't help.
What did help was to install libxml through conda using
conda install r-xml
I think there is a problem with the environment variables when you install R through conda.
I attempt to install Cairo package in R under a Docker Ubuntu 18.04 container. Before installing the R Cairo package, I installed these packets in Ubuntu: libgtk2.0-dev, libcairo2-dev, xvfb, xauth, xfonts-base, r-base-dev, and libxt-dev.
However, when I installed Cairo package in R, I got the following error:
checking if R was compiled with the RConn patch... no
checking cairo.h usability... yes
checking cairo.h presence... yes
checking for cairo.h... yes
checking for PNG support in Cairo... yes
checking for ATS font support in Cairo... no
configure: CAIRO_LIBS=-lfreetype -lz -lpng16 -lz -lcairo -lXext -lXrender -lX11
checking for library containing deflate... no
checking whether Cairo programs can be compiled... configure: error: Cannot
compile a simple Cairo program. See config.log for details.
ERROR: configuration failed for package ‘Cairo’
* removing ‘/opt/conda/lib/R/library/Cairo’
The downloaded source packages are in
‘/tmp/RtmprETcPh/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("Cairo") :
installation of package ‘Cairo’ had non-zero exit status
I've checked /tmp/RtmprETcPh/downloaded_packages, and there is only a filed called Cairo_1.5-9.tar.gz. And I don't know where to find config.log for more compile details of compiling a simple Cairo program.
Please help me to resolve out this issue if anybody know how to resolve out this issue.
Thank you
You may need to install the x11 dev libs since the docker container is likely not running these.
Try
sudo apt-get install libx11-dev
Under ubuntu 20.04, after installing libx11-dev, trying to install Cairo gave the error X11/Intrinsic.h not found. This is in libxt-dev. After installing this, Cairo could be installed.
I have looked at the multiple sources to figure out how to install rgeos and rgdal on Mac OS X High Sierra in a way that works with Anaconda Navigator. I mention Anaconda because I want to be able to build static project-specific, package environments to ensure that my projects work 6 months from now when the dependent packages change. I have successfully installed and used both rgeos and rgdal on a couple other computers but seem to be having issues on a new computer. I want to launch Shiny apps from Anaconda Navigator's RStudio. None of the solutions I found, listed below, worked:
https://dyerlab.ces.vcu.edu/2015/03/31/install-rgeos-on-osx/
https://cran.rstudio.com/web/packages/rgeos/rgeos.pdf
http://tlocoh.r-forge.r-project.org/mac_rgeos_rgdal.html
https://anaconda.org/conda-forge/r-rgdal
Based on the above sources and my slow progression through a series of error messages, I tried the following:
Install GDAL 2.2 Complete [30.0 MiB] 2018-3-10 from http://www.kyngchaos.com/software/frameworks. This installs GDAL, GEOS, PROJ, SQLite and UnixImageIO frameworks.
The above installed without an error message. But attempting to install rgeos gave an error message:
configure: error: geos-config not found or not executable.
Consequently, either the install failed and didn't notify me, or there is some type of $PATH issue (?). On a blog, someone suggested to do the following in response to the aforementioned issue:
brew install geos
The above completed successfully. So I went into RStudio and tried the following, which resolved the former error but produced a new one:
install.packages("~/Downloads/rgeos_0.3-28.tar.gz", repos = NULL, type = "source")
installing source package ‘rgeos’ ...
configure: CC: x86_64-apple-darwin13.4.0-clang
configure: CXX: x86_64-apple-darwin13.4.0-clang++
configure: rgeos: 0.3-28
checking for /usr/bin/svnversion... yes
cat: inst/SVN_VERSION: No such file or directory
configure: svn revision:
checking for geos-config... /usr/local/bin/geos-config
checking geos-config usability... yes
configure: GEOS version: 3.6.2
checking geos version at least 3.2.0... yes
checking geos-config clibs... yes
checking geos_c.h presence and usability... no
configure: error: geos_c.h not found in standard or given locations.
ERROR: configuration failed for package ‘rgeos’
removing ‘/Users/aloha2018/anaconda2/lib/R/library/rgeos’
Warning in install.packages :
installation of package ‘/Users/aloha2018/Downloads/rgeos_0.3-28.tar.gz’ had non-zero exit status
Any ideas on what to try next?
Naturally, I already tried in an RStudio application launched from Anaconda Navigator:
install.packages("rgeos")
install.packages("rgdal")
both from CRAN and from tar.gz. But it seems like it is unable to find a file called geos_c.h, which does indeed exist on my computer at:
/Library/Frameworks/GEOS.framework/Versions/3B/Headers/geos_c.h
Is there a way to tell RStudio to look in the directory containing that file so my rgeos and rgdal installations work? Are there other errors I should expect to encounter and if so, how do I avoid/resolve them?
I also tried in a Terminal window:
conda install -c conda-forge r-rgdal
but that fails after spending a long time attempting to "solve environment":
Andrews-MacBook-Pro:~ aloha2018$ conda install -c conda-forge r-rgdal
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- r-rgdal
- rstudio==1.1.423
Use "conda info <package>" to see the dependencies for each package.
So I try:
conda r-rgdal
But there is no output:
Andrews-MacBook-Pro:~ aloha2018$ conda info r-rgdal
Andrews-MacBook-Pro:~ aloha2018$
I've had a similar issue. I first solved it by installing everything using conda using the following environment.yml configuration
name: london-crime-r
channels:
- conda-forge
- conda
dependencies:
- gdal
- geos
- r-base
- r-rcpp
- r-irkernel
- r-mass
- r-dplyr
- r-rgdal
- r-rgeos
- r-raster
- rstudio
However, after updating conda, resolving dependencies did not finish within the 10 hours so I went the traditional route:
Use brew to install geos and gdal. It takes 40 minutes to build on my machine.
brew install geos gdal
Once that has been achieved, install R packages in this sequence.
install.packages('sp', type='source')
install.packages("rgeos", repos="http://R-Forge.R-project.org", type="source")
require(rgeos)
install.packages("rgdal", repos="http://R-Forge.R-project.org", type="source")
require(rgdal)
Subsequently, the packages below are ok with the plain install.
libraries <- c("rgdal",
"rgeos",
"raster",
"spdep",
"spatstat")
install.packages(libraries)
I want to to install rgl on R-Server, running on Ubuntu.
At the bas prompt I installed
sudo apt-get build-dep r-cran-rgl
Reading package lists... Done Building dependency tree Reading state
information... Done The following extra packages will be installed:
libglu1-mesa The following NEW packages will be installed:
libglu1-mesa r-cran-rgl 0 upgraded, 2 newly installed, 0 to remove and
0 not upgraded. Need to get 1,645 kB of archives. After this
operation, 3,875 kB of additional disk space will be used. Do you want
to continue? [Y/n] Y Get:1 http://archive.ubuntu.com/ubuntu/
trusty/main libglu1-mesa amd64 9.0.0-2 [195 kB] Get:2
http://archive.ubuntu.com/ubuntu/ trusty/universe r-cran-rgl amd64
0.93.996-1 [1,450 kB] Fetched 1,645 kB in 1s (1,047 kB/s) Selecting previously unselected package libglu1-mesa:amd64. (Reading database
... 55586 files and directories currently installed.) Preparing to
unpack .../libglu1-mesa_9.0.0-2_amd64.deb ... Unpacking
libglu1-mesa:amd64 (9.0.0-2) ... Selecting previously unselected
package r-cran-rgl. Preparing to unpack
.../r-cran-rgl_0.93.996-1_amd64.deb ... Unpacking r-cran-rgl
(0.93.996-1) ... Setting up libglu1-mesa:amd64 (9.0.0-2) ... Setting
up r-cran-rgl (0.93.996-1) ... Processing triggers for libc-bin
(2.19-0ubuntu6.6) ...
Thats it. The three points at the end do not indicate that there was more to copy. Then I logged in into R-Server and tried to run
install.packages("rgl", repos="http://R-Forge.R-project.org")
which resulted in an error, namely:
....
configure: using libpng-config
configure: using libpng dynamic linkage
checking for X... libraries , headers
checking GL/gl.h usability... no
checking GL/gl.h presence... no
checking for GL/gl.h... no
checking GL/glu.h usability... no
checking GL/glu.h presence... no
checking for GL/glu.h... no
configure: error: missing required header GL/gl.h
ERROR: configuration failed for package ‘rgl’
* removing ‘/home/clambio/R/x86_64-pc-linux-gnu-library/3.2/rgl’
Warning in install.packages :
installation of package ‘rgl’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpT5iyrb/downloaded_packages’
Any ideas what is going wrong?!
I solved this problem by installing
sudo apt-get install mesa-common-dev libglu1-mesa-dev
then install in R again:
install.packages("rgl")