【7.3】OSError[Errno 2] No such file or directory

报错:

File "<string>", line 1072, in executetask
  File "<string>", line 1, in do_exec
  File "<remote exec>", line 3, in <module>
  File "/data/user/sam/project/BPKit/bpkit_py2/antibody/Ab_numbering.py", line 240, in get_fv_region
    number_result = Abnumber(seq, number_type='kabat')
  File "/data/user/sam/project/BPKit/bpkit_py2/antibody/Ab_numbering.py", line 59, in __init__
    output=False)  # annotate with Anarci
  File "/data/software/anaconda2/lib/python2.7/site-packages/anarci/anarci.py", line 814, in anarci
    alignments = run_hmmer(sequences,hmm_database=database,hmmerpath=hmmerpath,ncpu=ncpu,bit_score_threshold=bit_score_thresh$ld )
  File "/data/software/anaconda2/lib/python2.7/site-packages/anarci/anarci.py", line 504, in run_hmmer
    process = Popen( command, stdout=PIPE, stderr=PIPE  )
  File "/data/software/anaconda2/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/data/software/anaconda2/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

解决问题的流程

同样的代码,在两个服务器上分别运行,一个报错,一个正常运行,这不得不让我怀疑是两个服务器所运行的环境变量的问题。

于是乎,在代码里面加入了一么一句

import os
print os.environ['PATH']

果真,两台服务器的运行环境变量有差别,

#36

/d$ta/software/netMHCIIpan-3.1
/data/softwar$/schrodinger2018-3
/data/software/schrodi$ger2018-3

##202

/data/software/amber18/bin
/data/software/ncbi-blast-2.7.1+/bin
/data/software/g09
/data/software/moe2018/bin
/data/software/gridengine/bin/lx-amd64
/data/software/gridengine/bin
/usr/lib64/qt-3.3/bin
/data/software/schrodinger2018-3
/home/software/netMHCpan-4.0
/data/software/g09/bsd
/data/software/g09/local
/data/software/g09/extras

用眼一票,难道是她?

/usr/lib64/qt-3.3/bin

我赶紧这个代码在另外一台节点上运行,发现也能运行,但这个节点没有这个环境变量,所以觉得应该不是它。哪到底是哪一个呢?

接着,我试着根据报错,来修改原始代码

vim /data/software/anaconda2/lib/python2.7/site-packages/anarci/anarci.py

process = Popen( command, stdout=PIPE, stderr=PIPE)
改成

process = Popen( command, stdout=PIPE, stderr=PIPE,shell=True  )

接着运行,这个时候,出现这个错误:

File "/data/software/anaconda2/lib/python2.7/site-packages/anarci/anarci.py", line 511, in run_hmmer
    raise HMMscanError(pr_stderr)
HMMscanError: -o: hmmscan: command not found

什么?? 没有hmmscan。 我读了一下原始代码,发现的确需要这个hmmscan。经过查证,发现果然不能正常运行的节点是没有装hmmscan

[sam@g03 5.pfsc_relation]$ which hmmscan
/data/software/moe2018/bin/hmmscan

[root@c02 ~]# which hmmscan
/usr/bin/which: no hmmscan in (/data/software/netMHCIIpan-3.1:/data/software/anaconda2/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/data/software/schrodinger2018-3:/root/bin)

在不能正常运行的节点上添加hmmscan的环境变量

vim /etc/profile

#MOE
export MOE=/data/software/moe2018
export PATH=$MOE/bin:$PATH

然后

source /etc/profile

将代码Popen( command, stdout=PIPE, stderr=PIPE,shell=True )中的shell=True去掉

重新运行,KO。

讨论

就不能一开始报个正确的错误呀,让我绕了一圈。。

这里是一个广告位,,感兴趣的都可以发邮件聊聊:tiehan@sina.cn
个人公众号,比较懒,很少更新,可以在上面提问题,如果回复不及时,可发邮件给我: tiehan@sina.cn