I had a similar problem and this worked for me. Thanks.
Hi everyone. I keep getting this error message with samtools. I have used samtools in the past plenty of times. I am not sure how to solve it. Any help would be greatly appreciated.
samtools: error while loading shared libraries: libbz2.so.1.0: cannot open shared object file: No such file or directory
I have tried googling the error. Nothing specific with respect to samtools has come up. However, there were some fixes that I tried:
sudo yum install bzip2-devel
sudo ln -s find /usr/lib64/ -type f -name "libbz2.so.1*" /usr/lib64/libbz2.so.1.0
However, it asks for a login when I try this fix or others.
2 answers
From https://github.com/bioconda/bioconda-recipes/pull/5049#issuecomment-311070184
bioconda now requires conda-forge and the conda-forge version of bzip2 uses shared libraries, while the one in the main channel uses a static library. Since it was compiled against the shared library version you need to also have than included in your environment. Hope this fixes it for you.
Try installing samtools with conda-forge included:
conda install -c conda-forge -c bioconda samtools bzip2
Try updating or installing bzip2 via conda. Until relatively recently the .so file wasn't included, so samtools (and everything else) needed to use whatever was installed on your system. If that doesn't work, ask the systems administrator to install libbz2, which they will likely be happy to do.
Log in to answer this question.
Which version of samtools? Was it recently updated? Did you install samtools yourself? Are you the administrator of the computer?
It is version 1.5. I used bioconda to install samtools. I had used samtools successfully multiple times over the past few months. Suddenly, today I had this issue. I also updated samtools after this issue popped up and that did not seem to fix the issue
I am not the administrator. I have an account on a linux server, CentOS 6.6.
will ask for admin/sudo pass word because you are trying to install a package. If you are the administrator, furnish pass word and if you are not the administrator, request your administrator to install bzip2-devel or request him/her to give you sudo privileges.
Btw, did you check the version of bzip2-devel on the system, you have access to? If it doesn't exist, then one should do above step. If it is already existing, either you have to update or a simple soft linking (given below) should be enough. However you need root/sudo privileges to make any changes at system leve.
You are soft linking a file in root file system. Again, you need to furnish password to make system wide change.
Is your problem solved? I also encountered the same problem.
+1 for static libraries