faststructure distruct.py error
1
0
Entering edit mode
2.8 years ago
strive • 0
   I am trying to use distruct.py of FastStructure, but the following instructions keep appearing after many attempts, but I can't find the problem, could someone help me?()

It is my code: distruct.py -K 3 --input=date --output=distruct.svg

The result is:
Traceback (most recent call last):
  File "/opt/service/miniconda3/envs/faststructure_env/bin/distruct.py", line 166, in <module>
    figure = plot_admixture(admixture, population_indices, population_labels, title)
  File "/opt/service/miniconda3/envs/faststructure_env/bin/distruct.py", line 17, in plot_admixture
    figure = plot.figure(figsize=(5,3))
  File "/opt/service/miniconda3/envs/faststructure_env/lib/python2.7/site-packages/matplotlib/pyplot.py", line 533, in figure
    **kwargs)
  File "/opt/service/miniconda3/envs/faststructure_env/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 161, in new_figure_manager
    return cls.new_figure_manager_given_figure(num, fig)
  File "/opt/service/miniconda3/envs/faststructure_env/lib/python2.7/site-packages/matplotlib/backends/_backend_tk.py", line 1046, in new_figure_manager_given_figure
    window = Tk.Tk(className="matplotlib")
  File "/opt/service/miniconda3/envs/faststructure_env/lib/python2.7/lib-tk/Tkinter.py", line 1819, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
FastStructure distruct • 1.2k views
ADD COMMENT
0
Entering edit mode

no display name and no $DISPLAY environment variable

are you runnning this over SSH ? you need to connect using ssh -X remoteMachine command to use Xwindows.

ADD REPLY
0
Entering edit mode
2.8 years ago
Wayne ★ 2.1k

I think the issue isn't with distruct.py but with your matplotlib and that maybe you are trying to run this remote (or headless?)? (Are you able to get other plots working in matplotlib where you are running this?) I think others have posted about a similar issue here and here. The latter one says the workaround is to edit your copy of distruct.py file following this:

"To work around this, the following two lines should be included prior to import matplotlib.pyplot as plot:"

import matplotlib as mpl 
mpl.use('svg')

Zachary Kenneth Stewart posted a variation on this approach in 2018 in the very detailed post entitled Running fastStructure and associated difficulties.


Details of where you are running local vs. remote, personal machine, what type of machine, etc., are always best to include in such a technical post.


I'd also wonder if there are more modern software targeted at this use case?
This unmaintained project is written in Python 2 and hasn't been updated in roughly 8 years. (There was some move to update it to Python 3, see here and here; however, even those seem stalled for several years now.) Is this is no longer the preferred method in the field to do such analysis?
I note these:

If fastStructure is to remain the current way, the field should be updating the software as 2 years has now passed since the sunsetting of Python 2 on January 1, 2020. Most pertinent take away from the sunsetting notice: Python 2 is no longer supported.

ADD COMMENT

Login before adding your answer.

Traffic: 1954 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6