Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install issue #1

Open
juanmayorgahenao opened this issue Dec 11, 2024 · 18 comments
Open

Install issue #1

juanmayorgahenao opened this issue Dec 11, 2024 · 18 comments
Labels
bug Something isn't working

Comments

@juanmayorgahenao
Copy link

Hi!

I'm running into an installation error that I can' seem to overcome. Seems like it's an issue trying to find gmp. Any ideas how to fix it? I've reinstall all relevant libraries using homebrew.

Here is the error

`remotes::install_github("prioritizr/prepr")

Using GitHub PAT from the git credential store.
Downloading GitHub repo prioritizr/prepr@HEAD
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: RcppCGAL (5.6.4 -> 6.0) [CRAN]

Enter one or more numbers, or an empty line to skip updates:
── R CMD build ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔ checking for file ‘/private/var/folders/f2/n6b1dv_12qvc6pyj9cz4lcjm0000gp/T/Rtmp70HL3w/remotesafb978dc6ed2/prioritizr-prepr-c3953e8/DESCRIPTION’ (401ms)
─ preparing ‘prepr’: (1.1s)
✔ checking DESCRIPTION meta-information
─ cleaning src
─ running ‘cleanup’
─ checking for LF line-endings in source and make files and shell scripts (701ms)
─ checking for empty or unneeded directories
─ building ‘prepr_0.3.0.tar.gz’

  • installing source package ‘prepr’ ...
    ** using staged installation
    checking if R found... yes
    configure: R version: 4.4.2
    configure: CC: clang -arch arm64
    configure: CPP:
    configure: CFLAGS: -falign-functions=64 -Wall -g -O2
    configure: CPPFLAGS: -I/opt/R/arm64/include
    configure: LDFLAGS: -L/opt/R/arm64/lib
    checking for gdal-config... /opt/homebrew/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 3.10.0
    checking GDAL version >= 2.0.1... yes
    checking for pkg-config... yes
    checking if gmp compiles... no
    configure: Configuration failed because gmp was not found. Try installing:
    configure: * deb: libgmp3-dev (Debian, Ubuntu)
    configure: * rpm: gmp-devel (Fedora, EPEL)
    configure: * brew: gmp (Mac OSX)
    configure:
    configure: If gmp is already installed, check that 'pkg-config' is in
    configure: your PATH and PKG_CONFIG_PATH contains a gmpxx.pc file.
    configure:
    configure: error: ERROR: Installation failed
    ERROR: configuration failed for package ‘prepr’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/prepr’
    Warning message:
    In i.p(...) :
    installation of package ‘/var/folders/f2/n6b1dv_12qvc6pyj9cz4lcjm0000gp/T//Rtmp70HL3w/fileafb95b3f91de/prepr_0.3.0.tar.gz’ had non-zero exit status`

And here is the output of my sessionInfo()

`R version 4.4.2 (2024-10-31)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.7.1

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Bogota
tzcode source: internal

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] processx_3.8.4 compiler_4.4.2 R6_2.5.1 cli_3.6.3 tools_4.4.2 rstudioapi_0.16.0 curl_5.2.1 remotes_2.5.0
[9] desc_1.4.3 callr_3.7.6 ps_1.7.7 pkgbuild_1.4.4 `

@jeffreyhanson
Copy link
Contributor

jeffreyhanson commented Dec 11, 2024

Thanks for reaching out! I see that you're using macOS, have you followed the installation instructions on the README (https://github.com/prioritizr/prepr?tab=readme-ov-file#macos) to install system dependencies? Sorry in advance if you've already tried this.

@jeffreyhanson
Copy link
Contributor

jeffreyhanson commented Dec 11, 2024

Oh, sorry, I just reread your post and saw that you said you already installed the homebrew libraries.

@jeffreyhanson
Copy link
Contributor

What happens if you run these commands in the terminal?

pkg-config --cflags gmp
pkg-config --libs gmp

@jeffreyhanson jeffreyhanson added the bug Something isn't working label Dec 11, 2024
@juanmayorgahenao
Copy link
Author

Thank you, Jeffrey.

The output of those commands is:

