gtonkinhill / fastbaps

A fast approximation to a Dirichlet Process Mixture model (DPM) for clustering genetic data
MIT License
58 stars 8 forks source link

shared object ‘fastbaps.dylib’ not found #12

Closed anadom closed 4 years ago

anadom commented 4 years ago

Hi, I am a novice in using R packages and apologies in advance if this is not an issue for this forum. I am having trouble with running fastbaps (Mac os High Sierra 10.13.6) after installing it with conda as per the instructions on Github. I have installed all the dependencies and I can load the rest of the packages in R with the exception of fastbaps. The error I get is as follows: Loading required package: maps

library(fastbaps) Error: package or namespace load failed for ‘fastbaps’ in library.dynam(lib, package, package.lib): shared object ‘fastbaps.dylib’ not found I removed fastbaps and re-installed it a couple of times but that did not solve the issue. The fastbaps.dylib file does not seem to exist amongst all the other .dylib files. Any advice would be appreciated on how to move forward.

gtonkinhill commented 4 years ago

Hi, apologies for the slow response. It might be worth trying to reinstall Rcpp using install.packages('Rcpp') before installing fastbaps. This issue can sometimes also be fixed by restarting R.

jhawkey commented 4 years ago

Hi, I am also having this issue with the conda install (Mac OS 10.15.4). I have tried to reinstall Rcpp as suggested, but got the following error:

ld: unknown option: -platform_version
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/jane/miniconda3/envs/fastbaps/lib/R/share/make/shlib.mk:6: Rcpp.dylib] Error 1
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/Users/jane/miniconda3/envs/fastbaps/lib/R/library/Rcpp’
* restoring previous ‘/Users/jane/miniconda3/envs/fastbaps/lib/R/library/Rcpp’

I also tried restarting R but haven't had any luck unfortunately.

I get the same error when attempting to use the run_fastbaps command line tool.

Any help would be greatly appreciated!

gtonkinhill commented 4 years ago

Thanks for flagging this. It looks like something strange is going on with the way conda is handling the c++ dependencies. I will try and take a look in the next day or so. The run_fastbaps command relies on the main library being installed so wont work if that has failed.

Conda and R are often a bit tricky as sometimes local R versions can interfere. Are you able to install the program without conda using devtools::install_github("gtonkinhill/fastbaps") ?

jhawkey commented 4 years ago

Unfortunately I wasn't able to install in R either. I tried the install in a new packrat project to ensure I wasn't getting conflicts with other R packages that I have installed. I also had a look at the other issues raised with installs in R, and attempted to fix it by running

install.packages("Rcpp")
install.packages("RcppArmadillo")

as mentioned in #9, but that didn't help either unfortunately. I also tried the xcode command listed at the bottom of that issue, but my xcode is up to date (according to xcode).

The errors I was getting were different to those in #9, I have reproduced the compilation output in full below.

> devtools::install_github("gtonkinhill/fastbaps")
Downloading GitHub repo gtonkinhill/fastbaps@master
✓  checking for file ‘/private/var/folders/_w/q60cr5_n3ts6561n1dpl_pvw0000gn/T/RtmpNCSCk9/remotes753c509a0346/gtonkinhill-fastbaps-4b70f3f/DESCRIPTION’ ...
─  preparing ‘fastbaps’:
✓  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
─  building ‘fastbaps_1.0.0.tar.gz’

Installing package into ‘/Users/jane/Dropbox/ShigellaSonneiGenotyping/paper/fastbaps_analysis/packrat/lib/x86_64-apple-darwin15.6.0/3.5.3’
(as ‘lib’ is unspecified)
* installing *source* package ‘fastbaps’ ...
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/jane/Dropbox/ShigellaSonneiGenotyping/paper/fastbaps_analysis/packrat/lib/x86_64-apple-darwin15.6.0/3.5.3/Rcpp/include" -I"/Users/jane/Dropbox/ShigellaSonneiGenotyping/paper/fastbaps_analysis/packrat/lib/x86_64-apple-darwin15.6.0/3.5.3/RcppArmadillo/include" -I/usr/local/include  -DARMA_64BIT_WORD -fPIC  -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/jane/Dropbox/ShigellaSonneiGenotyping/paper/fastbaps_analysis/packrat/lib/x86_64-apple-darwin15.6.0/3.5.3/Rcpp/include" -I"/Users/jane/Dropbox/ShigellaSonneiGenotyping/paper/fastbaps_analysis/packrat/lib/x86_64-apple-darwin15.6.0/3.5.3/RcppArmadillo/include" -I/usr/local/include  -DARMA_64BIT_WORD -fPIC  -Wall -g -O2 -c bhier.cpp -o bhier.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/jane/Dropbox/ShigellaSonneiGenotyping/paper/fastbaps_analysis/packrat/lib/x86_64-apple-darwin15.6.0/3.5.3/Rcpp/include" -I"/Users/jane/Dropbox/ShigellaSonneiGenotyping/paper/fastbaps_analysis/packrat/lib/x86_64-apple-darwin15.6.0/3.5.3/RcppArmadillo/include" -I/usr/local/include  -DARMA_64BIT_WORD -fPIC  -Wall -g -O2 -c bhier_parallel.cpp -o bhier_parallel.o
bhier_parallel.cpp:35:22: warning: unused variable 'p1' [-Wunused-variable]
  unsigned int i,j,p,p1,p2;
                     ^
