4

Using the instructions described in github and installing Java accordingly with Chocolatey -- plus installing rJava and setting the path in R with Sys.setenv(JAVA_HOME = "C:/Program Files/Java/jdk1.8.0_131")-- I've done the following in R:

library(ghit)
library(git2r)
ghit::install_github(c("leeper/tabulizerjars", "leeper/tabulizer"), INSTALL_opts = "--no-multiarch", dependencies = c("Depends", "Imports"))

Which is the solution provided in this answer. I get the following error:

Error in git2r::init(d) : 
  Error in 'git2r_repository_init': Unable to init repository

Setting the option VERBOSE = TRUE in install_github I get the following additional output:

Parsing reponame for 'leeper/tabulizerjars'...
Creating local git repository for tabulizerjars in C:\Users\JOOCAR~1\AppData\Local\Temp\RtmpgnitDP\tabulizerjars1643e0126f5...
Error in git2r::init(d) : 
  Error in 'git2r_repository_init': Unable to init repository

I read this answer and it seems that it has to do with my username, which is spaced and has accents. But how do I configure this?


edit: 6/4/2017 1:57 am

Following user @jaySf answer, I run part of the code of his answer (since I've already installed rJava and devtools):

library(rJava) # load and attach 'rJava' now
devtools::install_github("ropensci/tabulizer", args="--no-multiarch")

And got the following error:

> library(rJava) # load and attach 'rJava' now
> devtools::install_github("ropensci/tabulizer", args="--no-multiarch")
Downloading GitHub repo ropensci/tabulizer@master
from URL https://api.github.com/repos/ropensci/tabulizer/zipball/master
Installing tabulizer
Downloading GitHub repo ropensci/tabulizerjars@master
from URL https://api.github.com/repos/ropensci/tabulizerjars/zipball/master
Installing tabulizerjars
"C:/R-34~1.0/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL "C:/Users/Joo  \
  Caos/AppData/Local/Temp/Rtmpgh9eJi/devtoolsb3c50925145/ropensci-tabulizerjars-c6cc40e" --library="C:/R-3.4.0/library" --install-tests 

* installing *source* package 'tabulizerjars' ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Error: package or namespace load failed for 'tabulizerjars':
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/R-3.4.0/library/rJava/libs/i386/rJava.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/R-3.4.0/library/tabulizerjars'
Installation failed: Command failed (1)
"C:/R-34~1.0/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL "C:/Users/Joo  \
  Caos/AppData/Local/Temp/Rtmpgh9eJi/devtoolsb3c4a2835ec/ropensci-tabulizer-a38d957" --library="C:/R-3.4.0/library" --install-tests --no-multiarch 

ERROR: dependency 'tabulizerjars' is not available for package 'tabulizer'
* removing 'C:/R-3.4.0/library/tabulizer'
Installation failed: Command failed (1)

I believe that I might have a problem with my username in the file directory path, but I'm not sure. I tried using install_github with ggplot2 --`install_github("wch/ggplot2") -- and it worked fine. If my guess is correct, how can I edit the file path?


Problem solved

I was running R with both 32 bit and 64 bit files installed. I cannot clearly state what were the problems in doing this, since as I ran Sys.getenv("R_ARCH") it returned x64 previously, but when I uninstalled the 32 bit files, it ran perfectly well with @jaySf code.

zx8754
  • 52,746
  • 12
  • 114
  • 209
John Doe
  • 212
  • 1
  • 9
  • 28

3 Answers3

3

Follow these steps in given order should work:

install.packages("rJava")
library(rJava) # load and attach 'rJava' now
install.packages("devtools")
devtools::install_github("ropensci/tabulizer", args="--no-multiarch")

I'm using R 3.4.0 on win64, and described the procedure in a former answer.

jay.sf
  • 60,139
  • 8
  • 53
  • 110
  • 1
    See my updated answer. I'm doing all this from RStudio, if that is relevant. I ran your code and still I cannot install `tabulizer`. – John Doe Jun 04 '17 at 05:03
  • Me too, RStudio 1.0.143. Have you tried deinstalling rJava, devtools first? I can remember it was quite tricky to bring `tabulizer` onto my machine. – jay.sf Jun 04 '17 at 07:08
  • Are you sure that you are running x64? Your error message says: "ERROR: loading failed for 'i386' ". One more slight difference: I have installed the Java _JRE_ only, `C:\Program Files\Java\jre1.8.0_131`, but should be included in the _JDK_. – jay.sf Jun 04 '17 at 07:32
  • 1
    I think you grasped what I needed to do! I've ran `Sys.getenv("R_ARCH")`which returned `x64`. But then I uninstalled both R and Rstudio and reinstalled then, but I've installed only the 64 bit files this time as a test. And it worked! I think RStudio was searching through 32bit files in R. – John Doe Jun 04 '17 at 15:43
  • Since this solution was clearly somehow pointed out by you, I'm awarding you with the answer o/ – John Doe Jun 04 '17 at 15:51
1

You might try:

devtools::install_github("ropensci/tabulizerjars", INSTALL_opts = c("--no-multiarch")) 

devtools::install_github("ropensci/tabulizer", INSTALL_opts = c("--no-multiarch"))
Martin Gal
  • 16,640
  • 5
  • 21
  • 39
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 13 '21 at 07:20
0
install.packages("rJava")
library(rJava) # load and attach 'rJava' now
install.packages("devtools")
#run below package first..
devtools::install_github("ropensci/tabulizerjars", args="--no-multiarch") 
devtools::install_github("ropensci/tabulizer", args="--no-multiarch")
VradG
  • 11
  • 1