-I/opt/homebrew/Cellar/gmp/6.3.0/include

and

-L/opt/homebrew/Cellar/gmp/6.3.0/lib -lgmp

@jeffreyhanson
Copy link
Contributor

Interesting - so it seems that pkg-config knows about gmp being installed. What's in the /opt/homebrew/Cellar/gmp/6.3.0/include and /opt/homebrew/Cellar/gmp/6.3.0/lib folders? E.g., what if you do:

ls -la /opt/homebrew/Cellar/gmp/6.3.0/include
ls -la /opt/homebrew/Cellar/gmp/6.3.0/lib

@juanmayorgahenao
Copy link
Author

juanmayorgahenao commented Dec 11, 2024

the outputs of those are

total 424 drwxr-xr-x 4 marinedatascience admin 128 Jul 29 2023 . drwxr-xr-x 14 marinedatascience admin 448 Dec 11 16:55 .. -rw-r--r-- 1 marinedatascience admin 84266 Jul 29 2023 gmp.h -rw-r--r-- 1 marinedatascience admin 129502 Jul 29 2023 gmpxx.h

and

total 2744 drwxr-xr-x 9 marinedatascience admin 288 Dec 11 16:55 . drwxr-xr-x 14 marinedatascience admin 448 Dec 11 16:55 .. -r--r--r-- 1 marinedatascience admin 452816 Dec 11 16:55 libgmp.10.dylib -r--r--r-- 1 marinedatascience admin 829736 Jul 29 2023 libgmp.a lrwxr-xr-x 1 marinedatascience admin 15 Jul 29 2023 libgmp.dylib -> libgmp.10.dylib -r--r--r-- 1 marinedatascience admin 80992 Dec 11 16:55 libgmpxx.4.dylib -r--r--r-- 1 marinedatascience admin 33096 Jul 29 2023 libgmpxx.a lrwxr-xr-x 1 marinedatascience admin 16 Jul 29 2023 libgmpxx.dylib -> libgmpxx.4.dylib drwxr-xr-x 4 marinedatascience admin 128 Dec 11 16:55 pkgconfig

Any clues?

@jeffreyhanson
Copy link
Contributor

So it looks like the files are in this folder - but for some reason it's not working. Could you try adding these folders to your computer's PATH variable, and then installing prepr again?

@juanmayorgahenao
Copy link
Author

Thank you Jeffrey. I've added those folder (plus the pfgconfig folder where the gmpxx.pc file lives) to the PATH variable but still no luck. I've also added the pkgconfig directory to the PKG_CONFIG_PATH variable. The error remains the same.

Here is some useful output from terminal

❯ echo $PKG_CONFIG_PATH /opt/homebrew/Cellar/gmp/6.3.0/lib/pkgconfig

