jpeg R package instalation does not find jpeglib.h in non standard location - r

I'm trying to install jpeg package in R in a Linux server (in which I don't have sudo access) and jpeg installation does not find jpeglib.h I installed locally. How do I tell R where to look for it when configure.args='--with-libjpeg-include=/path failed?
Sever OS version is CentOS Linux 7 (Core)
In R I ran:
>install.packages('jpeg', lib="/shared/mybossusr/R3.5.0/lib", repos="https://mirrors.nic.cz/R/", destdir="/shared/mybossusr/usr/tmp")
And I got this error:
rjcommon.h:11:21: fatal error: jpeglib.h: No such file or directory
#include
So I installed jpeg-turbo
wget https://downloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-2.0.2.tar.gz
mkdir libjpeg-turbo-2
cd libjpeg-turbo-2
cmake -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=/shared/mybossusr/bin/libjpeg-turbo-2 /shared/mybossusr/download/libjpeg-turbo-2.0.2
make
make install
I checked and jpeglib.h is at /shared/mybossusr/bin/libjpeg-turbo-2/include
I added this at the end of my ~/.bashrc :
export CFLAGS="-I/usr/include -I=/shared/mybossusr/bin/libjpeg-turbo-2"
I logged out and in, and I got the same error when trying to install jpeg in R.
I also added the location of the library to my path at ~/.barsh:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/shared/mybossusr/bin/libjpeg-turbo-2/include
export PATH=$PATH:/shared/mybossusr/bin/libjpeg-turbo-2/include
just in case, because I don't fully understand when a software looks where. Did source ~/.bashrc, logged out and in, but nothing changed.
So, I tried afterwards in R some arguments I came up with:
install.packages('jpeg', lib="/shared/mybossusr/R3.5.0/lib", repos="https://mirrors.nic.cz/R/", destdir="/shared/mybossusr/R3.5.0/tmp", configure.args='--with-libjpeg-include=/shared/mybossuser/bin/jpeg/include')
and:
install.packages('jpeg', lib="/shared/mybossusr/R3.5.0/lib", repos="https://mirrors.nic.cz/R/", destdir="/shared/mybossusr/R3.5.0/tmp", configure.args='--with-libjpeg=/shared/mybossuser/bin/jpeg')
or:
install.packages('jpeg', lib="/shared/mybossusr/R3.5.0/lib", repos="https://mirrors.nic.cz/R/", destdir="/shared/mybossusr/R3.5.0/tmp", configure.args='--with-libjpeg-lib=/shared/mybossuser/bin/jpeg/include')
to try to tell R where libjpeg was installed, but nothing worked.
Is there any configure.args that will do the trick? So far with other packages it was quite straight forward to use a --with-package_name-lib, but I'm clueless with this one...
Thanks in advance!

Try installing the libjpeg-turbo-devel package. That's what did it for me on RHEL 7. According to this page, on CentOS 7 the package name is the same.

For me this is what did the trick:
Install jpeg-turbo in a non-standard location, say $HOME/local, from:
https://github.com/libjpeg-turbo/libjpeg-turbo/releases
cmake -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$HOME/local
make
make install
Then point these globals to the install location in your .bashrc:
export LIBRARY_PATH=$HOME/local/lib64:$HOME/local/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/local/lib64:$HOME/local/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$HOME/local/include:$C_INCLUDE_PATH
Then try the R package again

Related

How to install libs for R arrow package on ubuntu without internet?

