christophertbrown / iRep

scripts for estimating bacteria replication rates based on population genome copy number variation
MIT License
68 stars 9 forks source link

iRep/matplotlib crashes without X #3

Closed nr0cinu closed 7 years ago

nr0cinu commented 7 years ago

Hi!

I started using iRep, and when it runs with X forwarding activated, it works great on our servers. However, once there is no X display present, it allways crashes. The calculations are still saved, so its not a big problem. I’m also not sure if this is an iRep or matplotlib bug. We have matplotlib 1.5.2rc2 installed.

Thanks for this great tool! Best, Bela

iRep output:

:0: FutureWarning: IPython widgets are experimental and may change in the future.
# parsing mapping files
# calculating coverage over sliding windows
# calculating coverage slope and index of replication (iRep)
# saving results
# plotting data
Traceback (most recent call last):
  File "/apps/iRep-master/iRep-15112016/bin/iRep.py", line 1183, in <module>
    thresholds, args['no_gc_correction'], args['t'])
  File "/apps/iRep-master/iRep-15112016/bin/iRep.py", line 1003, in iRep
    plot_genomes(genomes, mappings, plot)
  File "/apps/iRep-master/iRep-15112016/bin/iRep.py", line 200, in plot_genomes
    r2, kept_windows, title)
  File "/apps/iRep-master/iRep-15112016/bin/iRep.py", line 156, in plot_coverage_hist
    fig, ax1 = plt.subplots()
  File "/usr/lib64/python3.5/site-packages/matplotlib/pyplot.py", line 1177, in subplots
    fig = figure(**fig_kw)
  File "/usr/lib64/python3.5/site-packages/matplotlib/pyplot.py", line 527, in figure
    **kwargs)
  File "/usr/lib64/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 84, in new_figure_manager
    return new_figure_manager_given_figure(num, figure)
  File "/usr/lib64/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 92, in new_figure_manager_given_figure
    window = Tk.Tk()
  File "/usr/lib64/python3.5/tkinter/__init__.py", line 1868, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display "localhost:10.0"
christophertbrown commented 7 years ago

Hi Bela,

I think this problem can be resolved by adding this BASH environment variable:

export MPLBACKEND="agg"

Let me know if you are still having trouble.

Best,

Chris

On Dec 5, 2016, at 6:11 AM, Bela Hausmann notifications@github.com wrote:

Hi!

I started using iRep, and when it runs with X forwarding activated, it works great on our servers. However, once there is no X display present, it allways crashes. The calculations are still saved, so its not a big problem. I’m also not sure if this is an iRep or matplotlib bug. We have matplotlib 1.5.2rc2 installed.

Thanks for this great tool! Best, Bela

iRep output:

:0: FutureWarning: IPython widgets are experimental and may change in the future.

parsing mapping files

calculating coverage over sliding windows

calculating coverage slope and index of replication (iRep)

saving results

plotting data

Traceback (most recent call last): File "/apps/iRep-master/iRep-15112016/bin/iRep.py", line 1183, in thresholds, args['no_gc_correction'], args['t']) File "/apps/iRep-master/iRep-15112016/bin/iRep.py", line 1003, in iRep plot_genomes(genomes, mappings, plot) File "/apps/iRep-master/iRep-15112016/bin/iRep.py", line 200, in plot_genomes r2, kept_windows, title) File "/apps/iRep-master/iRep-15112016/bin/iRep.py", line 156, in plot_coverage_hist fig, ax1 = plt.subplots() File "/usr/lib64/python3.5/site-packages/matplotlib/pyplot.py", line 1177, in subplots fig = figure(fig_kw) File "/usr/lib64/python3.5/site-packages/matplotlib/pyplot.py", line 527, in figure kwargs) File "/usr/lib64/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 84, in new_figure_manager return new_figure_manager_given_figure(num, figure) File "/usr/lib64/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 92, in new_figure_manager_given_figure window = Tk.Tk() File "/usr/lib64/python3.5/tkinter/init.py", line 1868, in init self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: couldn't connect to display "localhost:10.0"

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

nr0cinu commented 7 years ago

Excellent, that worked! Thanks!