rpact-com / rpact

rpact: Confirmatory Adaptive Clinical Trial Design and Analysis
https://rpact-com.github.io/rpact/
23 stars 5 forks source link

Installation Error rpact #20

Closed fpahlke closed 8 months ago

fpahlke commented 8 months ago

Hello, I am getting help from the example you put up at www.rpact.org/vignettes/planning/rpact_binary_planning_example I am trying to install rpact packge on my mac and I am getting an error message which lead to an installation failure. Specifically, I see this error:

make: gfortran: No such file or directory".   I also tried to download
a developer version but I still see the same error.
Could you help me guide how to install this packge?
installing *source* package ‘rpact’ ...
** package ‘rpact’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -mmacosx-version-min=10.13 -std=gnu++14
-I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG
-I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include'
-I/usr/local/include   -fPIC  -Wall -g -O2  -c RcppExports.cpp -o
RcppExports.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14
-I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG
-I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include'
-I/usr/local/include   -fPIC  -Wall -g -O2  -c f_as251.cpp -o f_as251.o
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls  -fPIC  -Wall
-g -O2  -c f_as251_fortran.f -o f_as251_fortran.o
make: gfortran: No such file or directory
make: *** [f_as251_fortran.o] Error 1
ERROR: compilation failed for package ‘rpact’
* removing
‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/rpact’
The downloaded source packages are in
‘/private/var/folders/tf/m_6xpy4j237b43dg4yfd53mw0000gn/T/Rtmpr9ciqn/downloaded_packages’
Warning messages:
1: In readRDS(dest) : lzma decoder corrupt data
2: In install.packages("rpact") :
installation of package ‘rpact’ had non-zero exit status 
fpahlke commented 8 months ago

Dear Jaeil,

Thank you for reaching out regarding your attempt to install the "rpact" package on your Mac OS system. From the details provided, it appears you are running Mac OS version 10.13 and R version 3.1. These versions are indeed quite old, and this is central to the challenges you're encountering.

The Comprehensive R Archive Network (CRAN) typically provides precompiled binaries for packages, which significantly simplifies the installation process. However, these precompiled binaries are generally available only for more recent versions of both R and the operating system. For older versions, such as the ones you are using, a manual compilation of the package from source is necessary.

Since "rpact" includes Fortran code, a Fortran compiler is required to compile the package. Unfortunately, Mac OS does not come with a Fortran compiler installed by default. Here's how you can address these issues:

  1. Install a Fortran Compiler: Before attempting to compile the "rpact" package, you will need to install a Fortran compiler. GCC (GNU Compiler Collection) includes a Fortran compiler (gfortran) that you can install. There are various ways to do this, such as through Homebrew (a package manager for Mac) by running brew install gcc in the terminal.

  2. Compiling "rpact" from Source: Once you have a Fortran compiler installed, you can attempt to compile "rpact". Installing directly from CRAN via install.packages("rpact", type = "source") might work, but given the age of your R version, you might encounter compatibility issues. Alternatively, installing from GitHub would also require compilation. Ensure your development tools and environment are up to date to minimize potential issues.

  3. Consider Updating Your System: Given the age of your software, you might encounter further compatibility issues down the line, not just with "rpact" but with other packages and software as well. If possible, consider updating both your Mac OS and R to newer versions. This would not only alleviate the need to manually compile packages but also ensure better performance and access to the latest features and security enhancements.

  4. Seeking Further Assistance: If you encounter specific errors during the compilation process or have trouble installing the Fortran compiler, please provide the error messages or describe the issues in detail. This information will be crucial for offering more targeted assistance.

Hope that helps.

Best regards, Friedrich

fpahlke commented 8 months ago

Dear Friedrich,

Thank you for your email. I have tried all solutions found from googling which include the solution (manuall installation/fortran or others) you provided in this email.

One solution without this gfortran problem was not to install all sibling packages (I chose N when R prompt asked me to install all relevant packages).

So now it works perfectly. Thank you so much. And hope that my solution also works for some mac users.