Sto provando a eseguire un codice molto semplice che emette un file .png in un cluster. Ecco il codice:
import matplotlib.pyplot as plt
import numpy as np
x = np.random.randn(60)
y = np.random.randn(60)
plt.scatter(x, y, s=20)
out_png = 'path/to/store/out_file.png'
plt.savefig(out_png, dpi=150)
Se corro questo codice con il comando python simple_code.py
nel mio sistema che ha matplotlib 1.2.1 installato ottengo l'avvertimento:
Unable to load library icui18n "Cannot load library icui18n:
L'immagine .png è ancora prodotto in modo Non ho problemi qui. Ma se io uso lo stesso comando e il codice in un cluster che ha matplotlib 1.3.0 installato non riesce con l'errore:
Traceback (most recent call last):
File "simple_code.py", line 33, in <module>
plt.scatter(x, y, s=20)
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 3078, in scatter
ax = gca()
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 803, in gca
ax = gcf().gca(**kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 450, in gcf
return figure()
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 423, in figure
**kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 79, in new_figure_manager
return new_figure_manager_given_figure(num, figure)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 87, in new_figure_manager_given_figure
window = Tk.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
Cosa sta succedendo qui?
Add, questo è lo script che uso per effettuare il login nel cluster:
#!/usr/bin/expect
set login "user"
set addr "address1"
set addr2 "address2"
set pw "password"
spawn ssh -X [email protected]$addr
expect "[email protected]$addr\'s password:"
send "$pw\r"
expect "[email protected]:"
send "ssh -X $addr2\r"
expect "[email protected]$addr\'s password:"
send "$pw\r"
interact
Stai facendo questo tramite 'ssh'? – SethMMorton
Sì, sono SethMMorton. Ho impostato il lavoro e l'ho eseguito nel cluster tramite 'ssh'. – Gabriel
Quando chiamate 'ssh', usate il flag' -X'? – SethMMorton