tjthurman / BAHZ

An R package for Bayesian analysis of hybrid zones
GNU General Public License v3.0
3 stars 1 forks source link

[BUG] #65

Closed dongyiyi closed 4 years ago

dongyiyi commented 4 years ago

I have installed the rstan package. Then I tried to install the bahz package following your code: install_github("tjthurman/BAHZ") but it didn't install, I downloaded the zip file from the web, tried to install from local. There still met some problems: had non-zero exit status; Does not appear to be an R package (no DESCRIPTION). Thanks!

tjthurman commented 4 years ago

Hi @dongyiyi,sorry installation isn't working well! Can you copy-paste the error message(s) you're getting when you try to install with install_github("tjthurman/BAHZ")? That will help me figure out what is going wrong.

dongyiyi commented 4 years ago

Hi, @tjthurman thank your reply! I ran "install_github("tjthurman/BAHZ")" and got the error below:

I installed the package from local, got the same error.

dongyiyi commented 4 years ago

Maybe the environment is incorrect, so I re-configurated the environment. it still didn't work. I got another error

install_github("tjthurman/BAHZ") Downloading GitHub repo tjthurman/BAHZ@master tjthurman-BAHZ-1c3443a/tests/testthat/ref_pheno_stanfit.Rda: truncated gzip input tar.exe: Error exit delayed from previous errors. Error: Failed to install 'bahz' from GitHub: Does not appear to be an R package (no DESCRIPTION) In addition: Warning messages: 1: In utils::untar(tarfile, ...) : ‘tar.exe -zxf "C:......\Local\Temp\RtmpkfBXsv\file51a45f476da.tar.gz" -C "C:/.......Local/Temp/RtmpkfBXsv/remotes51a4423526f5"’ returned error code 1 2: In system(cmd, intern = TRUE) : running command 'tar.exe -ztf "C:.......\Local\Temp\RtmpkfBXsv\file51a45f476da.tar.gz"' had status 1

Thanks!

tjthurman commented 4 years ago

Hi @dongyiyi ,

Hmm, these look tricky! From what I can tell, the first error is related to your C++ compiler. This appears to be an issue some other folks have had when using rstan and other rstan based packages on Windows machines. I don't use Windows, so unfortunately I don't have any firsthand experience with this. But check out these two help threads on related issues that might help you get the configuration of the compiler right:

https://discourse.mc-stan.org/t/c-14-standard-requested-but-cxx14-is-not-defined/5998/2 https://community.rstudio.com/t/error-in-shlib-internal-args-c-14-standard-requested-but-cxx14-is-not-defined/16819/2

However, it sounds like you've gotten around that by changing the environment. The second error seems to be a problem with your PATH to your tar executable. Try setting the environment to use R's internal tar with Sys.setenv("TAR" = "internal"), as suggested here:

https://github.com/r-lib/devtools/issues/1939

Let me know if that works!

dongyiyi commented 4 years ago

Hi, @tjthurman I added the code Sys.setenv("TAR" = "internal"), and got "internal" by Sys.getenv("TAR"). because the internet unstable, I downloaded the package file from URL 'https://api.github.com/repos/tjthurman/BAHZ/tarball/master', installed from local, but here showed a new problem:

