Can't install the caret package in R (in my Linux machine) - linux

I am facing the following errors while trying to install the caret package in R.
g++: error: /tmp/Rtmp2Tos7n/R.INSTALL2e6e30153a74/nloptr/nlopt-2.4.2/lib/libnlopt_cxx.a:
No such file or directory make: *** [nloptr.so] Error 1
ERROR: compilation failed for package ‘nloptr’
* removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/nloptr’
Warning in install.packages :
installation of package ‘nloptr’ had non-zero exit status
ERROR: dependency ‘nloptr’ is not available for package ‘lme4’
* removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/lme4’
Warning in install.packages :
installation of package ‘lme4’ had non-zero exit status
ERROR: dependency ‘lme4’ is not available for package ‘pbkrtest’
* removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/pbkrtest’
Warning in install.packages :
installation of package ‘pbkrtest’ had non-zero exit status
ERROR: dependency ‘lme4’ is not available for package ‘BradleyTerry2’
* removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/BradleyTerry2’
Warning in install.packages :
installation of package ‘BradleyTerry2’ had non-zero exit status
ERROR: dependency ‘pbkrtest’ is not available for package ‘car’
* removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/car’
Warning in install.packages :
installation of package ‘car’ had non-zero exit status
ERROR: dependencies ‘car’, ‘BradleyTerry2’ are not available for package ‘caret’
* removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/caret’
Warning in install.packages :
installation of package ‘caret’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpG9dYqn/downloaded_packages’
I looked into this other question that had a similar problem
Dependency issue while installing caret package in R
The solution for this problem was to install each of the dependencies first, but they all had the same error message. For example:
>install.packages('nloptr')
g++: error: /tmp/RtmpgEn54A/R.INSTALL7015350f0d03/nloptr/nlopt-2.4.2/lib/libnlopt_cxx.a: No such file or directory
make: *** [nloptr.so] Error 1
ERROR: compilation failed for package ‘nloptr’
* removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/nloptr’
Warning in install.packages :
installation of package ‘nloptr’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpG9dYqn/downloaded_packages’
I also tried changing the repos ie. install.packages('caret', repos='http://cran.rstudio.com/') but it dint work either.
My session info is given below:
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-suse-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.1.2

I recently encountered the problem with nlopt as well. It was easily solved by installing nlopt-devel and its associated dependencies from YaST (or your preferred package manager).

I was hoping to add a comment first. On Jan 28, 2015, there was an addition to the nloptr package in github that possibly broke the compilation. I used a workaround by installing from an older version with the command
install.packages("http://cran.r-project.org/src/contrib/Archive/nloptr/nloptr_1.0.0.tar.gz",
repos=NULL, type="source")

As mentioned in this R help forum:
http://r.789695.n4.nabble.com/can-t-install-rugarch-and-nloptr-packages-in-R-3-01-opensuse-linux-td4669649.html
add the line to the src/Makevars file
mv .libs lib; \
between
make install; \
ls | grep -v ^include$$ | grep -v ^lib$$ | xargs rm -rf; \
This will remove the compilation error and you would be able to install nloptr package. I have tested this for nloptr_1.0.0.tar.gz .

I solve this issue by installing first "car" from synaptic (use filter with "cran-car").
And then I install "caret" with rstudio but I guess it will work also for R.
Hope it helps,
Regards

Related

Issue when installing lablgtk with opam

I'l trying to install a package (https://github.com/SchornacklabSLCU/amfinder) that use opam to install several libraries. However, two libraries failed to install: lablgtk and cairo2-gtk.I tried to install these two directly via opam (opam install labgtk) but got the same error:
User configuration:
~/.profile is already up-to-date.
[NOTE] Make sure that ~/.profile is well sourced in your ~/.bashrc.
[ERROR] There already is an installed switch named 4.08.0
[NOTE] Package camlzip is already installed (current version is 1.11).
[NOTE] Package magic-mime is already installed (current version is 1.2.0).
[NOTE] Package cairo2 is already installed (current version is 0.6.2).
[NOTE] Package odoc is already installed (current version is 2.0.0).
[NOTE] Package dune is already installed (current version is 2.9.1).
The following actions will be performed:
∗ install lablgtk 2.18.11
∗ install cairo2-gtk 0.6.2
===== ∗ 2 =====
Do you want to continue? [Y/n] y
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved cairo2-gtk.0.6.2 (cached)
⬇ retrieved lablgtk.2.18.11 (cached)
[ERROR] The compilation of lablgtk.2.18.11 failed at "./configure --prefix /home/alr/.opam/4.08.0
LABLGLDIR=/home/alr/.opam/4.08.0/lib/lablgl".
#=== ERROR while compiling lablgtk.2.18.11 ====================================#
# context 2.1.1 | linux/x86_64 | ocaml-base-compiler.4.08.0 | https://opam.ocaml.org#03fce048
# path ~/.opam/4.08.0/.opam-switch/build/lablgtk.2.18.11
# command ~/.opam/opam-init/hooks/sandbox.sh build ./configure --prefix /home/alr/.opam/4.08.0 LABLGLDIR=/home/alr/.opam/4.08.0/lib/lablgl
# exit-code 1
# env-file ~/.opam/log/lablgtk-16902-8d49b3.env
# output-file ~/.opam/log/lablgtk-16902-8d49b3.out
### output ###
# [...]
# checking native dynlink... checking for pkg-config... /home/linuxbrew/.linuxbrew/bin/pkg-config
# checking for GTK+ - version >= 2.0.0...
# *** 'pkg-config --modversion gtk+-2.0' returned 2.24.33, but GTK+ (2.24.32)
# *** was found! If pkg-config was correct, then it is best
# *** to remove the old version of GTK+. You may also be able to fix the error
# *** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing
# *** /etc/ld.so.conf. Make sure you have run ldconfig if that is
# *** required on your system.
# *** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH
# *** to point to the correct configuration files
# no
# configure: error: GTK+ is required
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build lablgtk 2.18.11
└─
╶─ No changes have been performed
<><> lablgtk.2.18.11 troubleshooting ><><><><><><><><><><><><><><><><><><><><><>
=> This package requires gtk+ 2.0 development packages installed on your system
File "dune", line 4, characters 29-39:
4 | (libraries lablgtk2 cairo2 cairo2-gtk camlzip magic-mime)
^^^^^^^^^^
Error: Library "cairo2-gtk" not found.
pkg-config --modversion gtk+-2.0returns 2.24.33
echo $LD_LIBRARY_PATHreturns empty path.
echo $PKG_CONFIG_PATHreturns /home/alr/.opam/4.08.0/lib/pkgconfig:
File /etc/ld.so.conf contains the following line: include /etc/ld.so.conf.d/*.conf
I am using WSL2 on Windows10 with Ubuntu18.04. libgtk2.0-dev is already installed.
I guess there is an error in path to library but cannot figure out how to solve it.
Any help would be greatly appreciated.
Thanks

Stack setup fails with package installation errors

I'm trying to get stack running for the first time, but running stack setup in an example project (from stack new helloworld new-template) fails with the following output (I skipped the beginning, which I think was normal):
Installing library in
/home/ajl/.stack/programs/x86_64-linux/ghc-7.10.2/lib/ghc7.10.2/ghc_JzwEp1oQ8kA7NFNTGk1ho5 "/home/ajl/.stack/programs/x86_64-linux/ghc-7.10.2/lib/ghc-7.10.2/bin/ghc-pkg" --force --global-package-db "/home/ajl/.stack/programs/x86_64-linux/ghc-7.10.2/lib/ghc-7.10.2/package.conf.d" update rts/dist/package.conf.install
Reading package info from "rts/dist/package.conf.install" ... done.
: Warning: Unrecognized field 420 on line 420
(Skipped unrecognized field for every line 419 down to 1)
: Warning: Unrecognized field 1 on line 1
: missing id field
: invalid package identifier:
: invalid package key:
make[1]: *** [install_packages] Error 1
make: *** [install] Error 2
Installing GHC ...%
I'm on Ubuntu 14.04, running stack 1.0.2. Not sure if it's relevant but I have ghc 7.10.1 with Cabal 1.23.0.0 installed on the system already, which work fine.
I have tried changing the resolver to older LTS versions with older ghc versions. I also tried deleting ~/.stack. Not sure what else to try given the unhelpfulness of the errors.
I figured it out. The GHC build uses grep to make packages.conf.install. I have GREP_OPTIONS=--color=auto -n set in my zsh config. The -n was putting line numbers in front of everything, which was causing the errors.
The reason I couldn't find packages.conf.install anywhere before is because it is made on the fly during GHC make. And stack does that in /tmp.

dependency error in R package

Everytime I give the command for any package, in this case for ggplot2, I get this after a few minutes. I am missing something, but can't figure out what. Thanks in advance!
ERROR: dependency ‘plyr’ is not available for package ‘reshape2’
* removing ‘/home/cj/R/x86_64-pc-linux-gnu-library/2.14/reshape2’
Warning in install.packages :
installation of package ‘reshape2’ had non-zero exit status
ERROR: dependency ‘plyr’ is not available for package ‘scales’
* removing ‘/home/cj/R/x86_64-pc-linux-gnu-library/2.14/scales’
Warning in install.packages :
installation of package ‘scales’ had non-zero exit status
ERROR: dependencies ‘plyr’, ‘reshape2’, ‘scales’ are not available for package ‘ggplot2’
* removing ‘/home/cj/R/x86_64-pc-linux-gnu-library/2.14/ggplot2’
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
The downloaded packages are in
‘/tmp/RtmpAXVGC6/downloaded_packages’
You are on R 2.14. Please please PLEASE upgrade to something from the last few years -- preferably from the current year such as R 3.2.0, 3.2.1 or the recently-release 3.2.2.
Simply put, you are being unreasonable in trying to expect that current and well-maintained archived for users of the current versions should also work with versions released that many years ago.

Can't install ggplot2 at debian 7.6 in R

Today i'm trying to install a good library for visualization and create graphics, named "ggplot2", but i actually have a problems with installation!
There what i have in output:
Installing package into ‘/home/hamsternik/R/x86_64-pc-linux-gnu-library/3.1’ (as ‘lib’ is unspecified)
also installing the dependencies ‘munsell’, ‘scales’, ‘testthat’
trying URL 'http://cran.rstudio.com/src/contrib/munsell_0.4.2.tar.gz' Content type 'application/x-gzip' length 91026 bytes (88 Kb) opened URL ==================================================
downloaded 88 Kb trying URL 'http://cran.rstudio.com/src/contrib/scales_0.2.4.tar.gz' Content type 'application/x-gzip' length 40093 bytes (39 Kb) opened URL ==================================================
downloaded 39 Kb trying URL 'http://cran.rstudio.com/src/contrib/testthat_0.8.1.tar.gz' Content type 'application/x-gzip' length 40777 bytes (39 Kb) opened URL ==================================================
downloaded 39 Kb trying URL 'http://cran.rstudio.com/src/contrib/ggplot2_1.0.0.tar.gz' Content type 'application/x-gzip' length 2351447 bytes (2.2 Mb) opened URL ==================================================
downloaded 2.2 Mb * installing source package ‘munsell’ ... ** package ‘munsell’ successfully unpacked and MD5 sums checked ** R ** inst ** preparing package for lazy loading Error : package ‘colorspace’ was built before R 3.0.0: please re-install it ERROR: lazy loading failed for package ‘munsell’ * removing ‘/home/hamsternik/R/x86_64-pc-linux-gnu-library/3.1/munsell’
Warning in install.packages : installation of package ‘munsell’ had non-zero exit status * installing source package ‘testthat’ ... ** package ‘testthat’ successfully unpacked and MD5 sums checked ** R ** inst ** preparing package for lazy loading Error : package ‘digest’ was built before R 3.0.0: please re-install it ERROR: lazy loading failed for package ‘testthat’ * removing ‘/home/hamsternik/R/x86_64-pc-linux-gnu-library/3.1/testthat’
Warning in install.packages : installation of package ‘testthat’ had non-zero exit status ERROR: dependency ‘munsell’ is not available for package ‘scales’ * removing ‘/home/hamsternik/R/x86_64-pc-linux-gnu-library/3.1/scales’
Warning in install.packages : installation of package ‘scales’ had non-zero exit status ERROR: dependency ‘scales’ is not available for package ‘ggplot2’ * removing ‘/home/hamsternik/R/x86_64-pc-linux-gnu-library/3.1/ggplot2’
Warning in install.packages : installation of package ‘ggplot2’ had non-zero exit status The downloaded source packages are in ‘/tmp/RtmpDEeNck/downloaded_packages’
I actually use a debian-stable system (v.7.6) and the next decision was to install "r-cran-ggplot2" in the console.
And when i install them, i think about i having this library, but when i write in Rstudio: library(ggplot2), i take next message: Error: package ‘ggplot2’ was built before R 3.0.0: please re-install it
But i have a the up-to-date version - 3.1.1!
I really don't find any good answers for that question! PLeas, help!
OK, problem is actually done!
All what i make - remove all packages, including 'R-cran-.*' and again install it, but not install all packages which i find by the search command in konsole. I install only r-base, next i install R studio. Thus i can straightforwardly install every package with dependencies and they will be actually installed!

Cabal install complains "<built-in>:0:4: lexical error (UTF-8 decoding error)"

I am using Windows 7 with locale zh_CN and ghc-7.0.4
Default code page of the cmd.exe is 936.
> cabal install ghc-mod
Resolving dependencies...
Configuring ghc-syb-utils-0.2.1.0...
Preprocessing library ghc-syb-utils-0.2.1.0...
Building ghc-syb-utils-0.2.1.0...
<built-in>:0:4: lexical error (UTF-8 decoding error)
cabal: Error: some packages failed to install:
ghc-mod-1.10.7 depends on ghc-syb-utils-0.2.1.0 which failed to install.
ghc-syb-utils-0.2.1.0 failed during the building phase. The exception was:
ExitFailure 1
I have tried change code page and re-install again, but get the same output.
> chcp 65001
> cabal install ghc-mod
Some packages can be built successfully:
xml-1.3.12 textmath-0.6.0.3 tagsoup-0.12.6
Some packages would fail:
temporary-1.1.2.3 utf8-string-0.3.7 pandoc-types-1.9.0.2 json-0.5
I encountered the same problem.
I don't know if the cause is the same, but try
set LANG=C
before you run cabal. In my case, that fixed the problem.

Resources