deeptools / pyGenomeTracks

python module to plot beautiful and highly customizable genome browser tracks
GNU General Public License v3.0
772 stars 111 forks source link

Import error #22

Closed Phlya closed 6 years ago

Phlya commented 6 years ago

Hi, I upgraded PGT to the master branch and now can't import it in python:

ImportError                               Traceback (most recent call last)
<ipython-input-6-b7529b25397d> in <module>()
     29 import _mysql
     30 import re
---> 31 from pygenometracks import tracksClass# import BigWigTrack, BedGraphTrack, BedTrack
     32 import decimal

/usr/local/lib/python3.5/dist-packages/pygenometracks/tracksClass.py in <module>()
     29 from collections import OrderedDict
     30 
---> 31 from pygenometracks.tracks import *
     32 
     33 FORMAT = "[%(levelname)s:%(filename)s:%(lineno)s - %(funcName)20s()] %(message)s"

ImportError: No module named 'pygenometracks.tracks'
fidelram commented 6 years ago

how did you upgrade?

is PGT in your PYTHONPATH?

fidelram commented 6 years ago

ahh wait ... now I change the code a bit and all tracks are now in the tracks folder.

i think that you should do from pygenometracks.tracks import BigwigTrack

fidelram commented 6 years ago

@Phlya Did you solve the problem ?

Phlya commented 6 years ago

Hi, sorry, I forgot to try it out... Nope, this doesn't work either, I am afraid:

ImportError                               Traceback (most recent call last)
<ipython-input-1-d0e40cc69b2e> in <module>()
     29 import _mysql
     30 import re
---> 31 from pygenometracks.tracks import BigwigTrack, BedTrack# import BigWigTrack, BedGraphTrack, BedTrack
     32 import decimal

ImportError: No module named 'pygenometracks.tracks'
fidelram commented 6 years ago

for me this works:

from pygenometracks.tracks import BigWigTrack

I think that you may have two versions of pyGenomeTracks and that your PYTHONPATH is pointing towards the wrong one.

try to delete any previous version and install the latest.

Phlya commented 6 years ago

Mh. So, I rm -rf'd everything mentioning pygenometracks from dist-packages, checked that I can't import pygenometracks, then installed it from github. Now I can import just pygenometracks, but I still get this:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-99a16a47b36d> in <module>()
     30 import re
     31 # from pygenometracks import tracksClass
---> 32 from pygenometracks.tracks import BigWigTrack, BedGraphTrack, BedTrack
     33 import decimal

ImportError: No module named 'pygenometracks.tracks'
fidelram commented 6 years ago

how did you install it?

if you just clone it from github you need to set up a PYTHONPATH variable that points to the pygenometracks folder.

Phlya commented 6 years ago

sudo pip3 install --upgrade https://github.com/deeptools/pyGenomeTracks/archive/master.zip

Phlya commented 6 years ago

The same error occurs when I try to use pygenometracks in the command line

s1529682:~/Documents/PhD/Hi-C/pygenometracks$ make_tracks_file --trackFiles ~/eddie/ilia/coolers/IMR90/Rao2014-IMR90-MboI-allreps-filtered.10kb.cool ~/Documents/PhD/refGene.txt ~/Documents/PhD/Nefeli_CCT.bed -o Nefeli.config 
Traceback (most recent call last):
  File "/usr/local/bin/make_tracks_file", line 4, in <module>
    from pygenometracks.makeTracksFile import main
  File "/usr/local/lib/python3.5/dist-packages/pygenometracks/makeTracksFile.py", line 4, in <module>
    from pygenometracks.tracksClass import PlotTracks
  File "/usr/local/lib/python3.5/dist-packages/pygenometracks/tracksClass.py", line 31, in <module>
    from pygenometracks.tracks import *
ImportError: No module named 'pygenometracks.tracks'
vivekbhr commented 6 years ago

@Phlya you can update the pygenometracks from master branch to solve this issue

alexmascension commented 6 years ago

I would like to add a small comment in here... I suffered from the issues https://github.com/deeptools/pyGenomeTracks/issues/22 and https://github.com/deeptools/pyGenomeTracks/issues/23, by installing deepTools and pyGenomeTracks with anaconda (python 3.6).

The way I found to solve all of the problems was simply by creating a new environment conda create -n PyGenomeTracks and then installing pyGenomeTracks within that environment conda install -n PyGenomeTracks -c bioconda pygenometracks

In this way, there are no known conflict between hicexplorer with cairosvg and other modules that seemed to be incompatible.