problems in run macs2 callpeak

949 views
Skip to first unread message

Akira Takenaka

unread,
Oct 27, 2014, 6:26:26 AM10/27/14
to macs-ann...@googlegroups.com
I use macs2 callpeak 2 months ago, it ran perfect. But now I run the command below get the error?
How could I fix that problem?


>macs2 callpeak -t tbx3_m2_treat.sorted.bam -c control_m2.sorted.bam -f BAM -g mm -n tbx3_p -B -q 0.01
Traceback (most recent call last):
  File "/usr/local/bin/macs2", line 559, in <module>
    main()
  File "/usr/local/bin/macs2", line 55, in main
    from MACS2.callpeak import run
ImportError: No module named callpeak

Tao Liu

unread,
Oct 27, 2014, 4:44:39 PM10/27/14
to macs-ann...@googlegroups.com
Check if your Python PATH was moved in these 2 months. Best to ask your system admin.

Tao
> --
> You received this message because you are subscribed to the Google Groups "MACS announcement" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to macs-announcem...@googlegroups.com.
> To post to this group, send email to macs-ann...@googlegroups.com.
> Visit this group at http://groups.google.com/group/macs-announcement.
> For more options, visit https://groups.google.com/d/optout.

Akira Takenaka

unread,
Oct 27, 2014, 11:51:15 PM10/27/14
to macs-ann...@googlegroups.com
I noticed that is the changes of PYTHONPATH caused the problem, but I don't know why it also came up with the same problem after I add  the PYTHONPATH.
All the modules installed in /usr/local/lib/python2.7/dist-packages/MACS2.
Besides, I reinstall the MACS2


>sudo python setup.py install
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)

running install
running build
running build_py
running build_ext
running build_scripts
running install_lib
running install_scripts
changing mode of /usr/local/bin/macs2 to 775
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/MACS2-2.1.0.20140616.egg-info
Writing /usr/local/lib/python2.7/dist-packages/MACS2-2.1.0.20140616.egg-info

Is there anything wrong I added?


>echo $PYTHONPATH
/usr/local/lib/python2.7/dist-packages/MACS2:/usr/local/lib/python2.7/dist-packages/:/usr/lib/python2.6:/home/zluna/.local/lib/python2.7/site-packages:/usr/lib/python2.7

>python -c 'import sys; print(sys.path)'
['', '/home/zluna/.local/lib/python2.7/site-packages/HTSeq-0.6.1-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/gevent-1.0rc2-py2.7-linux-x86_64.egg', '/usr/lib/python2.7/dist-packages', '/usr/local/lib/python2.7/dist-packages/MACS2', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.6', '/home/zluna/.local/lib/python2.7/site-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']




在 2014年10月27日星期一UTC+8下午6时26分26秒,Akira Takenaka写道:

Akira Takenaka

unread,
Oct 28, 2014, 8:07:47 AM10/28/14
to macs-ann...@googlegroups.com
Now, there is something interesting--I reinstall the macs2. But I think /usr/bin/macs2 is installed previous.

>/usr/bin/macs2 callpeak .......  run successfully

>macs2 callpeak ...... error

Traceback (most recent call last):
  File "/usr/local/bin/macs2", line 5, in <module>
    pkg_resources.run_script('MACS2==2.1.0.20140616', 'macs2')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 528, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1394, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/MACS2-2.1.0.20140616-py2.7-linux-x86_64.egg/EGG-INFO/scripts/macs2", line 559, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/MACS2-2.1.0.20140616-py2.7-linux-x86_64.egg/EGG-INFO/scripts/macs2", line 55, in main

    from MACS2.callpeak import run
ImportError: No module named callpeak

I don't how to set the python environment. Please help me. thanx.



在 2014年10月27日星期一UTC+8下午6时26分26秒,Akira Takenaka写道:

Tao Liu

unread,
Oct 28, 2014, 10:48:22 AM10/28/14
to macs-ann...@googlegroups.com
Check your PATH. '/usr/local/bin' normally has higher priority than '/usr/bin/' (depending on which appears later in PATH), so when you run 'macs2', your system will call '/usr/local/bin/macs2'. The same mechanism will be applied to PYTHONPATH where the last one has higher priority. In your case, your previous installed libraries in /usr/lib/python2.7 overwrote the new ones in /usr/local/lib/python2.7/dist-packages/. To avoid any conflicts, remove the previous installation under /usr/bin and /usr/lib/python2.7, and also clean your PATH and PYTHONPATH variables.

Tao

Akira Takenaka

unread,
Oct 29, 2014, 10:17:33 PM10/29/14
to macs-ann...@googlegroups.com
Hi Tao:
Thank you very much. I got why I can't run it just as you said. But I don't know how to remove the previous installation....
So, I choose an easy way--delete the 'macs2' under /usr/local/bin/' . Whatever, it now runs perfect.

Now I noticed that when I copy the 'macs2' from '/usr/bin' to '/usr/local/bin', my pythonpath still is '/home/zluna/.local/lib/python2.7/site-packages/HTSeq-0.6.1-py2.7-linux-x86_64.egg:/usr/local/lib/python2.7/dist-packages/gevent-1.0rc2-py2.7-linux-x86_64.egg:/usr/lib/python2.7/dist-packages:/usr/local/lib/python2.7/dist-packages/MACS2-2.1.0.20140616-py2.7-linux-x86_64.egg:/media/zluna/Analysis/usr/lib/python2.7:/usr/lib/python2.7:/usr/lib/python2.7/plat-x86_64-linux-gnu:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/home/zluna/.local/lib/python2.7/site-packages:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages/PILcompat:/usr/lib/python2.7/dist-packages/gtk-2.0:/usr/lib/pymodules/python2.7:/usr/lib/python2.7/dist-packages/ubuntu-sso-client' , but I can run 'macs2' (it will call /usr/local/bin/macs2) which can not run before. 
>which macs2
/usr/local/bin/macs2


Shortly, the same configuration did not wort before, but now it works. Is that strange?



在 2014年10月28日星期二UTC+8下午10时48分22秒,Tao Liu写道:

Tao Liu

unread,
Nov 7, 2014, 4:24:52 PM11/7/14
to macs-ann...@googlegroups.com
Do not copy script from /usr/bin to /usr/local/bin since you will be confused in the future.

The thing is that previously you have two installation, one having 'macs2' in /usr/bin and library files in '/usr/lib/python2.7/site-packages' and another having 'macs2' in /usr/local/bin and libraries in '/usr/local/python2.7/site-packages'. Note: you have to figure out the actual PATHs. And your '/usr/lib/' path has higher priority in PYTHONPATH but your '/usr/local/bin' has higher priority in PATH, this caused a mismatch between script and library files. I suggest you clean your PATH and PYTHONPATH otherwise you may have more troubles later on not only for MACS2. The best practice is to use 'virtualenv' and 'pip' methods to have a clean isolated python environment that you can work on. Google if you want to try.

Tao
Reply all
Reply to author
Forward
0 new messages