install.packages("C:/.../master.tar.gz", repos = NULL, type = "source") Warning in untar2(tarfile, files, list, exdir, restore_times) : skipping pax global extended headers

  • installing source package 'bahz' ... ** libs "C:/.../R-35~1.2/bin/x64/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/pheno_constant.stan Wrote C++ file "stan_files/pheno_constant.cc" C:/RBuildTools/3.5/mingw_64/bin/g++ -m64 -std=c++1y -I"C:/.../R-35~1.2/include" -DNDEBUG -I"../inst/include" -I""C:/.../R-35~1.2/bin/x64/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I"C:/.../R-3.5.2/library/BH/include" -I"C:/.../R-3.5.2/library/Rcpp/include" -I"C:/.../R-3.5.2/library/RcppEigen/include" -I"C:/.../R-3.5.2/library/rstan/include" -I"C:/.../R-3.5.2/library/StanHeaders/include" -O3 -Wno-unused-variable -Wno-unused-function -c stan_files/pheno_constant.cc -o stan_files/pheno_constant.o "C:/.../R-35~1.2/bin/x64/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/pheno_pooled.stan Wrote C++ file "stan_files/pheno_pooled.cc" C:/RBuildTools/3.5/mingw_64/bin/g++ -m64 -std=c++1y -I"C:/.../R-35~1.2/include" -DNDEBUG -I"../inst/include" -I""C:/.../R-35~1.2/bin/x64/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I"C:/.../R-3.5.2/library/BH/include" -I"C:/.../R-3.5.2/library/Rcpp/include" -I"C:/.../R-3.5.2/library/RcppEigen/include" -I"C:/.../R-3.5.2/library/rstan/include" -I"C:/.../R-3.5.2/library/StanHeaders/include" -O3 -Wno-unused-variable -Wno-unused-function -c stan_files/pheno_pooled.cc -o stan_files/pheno_pooled.o "C:/.../R-35~1.2/bin/x64/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/multi.stan Wrote C++ file "stan_files/multi.cc" C:/RBuildTools/3.5/mingw_64/bin/g++ -m64 -std=c++1y -I"C:/.../R-35~1.2/include" -DNDEBUG -I"../inst/include" -I""C:/.../R-35~1.2/bin/x64/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I"C:/...-3.5.2/library/BH/include" -I"C:/.../R-3.5.2/library/Rcpp/include" -I"C:/.../R-3.5.2/library/RcppEigen/include" -I"C:/.../R-3.5.2/library/rstan/include" -I"C:/.../R-3.5.2/library/StanHeaders/include" -O3 -Wno-unused-variable -Wno-unused-function -c stan_files/multi.cc -o stan_files/multi.o "C:/.../R-35~1.2/bin/x64/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/bi.stan Wrote C++ file "stan_files/bi.cc" C:/RBuildTools/3.5/mingw_64/bin/g++ -m64 -std=c++1y -I"C:/.../R-35~1.2/include" -DNDEBUG -I"../inst/include" -I""C:/.../R-35~1.2/bin/x64/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I"C:/...R/R-3.5.2/library/BH/include" -I"C:/.../R-3.5.2/library/Rcpp/include" -I"C:/.../R-3.5.2/library/RcppEigen/include" -I"C:/.../R-3.5.2/library/rstan/include" -I"C:/...R-3.5.2/library/StanHeaders/include" -O3 -Wno-unused-variable -Wno-unused-function -c stan_files/bi.cc -o stan_files/bi.o "C:/.../R-35~1.2/bin/x64/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/pheno_independent.stan Wrote C++ file "stan_files/pheno_independent.cc" C:/RBuildTools/3.5/mingw_64/bin/g++ -m64 -std=c++1y -I"C:/.../R-35~1.2/include" -DNDEBUG -I"../inst/include" -I""C:/.../R-35~1.2/bin/x64/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I"C:/.../R-3.5.2/library/BH/include" -I"C:/.../R-3.5.2/library/Rcpp/include" -I"C:/.../R-3.5.2/library/RcppEigen/include" -I"C:/...R-3.5.2/library/rstan/include" -I"C:/.../R-3.5.2/library/StanHeaders/include" -O3 -Wno-unused-variable -Wno-unused-function -c stan_files/pheno_independent.cc -o stan_files/pheno_independent.o C:\RBuildTools\3.5\mingw_64\bin\nm.exe: init.o: File format not recognized C:/RBuildTools/3.5/mingw_64/bin/g++ -m64 -std=c++1y -shared -s -static-libgcc -o bahz.dll tmp.def stan_files/pheno_constant.o stan_files/pheno_pooled.o stan_files/multi.o stan_files/bi.o stan_files/pheno_independent.o init.o -LC:/.../R-35~1.2/bin/x64 -lR init.o: file not recognized: File format not recognized collect2.exe: error: ld returned 1 exit status rm stan_files/pheno_independent.cc stan_files/pheno_pooled.cc stan_files/multi.cc stan_files/bi.cc stan_files/pheno_constant.cc no DLL was created ERROR: compilation failed for package 'bahz'
  • removing 'C:/.../R-3.5.2/library/bahz'
  • restoring previous 'C:/.../R-3.5.2/library/bahz' In R CMD INSTALL Warning in install.packages : installation of package ‘C:/.../DOCUME~1/ECOLOG~1/GGGJ/INTROG~1/BAHZ/master.tar.gz’ had non-zero exit status

