While creating an R package the error has arisen - r

Last week I was training to create a user-defined package in R.
As the tutorial I used this link https://www.youtube.com/watch?v=9PyQlbAEujY.
I used R-studio Version 0.99.486.
Everything worked well, I made a package: ran build&reload -> check and build -> build a binary package
While creating a package, I was using devtools and roxygen2 libraries.
But today I have the error (after pressing “check”) that I can’t find a clue how to fix it. To create a package on the work station is ok, but for my network directory \dc2\mypackage.
The trouble seems to be with the acces to c:\windows. However I have got some security issues to get rid of all restrictions.
So it seems to be another way ((if it is ever) to redefine check (log) directory.
I would be grateful for your help with the error at \dc2\mypackage:
The snapshot of check window:
==> devtools::check(document = FALSE)
Setting env vars ---------------------------------------------------------
CFLAGS : -Wall -pedantic
CXXFLAGS: -Wall -pedantic
Building mypackage ----------------------------------------------------------
"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" --no-site-file --no-environ --no-save \
--no-restore CMD build \
"\\dc2\mypackage" \
--no-resave-data --no-manual
* checking for file '\\dc2\mypackage/DESCRIPTION' ... OK
* preparing 'mypackage':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building 'mypackage_0.1.tar.gz'
pdflatex not found! Not building PDF manual or vignettes.
If you are planning to release this package, please run a check with manual and vignettes beforehand.
Setting env vars -----------------------------------------------------------
_R_CHECK_CRAN_INCOMING_ : FALSE
_R_CHECK_FORCE_SUGGESTS_: FALSE
Checking mypackage ----------------------------------------------------------
"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" --no-site-file --no-environ --no-save \
--no-restore CMD check \
"C:\Users\DEMYD~1.DZY\AppData\Local\Temp\Rtmp8eHzkB/mypackage_0.1.tar.gz" \
--as-cran --timings --no-build-vignettes --no-manual
"\\dc2\Risk_Management\Score_card_DEV\R\packages"
��������� ���� ��� �ᯮ�짮��� ��� ����᪥ CMD.EXE � �����⢥ ⥪�饩 �����.
CMD.EXE �� �����ন���� ���� UNC. �� 㬮�砭�� ���࠭� ���⥬��� ����� Windows.
ERROR: cannot create check dir 'C:/Windows/mypackage.Rcheck'
Error in lapply(list(...), quotes) : object 'Log' not found
Execution halted
Error: Command failed (1)
Execution halted
Exited with status 1.

Related

installing ropensci/magick behind a firewall

I'm attempting to use the gganiminate library and I'm having an issue when I call gganimate::gganimate(myplot). The issue appears to be with a dependency library, magick.
When I call the function I get the following warning:
gganimate::gganimate(p)
1: running command 'C:\WINDOWS\system32\cmd.exe /c convert --version' had status 4
2: In find_magic() : ImageMagick not installed yet!
In im.convert(img.files, output = path.expand(movie.name), ... :
Please install ImageMagick first or put its bin path into the system PATH variable
So I try to install magick separately. I'm on a machine at a client so installing packages from github requires me to provide info to get through the firewall. I've installed other libraries from github with this machine using the same technique successfully. However, magick appears to be bumping into other problems. Below is my code and the error:
devtools::install_github("ropensci/magick",httr::set_config(httr::use_proxy("xx.xxx.xx.xx",xxxx)))
Downloading GitHub repo ropensci/magick#master
from URL https://api.github.com/repos/ropensci/magick/zipball/master
Installing magick
"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" \
--no-site-file --no-environ --no-save \
--no-restore --quiet CMD INSTALL \
"C:/Users/r631265/AppData/Local/Temp/1/RtmpS0efnQ/devtools18fc5f2414b/ropensci-magick-7925af3" \
--library="C:/Users/r631265/Documents/R/win-library/3.4" \
--install-tests
* installing *source* package 'magick' ...
** libs
*** arch - i386
rm -f RcppExports.o animation.o attributes.o base.o color.o composite.o config.o convolve.o device.o edit.o fonts.o options.o resize.o transformations.o magick.dll
Linking to imagemagagick-6.9.9
"C:/PROGRA~1/R/R-34~1.3/bin/i386/Rscript.exe" "../tools/winlibs.R" 6.9.9
Error in curl::curl_download(sprintf("https://github.com/rwinlib/imagemagick%s/archive/v%s.zip", :
schannel: failed to receive handshake, SSL/TLS connection failed
Calls: <Anonymous> -> .Call
Execution halted
make: *** [winlibs] Error 1
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-34~1.3/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-34~1.3/share/make/winshlib.mk" CXX='$(CXX11) $(CXX11STD)' CXXFLAGS='$(CXX11FLAGS)' CXXPICFLAGS='$(CXX11PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX11LDFLAGS)' SHLIB_LD='$(SHLIB_CXX11LD)' SHLIB="magick.dll" OBJECTS="RcppExports.o animation.o attributes.o base.o color.o composite.o config.o convolve.o device.o edit.o fonts.o options.o resize.o transformations.o"' had status 2
ERROR: compilation failed for package 'magick'
* removing 'C:/Users/r631265/Documents/R/win-library/3.4/magick'
In R CMD INSTALL
Installation failed: Command failed (1)
I think perhaps my firewall details aren't getting passed into: curl::curl_download(sprintf("https://github.com/rwinlib/imagemagick%s/archive/v%s.zip",...)
Network security is a bit of a black box to me so I'm not sure what else to try or if I'm diagnosing the issue correctly. Any help would be greatly appreciated!

R package installation - R CMD check throws ERROR: Installation Failed

I'm having trouble getting a package that I have written to install (on a Windows 10 machine).
I'm running R CMD build packagename (no errors), then R CMD check packagename_0.1.0.tar.gz (or R CMD INSTALL packagename)
After a number of successful log entries, the output reads
* checking whether package 'packagename' can be installed ...Warning: running command '"C:/PROGRA~1/R/R-3.4.0/bin/x64/Rcmd.exe" INSTALL -l
"C:/Work/parsimony_inapp/packagename.Rcheck" --no-html
"C:\Work\PARSIM~1\packagename.Rcheck\00_pkg_src\packagename"' had status 1
ERROR
Installation failed.
00install.out reports the error:
C:/MinGW/bin/gcc -shared -s -static-libgcc -o packagename.dll tmp.def fitch.o reorder.o -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-
4.9.3/local330/lib -LC:/PROGRA~1/R/R-3.4.0/bin/x64 -lR
C:/PROGRA~1/R/R-3.4.0/bin/x64/R.dll: file not recognized: File format not
recognized
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'packagename'
Oddly, I can install the package from GitHub using devtools::github_install('path/to/package').
Advice I've found elsewhere doesn't help:
setwd() in Rprofile - not present
Set R_WIN_NO_JUNCTIONS - no effect
I've updated to the latest version of R (3.4.0), RTools (34) and Cygwin, and checked that my PATH environment variable contains (in order) C:\Rtools\bin; C:\Rtools\mingw_32\bin; C:\Program Files\R\R-3.4.0\bin; C:\Program Files\R\R-3.4.0\bin\x64.
I've tried including and excluding C:\cygwin64\bin and C:\MinGW\msys\1.0\bin from the path, and have tried installations of Rtools with and without the Cygwin dlls, and have tried uninstalling Cygwin completely.

Error installing Rtools - devtools::has_devel() fails

I want to create an R package and downloaded Rtools and packages c("devtools", "roxygen2", "testthat", "knitr"). Now I check if everything is alright:
library(devtools)
has_devel()
and it's not, I get the error:
"C:/Users/xxx/DOCUME~1/R/R-33~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore \
--quiet CMD SHLIB foo.c
Warning message:
running command 'make -f "C:/Users/XYZ/DOCUME~1/R/R-33~1.1/etc/x64/Makeconf" -f "C:/Users/XYZ/DOCUME~1/R/R-33~1.1/share/make/winshlib.mk" SHLIB="foo.dll" WIN=64 TCLBIN=64 OBJECTS="foo.o"' had status 127
Error: Command failed (1)
I use Windows and the freshest RStudio.
Do you know what it means or how to repair it?
lol I have just ran this code:
install.packages("devtools")
library(devtools)
install_github("hadley/devtools")
devtools::build_github_devtools()
find_rtools()
has_devel()
build_github_devtools()
from
https://github.com/hadley/devtools/issues/1219
and now has_devel returns TRUE :O :D
Not sure if this would work for you, in a previous time I changed the R executable to run as administrator. (don't do that!) I went to
C:\Program Files\R\R-3.4.1\bin\x64 and right clicked the R executable. go to compatability mode, deselect run as administrator.
Everything works again.

Error with h2oEnsemble package installation for R

I'm trying to install h2oEnsemble package on R 3.2.3. I have H2O 3.10.0.8 package. When I write these commands:
library(devtools)
install_github("h2oai/h2o-3/h2o-r/ensemble/h2oEnsemble-package")
I get the next error:
Downloading GitHub repo h2oai/h2o-3#master
from URL https://api.github.com/repos/h2oai/h2o-3/zipball/master
Installing h2oEnsemble
"C:/Program Files/R/R-3.2.3/bin/x64/R" --no-site-file --no-environ --no-save \
--no-restore --quiet CMD INSTALL \
"C:/Users/User/AppData/Local/Temp/Rtmpi0Q2AV/devtools9583548338a/h2oai-h2o-3-a0a4bbc/h2o-r/ensemble/h2oEnsemble-package" \
--library="C:/Users/User/Documents/R/win-library/3.2" --install-tests
"C:\Program" ­Ҝ пү«пҜвбп ү­гваҜ­­Ҝ© Ё«Ё ү­Ҝи­Ҝ©
Ө®¬ ­¤®©, ЁбÜ®«­пҜ¬®© Üа®Ҹа ¬¬®© Ё«Ё Ü ӨҜв­л¬ д ©«®¬.
Error: Command failed (1)
Please, help me to solve this problem. Thanks.
It seems, your error is :
'C:\Program' is not recognized as an internal or external command,
operable program or batch file. Error: Command failed (1)
It happens due to the space character in location path (C:\Program Files) path. According to the documentation,
If you want to be able to build packages from sources, we recommend that you choose an
installation path not containing spaces.
Please refer the link : How do I install R for Windows?
Try changing the installation location. Then it should work fine.

*.o: File format not recognized on Windows 7

I wrote an R package called arbintools for some work-related data analysis and put it on Github. I wrote it and have been using it on my Mac for a while without issue; Today, I tried to install the dev-1 branch on a Windows 7 laptop and something related to compiling some Rcpp functions seems to go wrong:
devtools::install_github("mjlacey/arbintools", ref = "dev1")
I get this:
Downloading GitHub repo mjlacey/arbintools#dev1
from URL https://api.github.com/repos/mjlacey/arbintools/zipball/dev1
Installing arbintools
"C:/PROGRA~1/R/R-33~1.0/bin/x64/R" --no-site-file --no-environ --no-save \
--no-restore --quiet CMD INSTALL \
"C:/Users/matla332.USER/AppData/Local/Temp/Rtmp8WWkKC/devtools124c45026af1/mjlacey-arbintools-41dc363" \
--library="C:/Users/matla332.USER/Documents/R/win-library/3.3" \
--install-tests
* installing *source* package 'arbintools' ...
** libs
*** arch - i386
C:\Rtools\mingw_32\bin\nm.exe: RcppExports.o: File format not recognized
C:\Rtools\mingw_32\bin\nm.exe: Rcpp_functions.o: File format not recognized
c:/Rtools/mingw_32/bin/g++ -shared -s -static-libgcc -o arbintools.dll tmp.def RcppExports.o Rcpp_functions.o -Ld:/Compiler/gcc-4.9.3/local330/lib/i386 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-33~1.0/bin/i386 -lR
RcppExports.o: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'arbintools'
* removing 'C:/Users/matla332.USER/Documents/R/win-library/3.3/arbintools'
* restoring previous 'C:/Users/matla332.USER/Documents/R/win-library/3.3/arbintools'
Error: Command failed (1)
Installing other packages requiring some compilation (like dplyr) worked fine. I also updated R on my Mac to the same version (3.3.0) and reinstalled the package successfully, it's just on the Windows PC it doesn't work. This is beyond my understanding, if anyone has a suggestion or solution I'd be very grateful.
The issue is the .so and .o files are only viable with the same architecture e.g. OS X is 64 bit and Windows is 32bit (mingw_32). Please remove them from dev-1/src and then you should be good to go. These files are automatically built on package install as they are the result of using a compiler.
After they are removed, try to create a .gitignore file with the following:
src/*.o
src/*.so
src/*.dll
This will make OS specific files not selectable for staging and, in turn, commits.
As a general rule of thumb, only keep .cpp or .h files within /src while using Rcpp.

Resources