I have downloaded, compiled, and installed the necessary prerequisites (PROJ and GDAL). I ran the following command in RStudio:
install.packages("rgdal",lib="/Users/usr/anaconda3/lib/R/library", configure.args = "--with-proj-include=/Library/Frameworks/PROJ.framework/Versions/4B/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/Versions/4B/unix/lib")
All of the checks and configurations work until...
checking proj_api.h presence and usability... no
configure: error: proj_api.h not found in standard or given locations.
This happens in spite of the fact that I specified the correct path for the include folder in the install.packages() call. I have also tried pointing to the Headers folder where the proj_api.h file is located, but that doesn't work either. Any insights into where I'm going wrong?
Related
Common problem, but there's no solution for me so far - so maybe you can help a lost bioinformatician with rather little experience in IT stuff.
I need to install Cairo in my R environment (R version 4.1.1) on my mac Big Sur 11.5.1 and get this error:
> install.packages("Cairo")
...
checking for pkg-config... /usr/local/bin/pkg-config
checking whether pkg-config knows about cairo... no
configure: CAIRO_LIBS is unset, attempting to guess it.
configure: CAIRO_CFLAGS=
checking if R was compiled with the RConn patch... no
checking cairo.h usability... no
checking cairo.h presence... no
checking for cairo.h... no
configure: error: Cannot find cairo.h! Please install cairo (http://www.cairographics.org/) and/or set CAIRO_CFLAGS/LIBS correspondingly.
ERROR: configuration failed for package ‘Cairo’
* removing ‘/Users/thomaslordick/opt/anaconda3/envs/seurat4/lib/R/library/Cairo’
The downloaded source packages are in
‘/private/var/folders/48/5h26d5297_92l76cvyjqvk2h0000gp/T/RtmpD4g5aI/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warnmeldung:
In install.packages("Cairo") :
installation of package ‘Cairo’ had non-zero exit status
I already installed cairo-devel via sudo port install cairo, installed cairo via brew and also checked out similar threads (https://stat.ethz.ch/pipermail/r-help/2014-April/374096.html), where people recommend:
*Make sure you have cairo-devel installed, and remove the lines
export CAIRO_LIBS=${HOME}/usr/local/lib
export CAIRO_CFLAGS=${HOME}/usr/local/include
from your .bashrc file.*
I cant find a .bashrc file when using ls -la ~/... .
According to the above mentioned error I need to specify CAIRO_LIBS and CAIRO_CFLAGS. But where can I do this?
Thanks in advance,
Thomas
If using Conda for R environments, you are better off avoiding install.packages and instead make a point to always install through Conda. CRAN's Cairo package goes by r-cairo on Conda Forge. So,
conda install -n seurat4 -c conda-forge r-cairo
How can I install the R 'sf' package on CentOS? On attempting to install, I initially got an error due to an out of date gdal package; I updated gdal (built from source following: http://trac.osgeo.org/gdal/wiki/BuildingOnUnix) and now have an error:
checking GDAL: linking with --libs only... yes
checking GDAL: /usr/local/share/gdal/pcs.csv readable... yes
checking GDAL: checking whether PROJ.4 is available for linking:... yes
checking GDAL: checking whether PROJ.4 is available fur running:...
./gdal_proj: error while loading shared libraries: libgdal.so.20: cannot open
shared object file: No such file or directory
no
configure: error: OGRCoordinateTransformation() does not return a
coord.trans:
PROJ.4 not available?
ERROR: configuration failed for package ‘sf’
I've tried creating a symlink to libgdal.so.20, but this doesn't change the error at all.
Add /usr/local/lib to e.g. /etc/ld.so.conf.d/libgdal-x86_64.conf
Run ldconfig
Restart R
Try again
#Dave has given exact steps & Please follow the below steps with some more explanation.
Add /usr/local/lib to e.g. /etc/ld.so.conf.d/libgdal-x86_64.conf Please create the file libgdal-x86_64.conf if doesn't exists.
#echo "/usr/local/lib" >> /etc/ld.so.conf.d/libgdal-x86_64.conf
Run ldconfig
#ldconfig
Make sure you have GEOS,GDAL,PROJ installed on your system.
#yum install proj.x86_64 proj-devel.x86_64 proj-epsg.x86_64 proj-nad.x86_64 geos*
Try again
Go to R cli & hit
install.packages("sf")
Thanks hope this helps
For anyone else who has a multi-user/multi-computer environment with the need to have multiple versions of various pieces of software installed, I fixed my issue with:
install.packages('sf',configure.args='--with-gdal-config=/sw/gdal/2.2.3-gcc4/bin/gdal-config --with-proj-include=/sw/proj/4.9.3-gcc4/include --with-proj-lib=/sw/proj/4.9.3-gcc4/lib --with-proj-share=/sw/proj/4.9.3-gcc4/share/proj')
Obviously you may/would have to alter path names from what I have.
I'm running Mac OS X 10.7.5 (Lion), which means that the latest version of R I can run is 3.2.1. Since binaries of packages are no longer being made for this version, it means that I need to install the latest package versions from source. I can do this with
install.packages(pkgs, type = "source")
I installed GNU Fortran, although it's not clear to me whether I need it or not in order to compile R packages.
When I try to compile packages from source in R, however, I get error messages indicating that I don't have (or that R cannot find) the necessary compiling tools. Cf. e.g.:
* installing *source* package ‘scales’ ...
** package ‘scales’ successfully unpacked and MD5 sums checked
** libs
sh: make: command not found
ERROR: compilation failed for package ‘scales’
and
* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
checking for local ICUDT_DIR... icu55/data
checking for R_HOME... /Library/Frameworks/R.framework/Resources
checking for R... /Library/Frameworks/R.framework/Resources/bin/R
checking for R >= 3.1.0 for C++11 use... yes
checking for R < 3.4.0 for CXX1X flag use... yes
checking for cat... /bin/cat
/Library/Frameworks/R.framework/Resources/bin/config: line 150: make: command not found
[...]
checking for gcc... no
checking for cc... no
checking for cl.exe... no
/Library/Frameworks/R.framework/Resources/bin/config: line 153: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 269: make: command not found
configure: error: in `/private/var/folders/2r/6c5vhb4s3zx3zs4d1dbf9p940000gn/T/Rtmpob4pMm/R.INSTALLd4676ad8595/stringi':
configure: error: no acceptable C compiler found in $PATH
I assume what's needed is to install the necessary compiling tools for R packages. What do I need to do?
(If I need to provide additional information, just ask for it in a comment, and I will provide it)
It might be tricky. First of all, double check whether you can download XCode from AppStore or not. If you can, you will be able to install command line tools as well. Either via Preferences -> Downloads (as far as I recall), or they will be installed during first startup.
Alternatively, create free account here:
http://developer.apple.com
Then, head to:
https://developer.apple.com/download/more/
and find XCode. It might be you will need to install some really old version.
As #hrbrmstr mentioned, it might be that installing virtual machine (e.g. inside VirtualBox) with Linux will be less painful.
Note that you will probably encounter more and more issues while installing packages. There is no easy way if you are forced to stick with old OS X :(
Update:
As #Sverre pointed out, it would be better to have a complete list of links here:
XCode - (Lion version) download from Apple (not to confuse with AppStore)
Command Line Tools - (Lion version) you can install them separately, without installing XCode
I was trying to install the R gsl wrapper in our university's HPC cluster, with R version 3.1.1 and OS x86_64-redhat-linux-gnu (64-bit). But something weird happened:
R CMD INSTALL '/d1/pyangac/gsl_1.9-10.1.tar.gz'
* installing to library /d1/pyangac/R_libs/ installing *source* package gsl...
** package gsl successfully unpacked and MD5 sums checked
checking for gsl-config... /usr/local/gsl-1.16/bin/gsl-config
checking if GSL version >= 1.12... checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
ERROR: configuration failed for package gsl
* removing /d1/pyangac/R_libs/gsl
Here are some specifics I have made before I run the installation command. There are two gsl libraries already installed in the cluster, one is gsl, and the other is gsl-1.16 (version 1.16). As the R gsl wrapper requires external gsl library version >= 1.12, before installation, I have set the environments LDFLAGS="-L/usr/local/gsl-1.16/lib -lgsl -lgslcblas -lm"; export LDFLAGS and CPPFALGS="-I/usr/local/gsl-1.16/include"; export CPPFLAGS, so that R will install the wrapper based on version 1.16. I also added the following two paths to make sure R will find the gsl-config file export PATH=$PATH:/usr/local/gsl-1.16, and export PATH=$PATH:/usr/local/gsl-1.16/bin.
Then I run the previous installation command and the error suggests that the C compiler cannot work. After some searches I think it may be caused by the fact that the gsl library is not in the gcc include directory. After typing the following commands, I think the problem would be solved:
export CPATH=/usr/local/gsl-1.16/include
Unfortunately, when I reinstall the gsl wrapper, the same 'cannot run C compiled programs' error appears again. Sorry that I can't provide any further information, as I cannot find the config.log file.
Does anyone has any hint why this is happening, or how to find the config.log file?
Thanks.
checking whether the C compiler works... configure: error: cannot run
C compiled programs
# yum install gcc-c++
I.e. the install of gcc-c++ will also install the dependencies that make gcc work. ( The gcc missing parts are { glibc-devel, glibc-headers, linux-headers } → /usr/lib64/[files], /usr/include/[files].h )
So I've been through a few problems trying to install rgdal. I'm running OS X 10.10.4
First I tried installing it from R :
install.packages("rgdal")
but the config file was not found :
configure: error: gdal-config not found or not executable.
So I installed gdal using Homebrew :
brew install gdal
Which installed a few dependencies alongside, like proj.
Problem is, R still can't install rgdal :
configure: error: proj_api.h not found in standard or given locations.
So I tried installing it manually, copying the rgdal_1.0-7.tar.gz from the temporary downloaded sources and unzipping it.
As ./config still seemed to fail finding proj_api.h, I searched it on my computer and found out it was in /usr/local/Cellar/proj/4.9.1/include, I tried
./configure CPPFLAGS="-I/usr/local/Cellar/proj/4.9.1/include"
... but it still doesn't work.
Now configure finds proj_api.h, but seems to be unable to find the functions defined in this header :
checking for proj_api.h... yes
checking for pj_init_plus in -lproj... no
configure: error: libproj not found in standard or given locations.
So now I don't know what to do anymore.
Any help would be great :)