If I executed install_github("tjthurman/BAHZ"), I will get the errors below:

install_github("tjthurman/BAHZ") Downloading GitHub repo tjthurman/BAHZ@master tjthurman-BAHZ-1c3443a/tests/testthat/ref_pheno_stanfit.Rda: truncated gzip input tar.exe: Error exit delayed from previous errors. Error: Failed to install 'bahz' from GitHub: Does not appear to be an R package (no DESCRIPTION) In addition: Warning messages: 1: In utils::untar(tarfile, ...) : ‘tar.exe -zxf "C:...AppData\Local\Temp\RtmpMHlOGt\file28f028493b20.tar.gz" -C "C:/.../AppData/Local/Temp/RtmpMHlOGt/remotes28f052519c7"’ returned error code 1 2: In system(cmd, intern = TRUE) : running command 'tar.exe -ztf "C:...\AppData\Local\Temp\RtmpMHlOGt\file28f028493b20.tar.gz"' had status 1

or > install_github("tjthurman/BAHZ") Downloading GitHub repo tjthurman/BAHZ@master Error: Failed to install 'bahz' from GitHub: incomplete block on file In addition: Warning messages: 1: In names(sys.call()) %in% c("", "exact") : closing unused connection 7 (tjthurman-BAHZ-1c3443a/tests/testthat/ref_pheno_stanfit.Rda) 2: In names(sys.call()) %in% c("", "exact") : closing unused connection 6 (tjthurman-BAHZ-1c3443a/src/bahz.so) 3: In names(sys.call()) %in% c("", "exact") : closing unused connection 5 (tjthurman-BAHZ-1c3443a/src/bahz.so) 4: In names(sys.call()) %in% c("", "exact") : closing unused connection 4 (tjthurman-BAHZ-1c3443a/src/bahz.so) I failed to install the package agian. I am trying to find a way to solve this problem. Thanks!

tjthurman commented 4 years ago

These are indeed tricky! OK, I've done a few things to try to fix this. First, I've made a new branch to make changes on while we get this figured out. So, to install that version, use:

devtools::install_github("tjthurman/BAHZ@feature/dongyiyi_install_fixes")

Once you can install that version successfully and I'm sure these changes don't break anything, I'll incorporate them into the master branch that everyone can download.

So, the first problem is still a C++ compiler error, it doesn't like the init.o file. That's an unnecessary file that I had added to the .gitignore but forgot to delete. I've deleted it now on this branch, so hopefully that clears the first problem up.

The next two problems are both due to a corrupted .gzip file in the test suite. Not sure why it is corrupted, but I've generated a new file, so hopefully that is fixed as well.

tjthurman commented 4 years ago

Hi @dongyiyi,

I hope these changes fixed your installation issues. Since I haven't heard back I'm going to merge these changes in to the main branch and close this issue. If you're still having troubles, let me know.

Best, Tim

dongyiyi commented 4 years ago

Hi, Tim

Sorry for the late response. I tried to install the BAHZ again, but I also got the same error information. I have no idea to fix this problem anymore. I just want you to know this, so update the message.

Thanks, Yiyi