Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot install units in rstudio despite possible from the regular R console #219

Closed
lduvaux opened this issue Dec 4, 2019 · 7 comments
Closed

Comments

@lduvaux
Copy link

lduvaux commented Dec 4, 2019

Hi,
I successfully managed to install unitsfrom the regular R console:

[ludo@garuda ~]$ R
R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

> library(units)
udunits system database from /usr/local/share/udunits

but when I try to install units from rstudio, it does not work with the following error:

> install.packages("units")
Installing package into ‘/home/ludo/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/units_0.6-5.tar.gz'
Content type 'application/x-gzip' length 959970 bytes (937 KB)
==================================================
downloaded 937 KB

* installing *source* package ‘units’ ...
** package ‘units’ successfully unpacked and MD5 sums checked
** using staged installation
configure: units: 0.6-4
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 g++ -std=gnu++11 accepts -g... yes
checking how to run the C++ preprocessor... g++ -std=gnu++11 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdbool.h that conforms to C99... no
checking for _Bool... no
checking for error_at_line... yes
checking for gcc... gcc
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 for XML_ParserCreate in -lexpat... yes
checking udunits2.h usability... yes
checking udunits2.h presence... yes
checking for udunits2.h... yes
checking for ut_read_xml in -ludunits2... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG -DUDUNITS2_DIR=0   -D_FORTIFY_SOURCE=2 -I"/home/ludo/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -D_FORTIFY_SOURCE=2  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt  -c RcppExports.cpp -o RcppExports.o
gcc -I"/usr/include/R/" -DNDEBUG -DUDUNITS2_DIR=0   -D_FORTIFY_SOURCE=2 -I"/home/ludo/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -D_FORTIFY_SOURCE=2  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt  -c io.c -o io.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG -DUDUNITS2_DIR=0   -D_FORTIFY_SOURCE=2 -I"/home/ludo/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -D_FORTIFY_SOURCE=2  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt  -c udunits.cpp -o udunits.o
g++ -std=gnu++11 -shared -L/usr/lib64/R/lib -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o units.so RcppExports.o io.o udunits.o -lexpat -lexpat -ludunits2 -L/usr/lib64/R/lib -lR
installing to /home/ludo/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-units/00new/units/libs
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘units’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/ludo/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-units/00new/units/libs/units.so':
  libudunits2.so.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/ludo/R/x86_64-pc-linux-gnu-library/3.6/units’
* restoring previous ‘/home/ludo/R/x86_64-pc-linux-gnu-library/3.6/units’
Warning in install.packages :
  installation of package ‘units’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpyMTM7e/downloaded_packages’

If I first install units from the R console then try to load it into rstudio, it does not work either with the following (same) error:

> library(units)
Error: package or namespace load failed for ‘units’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/ludo/R/x86_64-pc-linux-gnu-library/3.6/units/libs/units.so':
  libudunits2.so.0: cannot open shared object file: No such file or directory

Any suggestion? Thanks in advance.

@Enchufa2
Copy link
Member

Enchufa2 commented Dec 4, 2019

Sorry, but then the issue has nothing to do with units. RStudio doesn't find the system library path for some reason, maybe a misconfiguration or maybe you are running RStudio from some kind of container? I suggest you to check your configuration or otherwise ask for help in the RStudio community forums.

@edzer
Copy link
Member

edzer commented Dec 5, 2019

Do you have the udunits (system) library installed more than once on your system?

@lduvaux
Copy link
Author

lduvaux commented Dec 5, 2019

@Enchufa2 ah OK sorry. Yes maybe a misconfiguration of some sort indeed. No I'm running Rstudio from my OS (manjaro).
@edzer while trying first to fix the problem by myself (I first started to install everything from rstudio) I indeed installed the udunits library using conda first as it did not worked from my package manager (the address of the package not found). I then installed udunits2 from the sources for my OS and have removed the conda udunits but it's possible there are still some files remaining.
Should I look for some udunits remaining files of the conda installation and remove those? Can they interfer?

@edzer
Copy link
Member

edzer commented Dec 5, 2019

Yes, they will interfere; we've seen identical problems caused by this (other package, other libraries).

@lduvaux
Copy link
Author

lduvaux commented Dec 5, 2019

OK, so I removed all the udunits files and folders from everywhere on my laptop (OS and conda env) and rebuild a clean version of the udunits lib from the sources. However this did not fix my problem (i.e. units still build smoothly from the R console (via the terminal) but not from Rstudio (only one rstudio from my system)).
So as suggested by @Enchufa2 I'll post my problem on the rstudio git.
If you have any idea, please feel free to tell. In any case, many thanks for your help.
Should I close this issue?

@Enchufa2
Copy link
Member

Enchufa2 commented Dec 5, 2019

Can they interfer?

Not necessarily. The thing is that only programs that are run in the conda environment will see libraries installed with conda (probably that's the case for R, but not for RStudio). On the other hand, if you install the library from the sources, you will get a non-standard prefix (e.g., /usr/local) if you don't change it, which is not supported by R by default.

@Enchufa2 Enchufa2 closed this as completed Dec 5, 2019
@edzer
Copy link
Member

edzer commented Dec 5, 2019

See a longer thread partially about multiple libs here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants