download 'winference' package from github

I am downloading the package "winference" from github.
And I am using the package 'githubinstall' to finish this
I was following the instruction but comes to the error:


And the system removes the package automatically.
How can I fix this?

The link of the package is GitHub - pierrejacob/winference: R package to perform statistical inference in generative models using the Wasserstein distance (requires CGAL)

Hi and welcome to the forum.

We need the entire installation output. It looks to me as if you do not have some system's level dependency installed but we need the entire output to see what is happening.

Okay I would upload the entire output.
But I am only allowed to upload one at once

This is the second

This is the third

This is the fourth

This is the fifth

This is the sixth also the last one

Thanks but you do not have upload those screenshots.

Just copy the outcut and paste it between three ```, like this.. On my keyboard that symbol is on the top left key.

```
install.packages("dslabs")
Installing package into ‘/home/john/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/dslabs_0.7.4.tar.gz'
Content type 'application/x-gzip' length 3389330 bytes (3.2 MB)
==================================================
downloaded 3.2 MB

* installing *source* package ‘dslabs’ ...
** package ‘dslabs’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (dslabs)

The downloaded source packages are in
	‘/tmp/RtmpYysSOE/downloaded_packages’
> library(dslabs)
```

It looks to me that the problem is showing up in the bottom lines in the fifth shot and the first two or three in the sixth. My guess is that you are missing CGAL/Exact_predicates_inexact_constructions_kernel.h

This Introduction seems to suggest that "The goal of the Cgal Open Source Project is to provide easy access to efficient and reliable geometric algorithms in the form of a C++ library".

Thanks for clarification and here is the console:

> githubinstall('winference')
Suggestion:
 - pierrejacob/winference  R package to perform statistical inference in generative models using the Wasserstein distance
Do you want to install the package (Y/n)?  y
Downloading GitHub repo pierrejacob/winference@master
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All                             
2: CRAN packages only              
3: None                            
4: Rcpp     (1.0.8 -> 1.0.9) [CRAN]
5: magrittr (2.0.2 -> 2.0.3) [CRAN]
6: stringi  (1.7.6 -> 1.7.8) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 1
Rcpp     (1.0.8 -> 1.0.9) [CRAN]
magrittr (2.0.2 -> 2.0.3) [CRAN]
stringi  (1.7.6 -> 1.7.8) [CRAN]
Installing 3 packages: Rcpp, magrittr, stringi
Warning: 正在使用‘Rcpp’这个程序包,因此不会被安装

  有二进制版本的,但源代码版本是后来的:
        binary source needs_compilation
stringi  1.7.6  1.7.8              TRUE

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/magrittr_2.0.3.zip'
Content type 'application/zip' length 238598 bytes (233 KB)
downloaded 233 KB

package ‘magrittr’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package ‘magrittr’
Warning: restored ‘magrittr’

The downloaded binary packages are in
	C:\Users\zhiqi\AppData\Local\Temp\Rtmpqwr4Zw\downloaded_packages
安装源码包‘stringi’

trying URL 'https://cran.rstudio.com/src/contrib/stringi_1.7.8.tar.gz'
Content type 'application/x-gzip' length 8032287 bytes (7.7 MB)
downloaded 7.7 MB

* installing *source* package 'stringi' ...
** package 'stringi' successfully unpacked and MD5 sums checked
ERROR: cannot remove earlier installation, is it in use?
* removing 'D:/downloads/R-4.1.3/library/stringi'
* restoring previous 'D:/downloads/R-4.1.3/library/stringi'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
  拷贝D:\downloads\R-4.1.3\library\00LOCK-stringi\stringi\libs\icudt69l.dat到D:\downloads\R-4.1.3\library\stringi\libs\icudt69l.dat时出了问题:Invalid argument 
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
  拷贝D:\downloads\R-4.1.3\library\00LOCK-stringi\stringi\libs\x64\stringi.dll到D:\downloads\R-4.1.3\library\stringi\libs\x64\stringi.dll时出了问题:Permission denied 

The downloaded source packages are in
	‘C:\Users\zhiqi\AppData\Local\Temp\Rtmpqwr4Zw\downloaded_packages’
v  checking for file 'C:\Users\zhiqi\AppData\Local\Temp\Rtmpqwr4Zw\remotes1618618d7c19\pierrejacob-winference-bba0e89/DESCRIPTION' ... 
-  preparing 'winference': (2.4s)
v  checking DESCRIPTION meta-information ... 
-  cleaning src
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
   Omitted 'LazyData' from DESCRIPTION
-  building 'winference_0.1.2.tar.gz'
   
* installing *source* package 'winference' ...
** using staged installation
** libs

*** arch - i386
/mingw32/bin/g++  -std=gnu++14 -I"D:/DOWNLO~1/R-41~1.3/include" -DNDEBUG  -I'D:/downloads/R-4.1.3/library/Rcpp/include' -I'D:/downloads/R-4.1.3/library/RcppEigen/include' -I'D:/downloads/R-4.1.3/library/BH/include'        -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c HilbertCode.cpp -o HilbertCode.o
HilbertCode.cpp:2:10: fatal error: CGAL/Exact_predicates_inexact_constructions_kernel.h: No such file or directory
 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [D:/DOWNLO~1/R-41~1.3/etc/i386/Makeconf:245: HilbertCode.o] Error 1
ERROR: compilation failed for package 'winference'
* removing 'D:/downloads/R-4.1.3/library/winference'
Warning messages:
1: In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying D:\downloads\R-4.1.3\library\00LOCK\magrittr\libs\x64\magrittr.dll to D:\downloads\R-4.1.3\library\magrittr\libs\x64\magrittr.dll: Permission denied
2: In i.p(...) :
  installation of package ‘stringi’ had non-zero exit status
3: In i.p(...) :
  installation of package ‘C:/Users/zhiqi/AppData/Local/Temp/Rtmpqwr4Zw/file161824352e99/winference_0.1.2.tar.gz’ had non-zero exit status

It seems like the missing of CGAL is sensible.
But how can I download CGAL and link it to R? Or I just need to download the CGAL and it would work?

Currently I have no idea. I'll poke around a bit and see what I can find but what is your OS and what versions of R & RStudio are you using? You can use the command *
sessionInfo()* to get info on OS and R. Just do the standard cut & paste.

I see that you are getting a couple of warnings about ‘magrittr’ and stringi It looks like these are already loaded. I'd suggest restarting RStudio and doing either

# update all available packages
update.packages()

or

# update, without prompts for permission/clarification
update.packages(ask = FALSE)

before trying to install *winference. Not really needed but it should reduce the output if you are trying another installation.

Good luck and I'll try to get back to you with something useful about CCAL.

OOPS, a quick look at GitHub - pierrejacob/winference: R package to perform statistical inference in generative models using the Wasserstein distance (requires CGAL) says CGAL is required. So I'd go ahead and install it.

Yeah unfortunately the CGAL is necessary. Thanks so much for your help, And I will also continuously work on this. Please let me know if you have any other ideas!

Oops sorry I forgot to upload my version of OS and R. Here is the information of version

version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 4
minor 1.3
year 2022
month 03
day 10
svn rev 81868
language R
version.string R version 4.1.3 (2022-03-10)
nickname One Push-Up

I do not recognize your OS but int looks like a Linux derivative.

Here is mine

>  sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04 LTS

I'd have a look at CGAL 5.5 - Manual: Using CGAL on Unix (Linux, macOS, ...)
Something as simple as this may help if it treats "arch" as a known Linux version.

I am sorry not to be of more help.

Mine should be windows I think.

sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

That's fine I would ask others for some help, but if you have any other information could please just drop me a message. Thank you so much!

Oops. Windows!!!

Have a look at CGAL 5.5 - Manual: Using CGAL on Windows (with Visual C++)

I have not used Windows in at least 10 years so i am not much help here.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.