baddstats / polyclip

R package polyclip: a port of the Clipper library for polygon geometry
19 stars 6 forks source link

Unable to install ployclip under conda environment, with R 3.6.1 #15

Closed leeweizhe1993 closed 5 years ago

leeweizhe1993 commented 5 years ago
install.packages("polyclip")

Error log:

试开URL’https://cran.rstudio.com/src/contrib/polyclip_1.10-0.tar.gz'
Content type 'application/x-gzip' length 79619 bytes (77 KB)
==================================================
downloaded 77 KB

* installing *source* package ‘polyclip’ ...
** 成功将‘polyclip’程序包解包并MD5和检查
** using staged installation
compiling under C++11
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/private/var/folders/_v/vxb6s8jn12d_zpc2_4g3t6bc0000gn/T/RtmpfOOyE6/R.INSTALL3da133a3cdc7/polyclip':
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 ‘polyclip’
* removing ‘/Users/it00002977/miniconda3/lib/R/library/polyclip’
Warning in install.packages :
  installation of package ‘polyclip’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/_v/vxb6s8jn12d_zpc2_4g3t6bc0000gn/T/RtmpqeYUaU/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

My conda version: 4.7.11 System info: R version 3.6.1 (2019-07-05) -- "Action of the Toes" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin13.4.0 (64-bit)

rubak commented 5 years ago

Thanks for the report. I have a few additional questions:

leeweizhe1993 commented 5 years ago

Thanks for the report. I have a few additional questions:

  • Could you also provide the content of config.log referred to in the error message?
  • Why is the conda version relevant? Are you somehow calling R from Python? And does the error also occur if you run R directly in a terminal and type install.packages("polyclip", type = "source")?
  • If you intend to use the clipper library in Python there is a package to do that directly in without going through R: https://pypi.org/project/pyclipper/ -- would that be an option?

Hello @rubak I searched my Mac but didn't find config.log, would you mind telling me where to retrieve the information you want? I want to install polyclip because it's a dependency of bibliometrix and I have to install it under R environment Weizhe

rubak commented 5 years ago

This is hard to debug through Python. I don't know where config.log is. Could you please run R directly in a terminal and see if it works?

I.e. open "Terminal" on your Mac and type R. This should open R if you have installed it the usual way. Then type install.packages("polyclip") in R and see if it installs polyclip and things work.

I still don't understand why you have to run through Python. The bibliometrix package is a normal R package and you can install it without doing anything in Python.

leeweizhe1993 commented 5 years ago

Hello @rubak Thank you for your help. I do want to use it under R. Unfortunately, the result of install.pakages("polyclip") in terminal is the same as that in Jupyter and Rstudio😭

install.packages("polyclip")
试开URL’https://cloud.r-project.org/src/contrib/polyclip_1.10-0.tar.gz'
Content type 'application/x-gzip' length 79619 bytes (77 KB)
==================================================
downloaded 77 KB

* installing *source* package ‘polyclip’ ...
** 成功将‘polyclip’程序包解包并MD5和检查
** using staged installation
compiling under C++11
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/private/var/folders/_v/vxb6s8jn12d_zpc2_4g3t6bc0000gn/T/RtmpX0A1rT/R.INSTALL63c432bd43b9/polyclip':
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 ‘polyclip’
* removing ‘/Users/it00002977/miniconda3/lib/R/library/polyclip’

The downloaded source packages are in
‘/private/var/folders/_v/vxb6s8jn12d_zpc2_4g3t6bc0000gn/T/RtmpJO2PJA/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done。
Warning message:
In install.packages("polyclip") : installation of package ‘polyclip’ had non-zero exit status
rubak commented 5 years ago

It appears you are still using R installed through Anaconda somehow since the path to your R library is: /Users/it00002977/miniconda3/lib/R/library Is it possible for you to install R directly from https://cran.r-project.org/bin/macosx/ and see if the problem is the same with R.app downloaded from there? Another thing to test is whether you can install other packages from source. E.g. install.packages("nloptr", type = "source").

leeweizhe1993 commented 5 years ago

It's wired that I successfully installed bibliometrix on my PC(Win10), with R kernel in conda.😂

rubak commented 5 years ago

Most likely it is just using precompiled binaries, so there are no PATH problems related to finding compilers etc. You should be able to use precompiled binaries on Mac as well. I have no idea why it is trying to compile from source. Maybe it is related to running it in conda. Did you try to install R.app directly on Mac and install there?

leeweizhe1993 commented 5 years ago

I haven't. Considering that potential path conflict may arise if another R.app installed, I would rather use bibliometrix on my Windows PC.😔

rubak commented 5 years ago

Ok. I understand. Could you please try install.packages("nloptr", type = "source") on your mac to see if the problem is the same for another package that requires compilation?

leeweizhe1993 commented 5 years ago

A similar error shown up installing nlopr:

checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/private/var/folders/_v/vxb6s8jn12d_zpc2_4g3t6bc0000gn/T/Rtmpi9amwr/R.INSTALL2ada2764c512/nloptr':
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 ‘nloptr’
* removing ‘/Users/it00002977/miniconda3/lib/R/library/nloptr’
* restoring previous ‘/Users/it00002977/miniconda3/lib/R/library/nloptr’
rubak commented 5 years ago

OK. This confirms that it's a problem with your setup and nothing specific to polyclip. I will go ahead and close this.