jts / nanopolish

Signal-level algorithms for MinION data
MIT License
550 stars 160 forks source link

Installation error #1102

Closed rugilemat closed 8 months ago

rugilemat commented 10 months ago

Hi, I seem to be having a similar error as #1096:

/usr/bin/ld: cannot find -lbz2
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:316: libhts.so] Error 1
make[1]: Leaving directory '/users/k1347718/nanopolish/htslib'
make: *** [Makefile:139: htslib/libhts.a] Error 255

I have also tried installing through conda but get:

nanopolish: error while loading shared libraries: libhdf5.so.10: cannot open shared object file: No such file or directory

The above error happens regardless whether I install it through git or conda. I tried installing the lbz2 package separately but that didn't seem to help so any advice would be appreciated.

Modernism-01 commented 10 months ago

Hello, I had the same problem. Did you solve it?

rugilemat commented 10 months ago

No @Modernism-01, I'm still struggling with it.

rdeborja commented 10 months ago

Issue #1071 seems to have addressed this.

Nanopolish requires htslib, which in turn requires a library called bz2
(this is the -lbz2 error). You'll need to install this to compile both.

When you tried installing the bz2 library manually, did you update all the necessary environment variables to point to it? Also, what operating system are you using?

rugilemat commented 9 months ago

I've been trying to use the system-wide ones we have installed on the HPC, so they should be loaded to the path and run the command: make HDF5=noinstall HTS=noinstall

This is what I end up with after letting the make run till the end:

make[1]: Leaving directory '/scratch/prj/ppn_microglia_mod/directrna/scripts/nanopolish/slow5lib'
g++ -o nanopolish -g -O3 -std=c++11 -fopenmp -fsigned-char -D_FILE_OFFSET_BITS=64    -I./minimap2 -I./src -I./src/hmm -I./src/thirdparty -I./src/thirdparty/scrappie -I./src/common -I./src/alignment -I./src/pore_model -I./src/io -I./src/basemods -I./eigen/ -I./slow5lib/include/ -fPIC src/main/nanopolish.o src/nanopolish_vcf2fasta.o src/nanopolish_polya_estimator.o src/nanopolish_haplotype.o src/nanopolish_call_methylation.o src/nanopolish_squiggle_read.o src/nanopolish_detect_polyi.o src/nanopolish_variant_db.o src/nanopolish_read_db.o src/nanopolish_methyltrain.o src/nanopolish_raw_loader.o src/nanopolish_index.o src/nanopolish_scorereads.o src/training_core.o src/nanopolish_phase_reads.o src/nanopolish_fast5_check.o src/nanopolish_call_variants.o src/nanopolish_train_poremodel_from_basecalls.o src/hmm/nanopolish_transition_parameters.o src/hmm/nanopolish_duration_model.o src/hmm/nanopolish_profile_hmm_r7.o src/hmm/nanopolish_profile_hmm.o src/hmm/nanopolish_profile_hmm_r9.o src/common/fs_support.o src/common/logsum.o src/common/nanopolish_klcs.o src/common/nanopolish_alphabet.o src/common/nanopolish_iupac.o src/common/nanopolish_common.o src/common/nanopolish_variant.o src/common/nanopolish_bam_utils.o src/common/nanopolish_bam_processor.o src/alignment/nanopolish_eventalign.o src/alignment/nanopolish_anchor.o src/alignment/nanopolish_alignment_db.o src/pore_model/nanopolish_model_names.o src/pore_model/nanopolish_pore_model_set.o src/pore_model/nanopolish_poremodel.o src/io/nanopolish_fast5_processor.o src/io/nanopolish_fast5_loader.o src/io/nanopolish_fast5_io.o src/basemods/nanopolish_basemods.o src/thirdparty/fet.o src/thirdparty/stdaln.o src/thirdparty/scrappie/event_detection.o src/thirdparty/scrappie/scrappie_common.o  ./minimap2/libminimap2.a ./slow5lib/lib/libslow5.a  -lz -lrt -lhdf5 -lhts 

And while it doesn't seem like it ends up with any errors, I still end up with:

Command 'nanopolish' not found, but can be installed with:

apt install nanopolish
Please ask your administrator.
You will have to enable the component called 'universe'

So I'm really not sure what I'm doing wrong or what's going on.

rdeborja commented 9 months ago

@rugilemat is there nanopolish in the directory somewhere if you run the following? find . -name nanopolish It should be in the root directory where you ran the make command.

rugilemat commented 9 months ago

Yeah I can find it in the nanopolish folder and that's where I tried to run it from when I got that error.

Here's how the nanopolish folder looks like:

DEVELOPERS.md   docs                 etc      Makefile    README.md  src
Dockerfile      eigen                htslib   minimap2    scripts    test
Dockerfile-arm  eigen-3.3.7.tar.bz2  LICENSE  nanopolish  slow5lib

But it won't let me run it.

rdeborja commented 9 months ago

@rugilemat can you try running ./nanopolish instead of nanopolish?

rugilemat commented 9 months ago

Thanks - currently trying to run ./nanopolish index and it seems to be working.

But so far it seems like the way to solve the error

collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:316: libhts.so] Error 1
make[1]: Leaving directory '/users/k1347718/nanopolish/htslib'
make: *** [Makefile:139: htslib/libhts.a] Error 255

was running make HDF5=noinstall HTS=noinstall and loading locally installed libraries instead.

I'll see if I can get through ./nanopolish index and close the issue if that functions.

rdeborja commented 9 months ago

Glad it seems to be working although I'm still a bit confused on the original error. I've been building from scratch (including htslib and hdf5) and haven't been able to reproduce the error.

rugilemat commented 9 months ago

I think I'll have to reinstall as I can run nanopolish index but getting errors in nanopolish eventalign with multithreading and VBZ compression support (the HDF5 and HTS libraries we got installed on the cluster are too old for that.

I'll try to build from scratch again and see if error persists or if there is some other way I can install those libraries.

rugilemat commented 9 months ago

I tried building from scratch and the error persists:

gcc -shared -Wl,-soname,libhts.so.3 -fvisibility=hidden -o libhts.so kfunc.pico kstring.pico bcf_sr_sort.pico bgzf.pico errmod.pico faidx.pico header.pico hfile.pico hts.pico hts_expr.pico hts_os.pico md5.pico multipart.pico probaln.pico realn.pico regidx.pico region.pico sam.pico synced_bcf_reader.pico vcf_sweep.pico tbx.pico textutils.pico thread_pool.pico vcf.pico vcfutils.pico cram/cram_codecs.pico cram/cram_decode.pico cram/cram_encode.pico cram/cram_external.pico cram/cram_index.pico cram/cram_io.pico cram/cram_stats.pico cram/mFILE.pico cram/open_trace_file.pico cram/pooled_alloc.pico cram/string_alloc.pico htscodecs/htscodecs/arith_dynamic.pico htscodecs/htscodecs/fqzcomp_qual.pico htscodecs/htscodecs/htscodecs.pico htscodecs/htscodecs/pack.pico htscodecs/htscodecs/rANS_static4x16pr.pico htscodecs/htscodecs/rANS_static.pico htscodecs/htscodecs/rle.pico htscodecs/htscodecs/tokenise_name3.pico -lz -lm -lbz2 -lpthread
/usr/bin/ld: cannot find -lbz2
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:316: libhts.so] Error 1
make[1]: Leaving directory '/scratch/prj/ppn_microglia_mod/directrna/scripts/nanopolish/htslib'
make: *** [Makefile:139: htslib/libhts.a] Error 255

I'm looking into alternative ways for installing libraries.

hasindu2008 commented 9 months ago

You can try doing a minimal hts build using the script at https://github.com/hasindu2008/f5c/blob/master/scripts/install-hts.sh. Then perhaps point the nanopolish to this htslib build.

rugilemat commented 9 months ago

Thanks @hasindu2008 - looks like it's missing lbz2 so I need to find a way to install that first.

hasindu2008 commented 9 months ago

If you specify --enable-bz2=no --enable-lzma=no to the configure step of htslib, lbz2 is not required.

rugilemat commented 8 months ago

I managed to get it running by installing it through conda. However, I am having some trouble with my fast5 files as eventalign gives no output.