This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Tutorial: installing samtools with conda - overcoming two common errors

Posting this here to help others.

Question - trying to install samtools with conda and encountering this error:

samtools: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory

or this error:

samtools: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

This seems to resolve both errors (or at least it worked for me):

conda install "samtools>=1.10"

Note the use of ", they are important.

samtools conda

In Ubuntu 20.04 in a Windows WSL2 VM tried the conda install -c bioconda "samtools>=1.10" and got a bunch of "Package conflicts for:" zlib, libstdcxx-ng, libgcc-ng, and ncurses

This is the only solution that worked for me, trying to install samtools into a named conda environment. Other variations generated conflicts.

I face this problem with bcftools. I solved it via a Docker container

I solved my problem with libssl1.0.0 like this:

First I uninstalled samtools from my conda env, then I opened http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/ in my browser and download last version of libssl1.0.0 for my system (for me it was libssl1.0.0_1.0.2n-1ubuntu5.13_amd64.deb) Then I just install it:

sudo gdebi ./libssl1.0.0_1.0.2n-1ubuntu5.6_amd64.deb

And after that I installed samtools again. Paulo

Thus defeating the entire purpose of conda, which is to not alter the libraries that your system needs/uses.

That's not recommended, as conda is supposed to take full care of the dependency environment. Do what is done in the accepted answer, this will work. Make a new environment and install samtools into this one, that is always a good idea to avoid cross-environment contamination and avoid overloading individual envs. By the way, what you suggest only works if you have root permission, which on e.g. a HPC will never be the case.

Hello. Can someone help with an error during installing samtools 1.2? I installed samtools with the following command:

micromamba install samtools=1.2

But then I got the error during usage of samtools:

samtools: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

My micromamba channels:

  - conda-forge
  - bioconda
channel_priority: strict

My PC: Ubuntu 22.04.2 LTS on Windows 11 Pro, 22H2 I don't have this error on a macbook.

Why are you installing an old version of samtools from 2015? Use the latest.

2 answers

conda config --add channels bioconda
conda config --add channels conda-forge
conda install samtools==1.11

works for me

The order of channels should be (in file $HOME/.condarc)

channels:
  - conda-forge
  - bioconda
  - defaults

This should then take care of the dependencies and correct versions.

Thanks a lot ! Worked for me on Ubuntu 20.04

worked for Ubuntu 20.04.3 Thanks!

I had an error: samtools: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory tried to install libcrypto, but failed.

Thank you so so much! I tried many ways and this one finally worked on a Python 2.7 environment

I toggle this as "accepted answer" since it is the best way to tackle the problem. If you on top of that use mamba instead of conda it runs even faster.

conda install -c bioconda samtools openssl=1.0

this will solve the problem.

Log in to answer this question.