bhier_parallel.cpp:35:25: warning: unused variable 'p2' [-Wunused-variable]
  unsigned int i,j,p,p1,p2;
                        ^
2 warnings generated.
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/jane/Dropbox/ShigellaSonneiGenotyping/paper/fastbaps_analysis/packrat/lib/x86_64-apple-darwin15.6.0/3.5.3/Rcpp/include" -I"/Users/jane/Dropbox/ShigellaSonneiGenotyping/paper/fastbaps_analysis/packrat/lib/x86_64-apple-darwin15.6.0/3.5.3/RcppArmadillo/include" -I/usr/local/include  -DARMA_64BIT_WORD -fPIC  -Wall -g -O2 -c calc_ddk.cpp -o calc_ddk.o
calc_ddk.cpp:19:7: warning: unused variable 'n_snps' [-Wunused-variable]
  int n_snps = snp_matrix.n_rows;
      ^
calc_ddk.cpp:22:18: warning: unused variable 'j' [-Wunused-variable]
  unsigned int i,j,m,partition_length,left,right;
                 ^
calc_ddk.cpp:22:22: warning: unused variable 'partition_length' [-Wunused-variable]
  unsigned int i,j,m,partition_length,left,right;
                     ^
calc_ddk.cpp:23:7: warning: unused variable 'count' [-Wunused-variable]
  int count = 0;
      ^
4 warnings generated.
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/jane/Dropbox/ShigellaSonneiGenotyping/paper/fastbaps_analysis/packrat/lib/x86_64-apple-darwin15.6.0/3.5.3/Rcpp/include" -I"/Users/jane/Dropbox/ShigellaSonneiGenotyping/paper/fastbaps_analysis/packrat/lib/x86_64-apple-darwin15.6.0/3.5.3/RcppArmadillo/include" -I/usr/local/include  -DARMA_64BIT_WORD -fPIC  -Wall -g -O2 -c import_fasta_to_vector_each_nt.cpp -o import_fasta_to_vector_each_nt.o
In file included from import_fasta_to_vector_each_nt.cpp:6:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zlib.h:34:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zconf.h:462:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:655:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/gethostuuid.h:39:17: error: C++ requires a type specifier for all declarations
int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
                ^
In file included from import_fasta_to_vector_each_nt.cpp:6:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zlib.h:34:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zconf.h:462:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:662:27: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int      getsgroups_np(int *, uuid_t);
                              ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
typedef __darwin_uid_t        uid_t;
                              ^
In file included from import_fasta_to_vector_each_nt.cpp:6:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zlib.h:34:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zconf.h:462:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:664:27: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int      getwgroups_np(int *, uuid_t);
                              ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
typedef __darwin_uid_t        uid_t;
                              ^
In file included from import_fasta_to_vector_each_nt.cpp:6:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zlib.h:34:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zconf.h:462:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:727:31: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int      setsgroups_np(int, const uuid_t);
                                  ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
typedef __darwin_uid_t        uid_t;
                              ^
In file included from import_fasta_to_vector_each_nt.cpp:6:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zlib.h:34:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zconf.h:462:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:729:31: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int      setwgroups_np(int, const uuid_t);
                                  ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
typedef __darwin_uid_t        uid_t;
                              ^
5 errors generated.
make: *** [import_fasta_to_vector_each_nt.o] Error 1
ERROR: compilation failed for package ‘fastbaps’
* removing ‘/Users/jane/Dropbox/ShigellaSonneiGenotyping/paper/fastbaps_analysis/packrat/lib/x86_64-apple-darwin15.6.0/3.5.3/fastbaps’
Error: Failed to install 'fastbaps' from GitHub:
  (converted from warning) installation of package ‘/var/folders/_w/q60cr5_n3ts6561n1dpl_pvw0000gn/T//RtmpNCSCk9/file753c69e3d3cc/fastbaps_1.0.0.tar.gz’ had non-zero exit status
gtonkinhill commented 4 years ago

Ah I think I may have run into this previously. It was a mac specific issue with Rcpp and was possible to fix by installing the dev version of Rcpp as suggested here. However, I think a new release of Rcpp was created 2 days ago which may include the fix. Are you able to try updating Rcpp using devtools::install_github("RcppCore/Rcpp")

I am still looking into what might be going on with the conda version.

jhawkey commented 4 years ago

Ah excellent! That appears to have solved my problem. Thank you!