echo -e ${PATH//:/\\n} /Users/marinedatascience/google-cloud-sdk/bin /opt/homebrew/bin /opt/homebrew/sbin /usr/local/bin /System/Cryptexes/App/usr/bin /usr/bin /bin /usr/sbin /sbin /opt/homebrew/Cellar/gmp/6.3.0/lib /opt/homebrew/Cellar/gmp/6.3.0/include /opt/homebrew/bin/pkg-config /opt/homebrew/Cellar/gmp/6.3.0/lib/pkgconfig /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin /opt/X11/bin /Library/Apple/usr/bin /Library/TeX/texbin /usr/local/sbin /Applications/quarto/bin /Applications/iTerm.app/Contents/Resources/utilities

Thanks again for your help!

Juan

@jeffreyhanson
Copy link
Contributor

jeffreyhanson commented Dec 12, 2024

No worries! I'm sorry about this issue and that it's taking so long to address. I think it might be useful to get more information on what compilation flags are being used on your compuer. So, I've updated the configuration files to provide more information. Could you please try installing the debug-autoconf branch and post the output?

remotes::install_github("prioritizr/prepr@debug-autoconf")

Also, just to check, are you able to install other packages that require compilation from source on your computer? E.g., does running this command work?

install.packages("dplyr", type="source")

@juanmayorgahenao
Copy link
Author

juanmayorgahenao commented Dec 12, 2024

Hi Jeffrey,

Thanks for your help again. I'm actually not able to install other packages from source :(

This is the output from install.packages("dplyr", type="source")

`

  • installing source package ‘dplyr’ ...
    ** package ‘dplyr’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    using C++ compiler: ‘Apple clang version 16.0.0 (clang-1600.0.26.4)’
    using SDK: ‘MacOSX15.1.sdk’
    clang++ -arch arm64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c chop.cpp -o chop.o
    In file included from chop.cpp:1:
    In file included from ./dplyr.h:5:
    /Library/Frameworks/R.framework/Resources/include/R.h:39:11: fatal error: 'cstdlib' file not found
    39 | # include
    | ^~~~~~~~~
    1 error generated.
    make: *** [chop.o] Error 1
    ERROR: compilation failed for package ‘dplyr’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/dplyr’
  • restoring previous ‘/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/dplyr’
    Warning in install.packages :
    installation of package ‘dplyr’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/f2/n6b1dv_12qvc6pyj9cz4lcjm0000gp/T/RtmpmfOLCH/downloaded_packages’`

I guess my problem is bigger than I thought.... Any ideas?

@juanmayorgahenao
Copy link
Author

And the output from remotes::install_github("prioritizr/prepr@debug-autoconf") is below:

`── R CMD build ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔ checking for file ‘/private/var/folders/f2/n6b1dv_12qvc6pyj9cz4lcjm0000gp/T/RtmpmfOLCH/remotes7ac930fcb017/prioritizr-prepr-650042b/DESCRIPTION’ (563ms)
─ preparing ‘prepr’: (1.3s)
✔ checking DESCRIPTION meta-information
─ cleaning src
─ running ‘cleanup’
─ checking for LF line-endings in source and make files and shell scripts (872ms)
─ checking for empty or unneeded directories
─ building ‘prepr_0.3.0.tar.gz’

  • installing source package ‘prepr’ ...
    ** using staged installation
    checking if R found... yes
    configure: R version: 4.4.2
    configure: CC: clang -arch arm64
    configure: CPP:
    configure: CFLAGS: -falign-functions=64 -Wall -g -O2
    configure: CPPFLAGS: -I/opt/R/arm64/include
    configure: LDFLAGS: -L/opt/R/arm64/lib
    checking for gdal-config... /opt/homebrew/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 3.10.0
    checking GDAL version >= 2.0.1... yes
    checking for pkg-config... yes
    configure: GMP_CFLAGS: -I/opt/homebrew/Cellar/gmp/6.3.0/include
    configure: GMP_LIBS: -L/opt/homebrew/Cellar/gmp/6.3.0/lib -lgmpxx -lgmp
    configure: MPFR_CFLAGS: -I/opt/homebrew/Cellar/mpfr/4.2.1/include
    configure: MPFR_LIBS: -L/opt/homebrew/Cellar/mpfr/4.2.1/lib -lmpfr -lgmp
    checking if gmp compiles... no
    configure: Configuration failed because gmp was not found. Try installing:
    configure: * deb: libgmp3-dev (Debian, Ubuntu)
    configure: * rpm: gmp-devel (Fedora, EPEL)
    configure: * brew: gmp (Mac OSX)
    configure:
    configure: If gmp is already installed, check that 'pkg-config' is in
    configure: your PATH and PKG_CONFIG_PATH contains a gmpxx.pc file.
    configure:
    configure: error: ERROR: Installation failed
    ERROR: configuration failed for package ‘prepr’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/prepr’
    Warning message:
    In i.p(...) :
    installation of package ‘/var/folders/f2/n6b1dv_12qvc6pyj9cz4lcjm0000gp/T//RtmpmfOLCH/file7ac91d8ccf21/prepr_0.3.0.tar.gz’ had non-zero exit status`

@jeffreyhanson
Copy link
Contributor

Thanks for persisting with this. Since you can't install dplyr from source, this would suggest that your computer is missing some general peice of software for installing/building R packages from source. I don't know much about macOS sorry. I checked a book on R package development, and it seems like xcode might be needed. Could you try installing it following these instructions (https://r-pkgs.org/setup.html#macos) and see if it works after that?

@juanmayorgahenao
Copy link
Author

Thanks, Jeffrey. I've updated xcode and I'm now using version Apple clang version 16.0.0 (clang-1600.0.26.6). Still no luck... I wonder what might have caused this mess in the first place... I tried installing ggplot from source and it worked... As this doesn't seem exclusive to prepr feel free to close the issue. I appreciate your help!!

@jeffreyhanson
Copy link
Contributor

jeffreyhanson commented Dec 13, 2024

No worries! Yeah, both prepr and dplyr have C/C++ source that needs to be compiled during installation (when installing from source) and this requires additional software to be installed (e.g., like xcode). Whereas, ggplot2 doesn't have any C/C++ source code, so it can be installed from source without requiring additional software (beyond a working R installation). Does dplyr still fail to install from source?

Another option we can try is compiling prepr using R-universe so that you can install a precompiled binary of the package (this is the default option when installing packages from CRAN on macOS and Windows). This means that you won't need to compile C/C++ code as part of the installation process on your computer. I'll see if can get that working for you.

@jeffreyhanson
Copy link
Contributor

jeffreyhanson commented Dec 13, 2024

I've updated the r-universe configuration for the prioritizr org, so it will build precompiled binaries for the prepr package. Since there's a bit of a delay, it's not going to do this immediately unfortunately. As I understand it, r-universe automatically updates once each day to see if there's new packages it should build. But hopefully, it should start soon. If you visit here (https://prioritizr.r-universe.dev/builds), this will show the precompiled packages that are available for installation. It currently doesn't show prepr, but hopefully will in the future. Once you see prepr listed there, could you try running this code to install prepr from r-universe?

install.packages(
  "prepr",
  repos = c("https://prioritizr.r-universe.dev", "https://cloud.r-project.org")
)

@jeffreyhanson
Copy link
Contributor

Just checked r-universe and it looks like it's finished building prepr, can you try installing it when you get a chance?

@juanmayorgahenao
Copy link
Author

juanmayorgahenao commented Dec 13, 2024

Hi Jeffrey, thanks again for your help!

I've tried installing prepr in the way you shored above and no luck. Below is the output....

`

Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘prepr’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source package ‘prepr’

trying URL 'https://prioritizr.r-universe.dev/src/contrib/prepr_0.3.0.tar.gz'
Content type 'application/gzip' length 224463 bytes (219 KB)

downloaded 219 KB

  • installing source package ‘prepr’ ...
    ** using staged installation
    checking if R found... yes
    configure: R version: 4.4.2
    configure: CC: clang -arch arm64
    configure: CPP:
    configure: CFLAGS: -falign-functions=64 -Wall -g -O2
    configure: CPPFLAGS: -I/opt/R/arm64/include
    configure: LDFLAGS: -L/opt/R/arm64/lib
    checking for gdal-config... /opt/homebrew/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 3.10.0
    checking GDAL version >= 2.0.1... yes
    checking for pkg-config... yes
    checking if gmp compiles... no
    configure: Configuration failed because gmp was not found. Try installing:
    configure: * deb: libgmp3-dev (Debian, Ubuntu)
    configure: * rpm: gmp-devel (Fedora, EPEL)
    configure: * brew: gmp (Mac OSX)
    configure:
    configure: If gmp is already installed, check that 'pkg-config' is in
    configure: your PATH and PKG_CONFIG_PATH contains a gmpxx.pc file.
    configure:
    configure: error: ERROR: Installation failed
    ERROR: configuration failed for package ‘prepr’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/prepr’
    Warning in install.packages :
    installation of package ‘prepr’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/f2/n6b1dv_12qvc6pyj9cz4lcjm0000gp/T/RtmpofY5e2/downloaded_packages’
`

@jeffreyhanson
Copy link
Contributor

Thanks for trying it out! I'm sorry - it looks like the r-universe buids failed for macOS (https://github.com/r-universe/prioritizr/actions/runs/12307931762) (though they worked for Linux and Windows). I'll take another look and see what I can do. I'm a bit busy this weekend, so it might be a few days before I can get to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants