PoonLab / clustuneR

Implementing clustering algorithms on genetic data and finding optimal parameters through the performance of predictive growth models.
GNU General Public License v3.0
0 stars 0 forks source link

install problems #16

Closed liamxg closed 9 months ago

liamxg commented 10 months ago
image
liamxg commented 10 months ago

@ArtPoon

ArtPoon commented 9 months ago

Sorry for the delayed response. What OS and version of R are you using?

ArtPoon commented 9 months ago

The guppy and pplacer binaries that we are distributing in the inst directory of this package are compiled for Linux platforms only. They will not run in macOS or Windows.

ArtPoon commented 9 months ago

Based on your screenshot it looks like you are running macOS. I am attempting to compile pplacer binaries for macOS but it is not a trivial process (following instructions here). Presently I am stuck at this point of the build (copying command history here for record):

art@Wernstrom pplacer-1.1.alpha19 % brew install opam
art@Wernstrom pplacer-1.1.alpha19 % brew search camlp4-extra
==> Formulae
camlp-streams
art@Wernstrom pplacer-1.1.alpha19 % brew install camlp-streams
art@Wernstrom pplacer-1.1.alpha19 % brew install gawk
art@Wernstrom pplacer-1.1.alpha19 % brew install gsl               
==> Downloading https://formulae.brew.sh/api/formula.jws.json

==> Downloading https://formulae.brew.sh/api/cask.jws.json

Warning: gsl 2.7.1 is already installed and up-to-date.
To reinstall 2.7.1, run:
  brew reinstall gsl
art@Wernstrom pplacer-1.1.alpha19 % brew search sqlite3
==> Formulae
sqlite ✔                                 rqlite

==> Casks
slite
art@Wernstrom pplacer-1.1.alpha19 % brew install zlib
art@Wernstrom pplacer-1.1.alpha19 % brew search m4
==> Formulae
gtkmm4                     lm4tools                   m4 ✔
art@Wernstrom pplacer-1.1.alpha19 % brew search ocaml
==> Formulae
ocaml ✔                    ocaml-num                  ocamlbuild ✔
ocaml-findlib              ocaml-zarith               ocm

==> Casks
local
art@Wernstrom pplacer-1.1.alpha19 % brew search patch
==> Formulae
gpatch ✔            patchelf            pachi               hatch
patch-package       patchutils          watch               pfetch

==> Casks
catch                      opencore-patcher           pitch
multipatch                 patchwork                  qlprettypatch
art@Wernstrom pplacer-1.1.alpha19 % which ocamlc
/usr/local/bin/ocamlc
art@Wernstrom pplacer-1.1.alpha19 % ocamlc -version
4.14.0
art@Wernstrom git % git clone https://github.com/matsen/pplacer.git
art@Wernstrom pplacer % brew install curl
art@Wernstrom pplacer % opam init github git+https://github.com/ocaml/opam-repository.git
No configuration file found, using built-in defaults.
Checking for available remotes: rsync and local, git.
  - you won't be able to use mercurial repositories unless you install the hg
    command on your system.
  - you won't be able to use darcs repositories unless you install the darcs
    command on your system.

<><> Fetching repository information ><><><><><><><><><><><><><><><><><><><>  🐫 
[github] Initialised

<><> Required setup - please read <><><><><><><><><><><><><><><><><><><><><>  🐫 

  In normal operation, opam only alters files within ~/.opam.

  However, to best integrate with your system, some environment variables
  should be set. If you allow it to, this initialisation step will update
  your zsh configuration by adding the following line to ~/.zshrc:

    [[ ! -r /Users/art/.opam/opam-init/init.zsh ]] || source /Users/art/.opam/opam-init/init.zsh  > /dev/null 2> /dev/null

  Otherwise, every time you want to access your opam installation, you will
  need to run:

    eval $(opam env)

  You can always re-run this setup with 'opam init' later.

Do you want opam to modify ~/.zshrc? [N/y/f]
(default is 'no', use 'f' to choose a different file) no

<><> Creating initial switch 'default' (invariant ["ocaml" {>= "4.05.0"}] - initially with ocaml-system) 

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><>  🐫 
Switch invariant: ["ocaml" {>= "4.05.0"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
∗ installed ocaml-system.4.14.0
∗ installed ocaml-config.2
∗ installed ocaml.4.14.0
Done.
# Run eval $(opam env --switch=default) to update the current shell environment
art@Wernstrom pplacer % command -v ocamlc && ( ocamlc -version | grep -q 3.12.1 ) || opam switch install 3.12.1
/usr/local/bin/ocamlc

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><>  🐫 
Switch invariant: ["ocaml-base-compiler" {= "3.12.1"} | "ocaml-system" {= "3.12.1"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
[ERROR] Failed to get sources of ocaml-base-compiler.3.12.1: Download command failed

#=== ERROR while fetching sources for ocaml-base-compiler.3.12.1 ==============#
OpamSolution.Fetch_fail("http://caml.inria.fr/pub/distrib/ocaml-3.12/ocaml-3.12.1.tar.gz (Download command failed: \"/usr/local/bin/wget --content-disposition -t 3 -O /Users/art/.opam/3.12.1/.opam-switch/sources/ocaml-base-compiler.3.12.1/ocaml-3.12.1.tar.gz.part -U opam/2.1.5 -- http://caml.inria.fr/pub/distrib/ocaml-3.12/ocaml-3.12.1.tar.gz\" exited with code 256)")
ArtPoon commented 9 months ago

Found a solution in a similar GitHub issue. This got me past the Download failure, but now stuck at another error:

art@Wernstrom pplacer % brew upgrade libidn2
art@Wernstrom pplacer % command -v ocamlc && ( ocamlc -version | grep -q 3.12.1 ) || opam switch install 3.12.1
⬇ retrieved ocaml-base-compiler.3.12.1  (http://caml.inria.fr/pub/distrib/ocaml-3.12/ocaml-3.12.1.tar.gz)
[ERROR] The compilation of ocaml-base-compiler.3.12.1 failed at "make world.opt".

#=== ERROR while compiling ocaml-base-compiler.3.12.1 =========================#
# context     2.1.5 | macos/x86_64 |  | git+https://github.com/ocaml/opam-repository.git
# path        ~/.opam/3.12.1/.opam-switch/build/ocaml-base-compiler.3.12.1
# command     ~/.opam/opam-init/hooks/sandbox.sh build make world.opt
# exit-code   2
# env-file    ~/.opam/log/ocaml-base-compiler-12371-c67484.env
# output-file ~/.opam/log/ocaml-base-compiler-12371-c67484.out
### output ###
# [...]
# make[2]: Nothing to be done for `all'.
# /Library/Developer/CommandLineTools/usr/bin/make runtimeopt
# cd asmrun; /Library/Developer/CommandLineTools/usr/bin/make all
# cc -I../byterun -DCAML_NAME_SPACE -DNATIVE_CODE -DTARGET_amd64 -DSYS_macosx  -O -D_FILE_OFFSET_BITS=64 -D_REENTRANT   -c -o startup.o startup.c
# startup.c:162:3: error: call to undeclared function 'caml_debugger_init'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
#   caml_debugger_init (); /* force debugger.o stub to be linked */
#   ^
# 1 error generated.
# make[3]: *** [startup.o] Error 1
# make[2]: *** [makeruntimeopt] Error 2
# make[1]: *** [opt-core] Error 2
# make: *** [world.opt] Error 2
ArtPoon commented 9 months ago

Looks like cc calls clang on macOS Ventura (13.5.2)

art@Wernstrom pplacer % cc
clang: error: no input files

There's also a macOS (Darwin) binary of an older release of pplacer. It requires an older version of libgsl then what is installed by my current version of Homebrew, however:

(venv) art@Wernstrom pplacer-Darwin-v1.1.alpha17-6-g5cecf99 % ./pplacer       
dyld[18808]: Library not loaded: /usr/local/lib/libgsl.0.dylib
  Referenced from: <0D61E9B0-4DB5-3D60-99A8-F091685CDB35> /Users/art/Downloads/pplacer-Darwin-v1.1.alpha17-6-g5cecf99/pplacer
  Reason: tried: '/usr/local/lib/libgsl.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libgsl.0.dylib' (no such file), '/usr/local/lib/libgsl.0.dylib' (no such file), '/usr/lib/libgsl.0.dylib' (no such file, not in dyld cache)
zsh: abort      ./pplacer
(venv) art@Wernstrom pplacer-Darwin-v1.1.alpha17-6-g5cecf99 % brew info gsl  
==> gsl: stable 2.7.1 (bottled)
Numerical library for C and C++

This is a known issue: https://groups.google.com/g/pplacer-users/c/FhJyH9MUY78

I'll try compiling an older version of libgsl (version 1.16) and see if this pplacer binary can locate the resulting dynamic libraries.

ArtPoon commented 9 months ago

Ok, I was able to run the Darwin binaries for pplacer release v1.1.alpha17 after installing an older version of libgsl. Steps:

  1. Download a copy of the GSL library (version 1.16) from: https://mirror2.evolution-host.com/gnu/gsl/
  2. Uncompress the archive with tar -xvzf gsl-1.16.tar.gz
  3. Enter this directory (cd gsl-1.16) and run ./configure
  4. Run make and then sudo make install. If you do not have superuser privileges on your system, then you will have to install the library files somewhere that pplacer is going to find them. This will probably mean modifying your $DYLD_LIBRARY_PATH environment variable (see https://discussions.apple.com/thread/1670523 for a related example).
  5. You should now be able to run the pplacer Darwin binary by calling its relative or absolute path:
    art@Wernstrom pplacer-Darwin-v1.1.alpha17-6-g5cecf99 % ls
    guppy   pplacer rppr    scripts
    art@Wernstrom pplacer-Darwin-v1.1.alpha17-6-g5cecf99 % ./pplacer
    Warning: pplacer couldn't find any sequences to place. Please supply an alignment with sequences to place as an argument at the end of the command line.

    Finally, you'll need to move these binaries to replace the Linux binaries in the inst folder of the clustuneR package distribution.

liamxg commented 9 months ago

Thank you !!!

(base) simon@192 gsl-1.16 % ls
AUTHORS         cdf         err         gsl_math.h      mdate-sh        siman
BUGS            cheb            fft         gsl_minmax.h        min         sort
COPYING         combination     fit         gsl_mode.h      missing         specfunc
ChangeLog       complex         gsl         gsl_nan.h       mkinstalldirs       stamp-h1
INSTALL         config.guess        gsl-config      gsl_pow_int.h       monte           statistics
Makefile        config.h        gsl-config.in       gsl_precision.h     multifit        sum
Makefile.am     config.h.in     gsl-histogram       gsl_types.h     multimin        sys
Makefile.in     config.log      gsl-histogram.c     gsl_version.h       multiroots      templates_off.h
NEWS            config.status       gsl-histogram.o     gsl_version.h.in    multiset        templates_on.h
README          config.sub      gsl-randist     histogram       ntuple          test
THANKS          configure       gsl-randist.c       ieee-utils      ode-initval     test-driver
TODO            configure.ac        gsl-randist.o       install-sh      ode-initval2        test_gsl_histogram.sh
aclocal.m4      const           gsl.m4          integration     permutation     utils
autogen.sh      depcomp         gsl.pc          interpolation       pkgconfig.test      vector
blas            deriv           gsl.pc.in       libgsl.la       poly            version.c
block           dht         gsl.spec        libtool         qrng            version.lo
bspline         diff            gsl.spec.in     linalg          randist         version.o
build.h         doc         gsl_inline.h        ltmain.sh       rng         wavelet
cblas           eigen           gsl_machine.h       matrix          roots
(base) simon@192 gsl-1.16 % ./pplacer
zsh: no such file or directory: ./pplacer
liamxg commented 9 months ago

I do the same as your guide, but still can not find pplacer.

ArtPoon commented 9 months ago

Looks like you are still in the gsl directory. You need to be in the pplacer directory.

liamxg commented 9 months ago

@ArtPoon I am so stupid, could you please tell me where can I find the pplacer dierctory? Thanks.

ArtPoon commented 9 months ago
ArtPoon commented 9 months ago

You'll need to go through the same process to enable the guppy binary.

liamxg commented 9 months ago

Thanks. I enable both the guppy and pplacer binaries, and installed gsl-1.16, when I run the command in R:

extend.tree(phy, seq.info, seqs, mc.cores = 4, log.file = "data/na.log") sh: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/clustuneR/pplacer: cannot execute binary file sh: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/clustuneR/guppy: cannot execute binary file Error in file(file, "r") : cannot open the connection In addition: Warning message: In file(file, "r") : cannot open file '/var/folders/q4/gvrdsnj94vl527nfhj25rxh40000gn/T//RtmpVrwGut/growth.tre': No such file or directory

liamxg commented 9 months ago

still the same error.

liamxg commented 9 months ago

(base) simon@192 inst % ls
exdata guppy pplacer rppr (base) simon@192 inst % ./pplacer Warning: pplacer couldn't find any sequences to place. Please supply an alignment with sequences to place as an argument at the end of the command line.

liamxg commented 9 months ago

(base) simon@192 inst % ./guppy please specify a guppy command, e.g. guppy COMMAND [...] Here is a list of commands available using this interface: visualization fat makes trees with edges fattened in proportion to the number of reads heat maps an an arbitrary vector of the correct length to the tree sing makes one tree for each query sequence, showing uncertainty tog makes a tree with each of the reads represented as a pendant edge

statistical comparison bary draws the barycenter of a placement collection on the reference tree edpl calculates the EDPL uncertainty values for a collection of pqueries epca performs edge principal components error finds the error between two placefiles fpd calculates various alpha diversity metrics of placefiles indep_c calculates the independent contrasts of pqueries kr calculates the Kantorovich-Rubinstein distance and corresponding p-values kr_heat makes a heat tree lpca performs length principal components mcl cluster pqueries using Markov clustering via MCL pmlpca performs poor-man's length principal components rarefact calculates phylogenetic rarefaction curves splitify writes out differences of masses for the splits of the tree squash performs squash clustering unifrac calculates unifrac on two or more placefiles

classification classify outputs classification information in SQLite format to_rdp convert a reference package to a format RDP wants

utilities adcl calculates ADCL for each pquery in a placefile check checks placefiles for common problems compress compresses a placefile's pqueries demulti splits apart placements with multiplicity, undoing a round procedure distmat prints out a pairwise distance matrix between the edges filter filters one or more placefiles by placement name info writes the number of leaves of the reference tree and the number of pqueries islands finds the mass islands of one or more pqueries merge merges placefiles together mft Multi-Filter and Transform placefiles ograph finds the overlap graph of one or more pqueries placemat prints out a pairwise distance matrix between placements rarefy performs rarefaction on collections of placements redup restores duplicates to deduped placefiles round clusters the placements by rounding branch lengths to_csv turns a placefile into a csv file to_json converts old-style .place files to .jplace placement files trim trims placefiles down to only containing an informative subset of the mass

To get more help about a given command, type guppy COMMAND --help

liamxg commented 9 months ago

Is this the problem that I do not modify my $DYLD_LIBRARY_PATH environment variable for gsl-1.16?

ArtPoon commented 9 months ago

Those are the expected outputs. Your binaries are working.

liamxg commented 9 months ago

still have error:

phy <- ape::read.tree("data/na.nwk") extend.tree(phy, seq.info, seqs, mc.cores = 4, log.file = "data/na.log") sh: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/clustuneR/pplacer: cannot execute binary file sh: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/clustuneR/guppy: cannot execute binary file Error in file(file, "r") : cannot open the connection In addition: Warning message: In file(file, "r") : cannot open file '/var/folders/q4/gvrdsnj94vl527nfhj25rxh40000gn/T//RtmpVrwGut/growth.tre': No such file or directory

ArtPoon commented 9 months ago

You need to rerun the command R CMD INSTALL . to copy these new binaries into your system R directory.

liamxg commented 9 months ago

cool! now works, thanks. Just one waring, does is matter:

image