I am working on Azure databricks and it's compute server is Ubuntu 18.04. I want to install arrow R package but without internet access because of security reasons. I downloaded arrow tar file on my MacBook that has internet access and made it available in ubuntu for manual installation. I performed following steps:
Re-installed build-essential by downloading it from this link and uploaded to ubuntu and executed following bash command to make it available: sudo dpkg -i /dbfs/FileStore/tables/build_essential_12_4ubuntu1_amd64.deb
Installed cpp11 as it is dependency mentioned on cran: R CMD INSTALL /dbfs/FileStore/tables/arrow_dir/cpp11_0_3_1.tar.gz
Downloaded arrow_4.0.1.tar.gz from here and made it available on ubuntu.
Here I see required C++ dependencies to be available on ubuntu before installing the arrow package. How can I install these dependencies without access to internet?
Thanks for reading my question.
Note: A solution is suggested below and after execution of ./thirdparty/download_dependencies.sh $HOME/arrow-thirdparty I get:
# Environment variables for offline Arrow build
export ARROW_ABSL_URL=/root/arrow-thirdparty/absl-0f3bb466b868b523cf1dc9b2aaaed65c77b28862.tar.gz
export ARROW_AWSSDK_URL=/root/arrow-thirdparty/aws-sdk-cpp-1.8.133.tar.gz
export ARROW_AWS_CHECKSUMS_URL=/root/arrow-thirdparty/aws-checksums-v0.1.10
export ARROW_AWS_C_COMMON_URL=/root/arrow-thirdparty/aws-c-common-v0.5.10.tar.gz
export ARROW_AWS_C_EVENT_STREAM_URL=/root/arrow-thirdparty/aws-c-event-stream-v0.1.5
export ARROW_BOOST_URL=/root/arrow-thirdparty/boost-1.75.0.tar.gz
export ARROW_BROTLI_URL=/root/arrow-thirdparty/brotli-v1.0.9.tar.gz
export ARROW_BZIP2_URL=/root/arrow-thirdparty/bzip2-1.0.8.tar.gz
export ARROW_CARES_URL=/root/arrow-thirdparty/cares-1.17.1.tar.gz
export ARROW_GBENCHMARK_URL=/root/arrow-thirdparty/gbenchmark-v1.5.2.tar.gz
export ARROW_GFLAGS_URL=/root/arrow-thirdparty/gflags-v2.2.2.tar.gz
export ARROW_GLOG_URL=/root/arrow-thirdparty/glog-v0.4.0.tar.gz
export ARROW_GRPC_URL=/root/arrow-thirdparty/grpc-v1.35.0.tar.gz
export ARROW_GTEST_URL=/root/arrow-thirdparty/gtest-1.10.0.tar.gz
export ARROW_JEMALLOC_URL=/root/arrow-thirdparty/jemalloc-5.2.1.tar.bz2
export ARROW_LZ4_URL=/root/arrow-thirdparty/lz4-v1.9.3.tar.gz
export ARROW_MIMALLOC_URL=/root/arrow-thirdparty/mimalloc-v1.7.2.tar.gz
export ARROW_ORC_URL=/root/arrow-thirdparty/orc-1.6.6.tar.gz
Failed downloading https://github.com/google/protobuf/releases/download/v3.14.0/protobuf-all-3.14.0.tar.gz
Would it help to use the script mentioned in the link below to download the dependencies and put them somewhere you can then install them from?
There's some instructions here: https://arrow.apache.org/docs/developers/cpp/building.html#offline-builds
I've pasted them below in case the link expires, but you may want to check it for the most up to date version of these instructions.
To enable offline builds, you can download the source artifacts yourself and use environment variables of the form ARROW_$LIBRARY_URL to direct the build system to read from a local file rather than accessing the internet.
To make this easier for you, we have prepared a script thirdparty/download_dependencies.sh which will download the correct version of each dependency to a directory of your choosing. It will print a list of bash-style environment variable statements at the end to use for your build script.
# Download tarballs into $HOME/arrow-thirdparty
$ ./thirdparty/download_dependencies.sh $HOME/arrow-thirdparty
You can then invoke CMake to create the build directory and it will use the declared environment variable pointing to downloaded archives instead of downloading them (one for each build dir!).
Starting in arrow 6.0.0, the package should successfully install from source when offline. It will have only basic features: you'll be able to work with Arrow data and feather files, but features like Parquet reading, S3, and compression libraries won't be available. There is also a new utility function, create_package_with_all_dependencies(), that you can run on a machine connected to the internet in order to produce a "fat" source package containing all third-party C++ dependencies. You can then copy this to your airgapped server. See https://arrow.apache.org/docs/r/reference/create_package_with_all_dependencies.html for details.

how to install RODBC on macOS Sierra 10.12.4

In R 3.4.0,
install.packages('RODBC', type='source')
fails on macOS 10.12.4. I also downloaded RODBC_1.3-15.tar.gz from CRAN and tried,
R CMD INSTALL RODBC_1.3-15.tar.gz
In both cases, I got "ODBC headers sql.h and sqlext.h not found". A discussion of this in Installation of RODBC/ROracle packages on OS X Mavericks says the following:
To fix this, you need to download the latest version of iODBC (www.iodbc.org), and then unzip the file and set your header and library search paths to the location where you put the unzipped package. If you don't know how to set your search paths, you could just put the header files (sql.h and sqlext.h) in the /usr/include directory, and the libiodbc.a file in the /usr/lib directory.
I downloaded iodbc-42.5.tar.gz and untarred it into a directory next to RODBC, untarred from RODBC_1.3-15.tar.gz. Sadly, I can't find how to set header and library search paths, and when I try to put the header files in /usr/include, the system won't let me.
iodbc-42.5/iodbc/README.MACOSX says,
You first need to install the latest Mac OS X Developer Packages, which can be found at http://developer.apple.com/tools
I think I've done that, but I don't know how to check it. [In fact, I think I've done it multiple times: The message ODBC headers sql.h and sqlext.h not found, disappeared for a while from the still-negative response to install.packages('RODBC', type='source'), only to reappear later after I successfully installed port and ran sudo port install gcc6. Then I got ODBC headers sql.h and sqlext.h not found again.]
iodbc-42.5/iodbc/README.MACOSX continues,
Then, you can open the Xcode Project Builder files under mac/iODBCinst, mac/iODBC, mac/iODBCtest and mac/iODBCtestw.
I don't know how find any of these. It further continues,
or execute the following commands from a terminal session to build all the frameworks and demo applications:
$ cd mac
$ make
I did $ cd mac and got -bash: cd: mac: No such file or directory. Evidently, I need to substitute something for mac here, but I don't know what. ???
Thanks.
I solved the problem with:
ODBC_INCLUDE=/path/to/libiodbc-srcs/include R CMD INSTALL RODBC
where "/path/to/libiodbc-srcs/include" is the path to the "include" folder containing the missing files, "sql.h" and "sqlext.h". In my case it was something like '~/Documents/Rstuff/iodbc-42.5/iodbc/include', which I checked with the following in R:
dir('~/Documents/current/Rstuff/iodbc-42.5/iodbc/include')
Then the following worked for me:
ODBC_INCLUDE=~/Documents/current/Rstuff/iodbc-42.5/iodbc/include R CMD INSTALL RODBC
This is described in p. 19 of https://cran.r-project.org/web/packages/RODBC/vignettes/RODBC.pdf, except that contains a stray quote (<'>), which threw me off the first few times I read it, because was not familiar with that syntax.
On R-Sig-Mac, Marc Schwartz offered two suggestions: First, Installation of RODBC on OS X Yosemite, which may work with "brew"; I didn't try that, because I got the above to work first.
Second:
install.packages("RODBC", type = "source",
configure.args = "--with-odbc-include=/path/to/libiodbc-srcs/include/")
This should work also with the path substitution mentioned above.
I hope this helps someone else.

phpDocumentor - Unable to find the dot command of the GraphViz package

I would like ask some help about my next problem:
I am working on a Symfony2 project. We installed Symfony2 via composer.
Now I would like to generate phpDocument used by phpDocumentor.
A did the following steps:
update composer: sudo php composer.phar self-update
add the following property to Symfony2/compose.json file:
"require-dev": {
"phpdocumentor/phpdocumentor": "2.*#dev"
},
Run composer command
sudo php composer.phar update
Result was success! The installed GraphViz version is: 1.0.2
When I try to generate phpDoc from source code finally I got a message:
Unable to find the dot command of the GraphViz package. Is GraphViz correctly installed and present in your path?
(Document generated as right...)
I tried to found a soulution about this problem but I couldn't.
Is anybody can help me to resolve this problem?
Environment is: Ubuntu release 12.04
Graphviz is a nice software that creates graphs, but PHP software can only provide wrappers that create Graphviz source files that then get parsed and morphed into pictures.
Phpdocumentor comes with it's own wrapper, but you still have to install the Graphviz software package.
On Ubuntu just run
sudo apt-get install graphviz
rerun phpdoc, at the end you will see the line
Execute transformation using writer "Graph"
that's all!
The error says that : GraphViz tool (needed for making charts and graphs in the documentation) is not installed, in that scenario you will have to download the suitable version and configure it ! And if you are sure that it is installed on your system, then you should check whether the command dot is available or not. On windows path environment variable needs to be set which makes the dot command execution to be available from any path. Fixing this may get your things working !
For Windows
Follow the steps below to resolve this error are:
download Windows Packages from https://graphviz.gitlab.io/_pages/Download/Download_windows.html
Just install it
add c:\Program Files\Graphviz*\dot.exe or c:\Program Files (x86)\Graphviz*\dot.exe to your environment variable PATH
run phpdoc
Re-start your machine & run phpdoc (if still shows the same error message)
For windows 7/10 just install https://graphviz.gitlab.io/download/ select the Stable install packages. Then add
C:\Program Files (x86)\Graphviz2.38\bin
to your system environment variables. Make sure to change the version to the one you downloaded.
To check if it works open a new instance of cmd or git bash and run dot. If it says dot is not a valid command then make sure the path to Graphviz bin folder is correct.

Compiling an OpenCL program using a CL/cl.h file

I have sample "Hello, World!" code from the net and I want to run it on the GPU on my university's server. When I type "gcc main.c," it responds with:
CL/cl.h: No such file or directory
What should I do? How can I have this header file?
Are you using Ubuntu or Debian distro? Then you could use this package to solve the problem with missing header file:
apt-get install opencl-headers
You must install opencl library to solve linking issues using that Debian and Ubuntu package:
apt-get install ocl-icd-libopencl1
You can also use these nonfree libraries: nvidia-libopencl1 (Debian) or nvidia-libopencl1-xx (Ubuntu).
Make sure you have the appropriate toolkit installed.
This depends on what you intend running your code on. If you have an NVidia card then you need to download and install the CUDA-toolkit which also contains the necessary binaries and libraries for opencl.
Are you running Linux? If you believe you already have OpenCL installed it could be that it is found at a different location than the standard /usr/include. Type the following and see what results you get:
find / -iname cl.h 2>/dev/null
On my laptop for example, the header is found at /usr/local/cuda-5.5/include. If its the case were your header file is at a different location you simply have to specify the path during complication
g++ -I/usr/local/cuda-5.5/include main.c -lOpenCL
Alternatively, you can create a symbolic link from the path to /usr/include:
ln -s /usr/local/cuda-5.5/include/CL /usr/include

Problem loading rJava

Yesterday I removed R2.11 from my system (Win7, 64bit), since I´m working on R2.13.
Since then i get an error message:
> require(rJava)
Lade nötiges Paket: rJava
Error : .onLoad in loadNamespace() fehlgechlagen, Details:
Aufruf: rJava
Fehler: inDL(x, as.logical(local), as.logical(now), ...)
I tried specifying PATH, since I found on the internet that it might have something to do with jvm.dll:
c:\Rtools\bin;
c:\Rtools\perl\bin;
c:\Rtools\MinGW\bin;
c:\Rtools\MinGW64\bin;
C:\Windows\system32;
%R_HOME%\bin;
C:\Program Files\R\R-2.13.0\bin;
C:\Program Files\Java\jre6\bin\server
However I could not solve the problem...
I also can´t run R from the win command line (just type "R"?)
Any suggestions?
Here is some quick advice on how to get up and running with R + rJava on Windows 7 64bit. There are several possibilities, but most have fatal flaws. Here is what worked for me:
Add jvm.dll to your PATH
rJava, the R<->Java bridge, will need jvm.dll, but R will have trouble finding that DLL. It resides in a folder like
C:\Program Files\Java\jdk1.6.0_25\jre\bin\server
or
C:\Program Files\Java\jre6\jre\bin\client
Wherever yours is, add that directory to your windows PATH variable. (Windows -> "Path" -> "Edit environment variables to for your account" -> PATH -> edit the value.)
You may already have Java on your PATH. If so you should find the client/server directory in the same Java "home" dir as the one already on your PATH.
To be safe, make sure your architectures match.If you have Java in Program Files, it is 64-bit, so you ought to run R64. If you have Java in Program Files (x86), that's 32-bit, so you use plain 32-bit R.
Re-launch R from the Windows Menu
If R is running, quit.
From the Start Menu , Start R / RGUI, RStudio. This is very important, to make R pick up your PATH changes.
Install rJava 0.9.2.
Earlier versions do not work! Mirrors are not up-to-date, so go to the source at www.rforge.net: http://www.rforge.net/rJava/files/. Note the advice there
“Please use
`install.packages('rJava',,'http://www.rforge.net/')`
to install.”
That is almost correct. This actually works:
install.packages('rJava', .libPaths()[1], 'http://www.rforge.net/')
Watch the punctuation! The mysterious “.libPaths()[1],” just tells R to install the package in the primary library directory. For some reason, leaving the value blank doesn’t work, even though it should default.
I finally solved the problem:
It seems that rJava searches for jvm.dll in ~\Java\jre6\bin\client.
However this folder didn´t exist on my system (jvm.dll was in ~\bin\server).
So I just made a copy of jvm.dll in a folder ~\bin\client\ and added this to the path.
Now everything works fine!
My problem was solved by
install.packages("SqlRender",INSTALL_opts="--no-multiarch")
It was a package that depends on rJava and all advices were telling me to fix Java installation. But the solution was to use install option that simply forgets about i386 architecture. (also works with drat library and packages not from CRAN)
This may be due to a conflict between RStudio and Java versions. If you have installed 64 bit java and RStudio is running in 32 bit mode, you may experience problems like this. As a solution, you can change the 32-64 bit selection in the Tools-> Global Options-> General section in RStudio.
You can find detailed information here.
In my case installing proper version of Java solved my problem.
I installed 64x bit java, cause I use 64x bit R version.
I solved it by following these steps
setting my environment Sys.setenv(JAVA_HOME='C:\\Program Files (x86)\\Java\\jre6')
Manually installing rJava package from install package (even this should work:
install.packages('rJava', .libPaths()[1], 'http://www.rforge.net/'))
library(rJava)
I solved this problem as follows. I've been trying for 2 days.
Windows 7 users do not write ... \ bin \ x64 in environment variables.
Instead, define the path as follows.
JAVA_HOME "C: \ Program Files \ Java \ jre1.8.0_251"
R_HOME C: \ Program Files \ R \ R-3.5.3
In RStudio type .LibPaths()
This will give you an path in you windows system where your library’s are located
Go there and delete rJava. If it is being used by applications of Java, kill all Java programs in the Task Manager.
Go to computer and properties, click on change environment variables
Edit JAVA_HOME and all Java related paths to the path where your newest installation of Java is located and save.

Resources