Search code examples
pythonlinuxserverqsub

How to import argparse when I am using qsub in Linux server?


I want to use CoNIFER, which is a python program for bioinformatics.

So, I wrote a script for qsub because of my institute's rule.

Here is my qsub script. I inserted enter in front of -- to show it clear.

#!/bin/bash
#$ -N oh
#$ -cwd
cd /usr/etc/GRAPE_ENV/Python/
python /home/osj118/tools/conifer_v0.2.2/conifer.py rpkm
--probes/home/osj118/input/GBM/Gastric/Exome_probe/Exome_probe_capture_library_coordinate.txt
--input /scratch/Gastric_cell_bam/AGS_2.fastq.gz_Illumina_exome_Exome.RGadded.marked.realigned.fixed.recal.bam
--output /home/osj118/output/AGS_rpkm.txt
cd /home/osj118/pyscripts

CoNIFER did not work and show error message that

ImportError: No module named argparse

I already used sys.append.path function but it failed to solve my problem.

Strangely, when I ran batch job, CoNIFER worked correctly without any error message.

As batch job violates the rule, I want to use qsub to work in Linux server.

Please give me any solution for this situation.


Solution

  • This smells like a pythonpath problem. The pythonpath determines where python can find the required modules. If you installed CoNIFER in a directory together with the packages it uses, then Python will find the packages only if they are on the pythonpath.

    You can specify the pythonpath as follows:

    export PYTHONPATH=/directory where CoNIFER is installed