This is a test version of Biostars. For the public version, visit https://www.biostars.org.
HTseq Pysam error

Hi everyone I am getting pysam error while running the htseq script even if I installed it. I am using both htseq and pysam in anaconda version.

**Requirement already satisfied: htseq in /mnt/homeapps/apps/dmc/apps/anaconda_2-4.2.0_cent/lib/python2.7/site-packages
Requirement already satisfied: pysam in /mnt/homeapps/apps/dmc/apps/anaconda_2-4.2.0_cent/lib/python2.7/site-packages
Requirement already satisfied: numpy in /mnt/homeapps/apps/dmc/apps/anaconda_2-4.2.0_cent/lib/python2.7/site-packages (from htseq)
52139 GFF lines processed.
Please Install PySam to use the BAM_Reader Class (http://code.google.com/p/pysam/)Error occured when reading beginning of SAM/BAM file.
  libbz2.so.1.0: cannot open shared object file: No such file or directory
  [Exception type: ImportError, raised in __init__.py:5]**

Please Help, Thank you,

Ambika

rna-seq

Are you using the latest versions? How did you install htseq-count?

simply conda install htseq.

How did you execute htseq-counts? Please be as informative as possible. Which versions are you using?

The error is about "libbz2.so.1.0: cannot open shared object file". Are you sure that is not present on your system? What kind of OS is your server running/is it is a cluster?

I'm not sure what the primary error is:

Please Install PySam to use the BAM_Reader Class

smells like outdated pysam to me.

Please post the output of:

python -c "import pysam ; print(pysam.__version__)"

WouterDeCoster and Genomax

My htseq version is 0.9.1. pysam version is 0.11.2.2 my script for htseq is : htseq-count -m union -f bam -r name -t CDS accepted_hits_sorted_1.bam my.gtf > counts.file

the output of python -c "import pysam ; print(pysam.__version__)" is an error:

_File "<string>", line 1, in <module> File "/opt/asn/apps/anaconda_2-4.2.0_cent/lib/python2.7/site-packages/pysam/__init__.py", line 5, in <module> from pysam.libchtslib import * ImportError: libbz2.so.1.0: cannot open shared object file: No such file or directory_

I have no idea if that "libbz2.so.1.0" is in my system but I am getting that error and I am using a cluster OS.

sorry, I could not reply fast because of new user limit error.

Genomax,

When I did locate libbz2 it gave me following path

/usr/lib/libbz2.so.1

/usr/lib/libbz2.so.1.0.6

/usr/lib64/libbz2.so

/usr/lib64/libbz2.so.1

/usr/lib64/libbz2.so.1.0.6

1 answer

You presumably don't have your channel orders set correctly. Ensure that the order is:

  • bioconda
  • conda-forge
  • r (this isn't needed in this case)
  • defaults

The default channel must be the last one or you'll see this behavior. The default channel has a LOT of subpar recipes, which can be avoided with conda-forge. See also this github issue, which is identical.

As an aside, you'll want to use featureCounts from subRead instead, it's much faster.

Devon Ryan,

I dont know if I did it in a proper way but what I did was:

**module load anaconda

conda install --override-channels -c conda-forge bzip2

conda create --clone biopython --name biopython

conda install htseq

conda install pysam

htseq-count -m union -f bam -r name -t CDS accepted_hits_sorted_1.bam my.gtf > counts.file**

I am not getting this. I would like to go the easy way but the problem is I am working on a cluster system and I don't see that program in there.

You don't need your cluster admin to install things for your, particularly when you're already using conda (hint: conda install subread).

Devon Ryan,

Even if I don't do conda install packages I am getting the same error. Is there anything else that I can do?

If you get that error regardless then it's likely that you're still using conda, even if you don't mean to.

Are your sys admins not responsive to requests for installation of new software via modules?

Partly using modules and partly locally installed software (in your own area) may lead to strange interactions/failures, especially if your home directory is not accessible on cluster nodes where the jobs run.

Log in to answer this question.