VainF / Neural-Style-Transfer-Gatys

A Tensorflow implementation of Neural Style Transfer
8 stars 2 forks source link

Running on Ubuntu 18.04 in virtual environment #1

Closed sbetzin closed 6 years ago

sbetzin commented 6 years ago

Hi, i try to run your script on an azure gpu Machine. On this Machine i am using a docker Image (Ubuntu 18.04) with python 3.6 When I am starting the script I receive root@efd02e5c0ceb:/app/Neural-Style-Transfer-Gatys# python3 transfer_gatys_tf.py --content_img content_img.jpg --style_img style_img.jpg --lr_rate 1 --epoch 3000 Traceback (most recent call last): File "transfer_gatys_tf.py", line 183, in main() File "transfer_gatys_tf.py", line 89, in main plt.title('Content Image') File "/usr/local/lib/python3.6/dist-packages/matplotlib/pyplot.py", line 1427, in title return gca().set_title(s, *args, kwargs) File "/usr/local/lib/python3.6/dist-packages/matplotlib/pyplot.py", line 984, in gca return gcf().gca(kwargs) File "/usr/local/lib/python3.6/dist-packages/matplotlib/pyplot.py", line 601, in gcf return figure() File "/usr/local/lib/python3.6/dist-packages/matplotlib/pyplot.py", line 548, in figure **kwargs) File "/usr/local/lib/python3.6/dist-packages/matplotlib/backend_bases.py", line 161, in new_figure_manager return cls.new_figure_manager_given_figure(num, fig) File "/usr/local/lib/python3.6/dist-packages/matplotlib/backends/_backend_tk.py", line 1044, in new_figure_manager_given_figure window = Tk.Tk(className="matplotlib") File "/usr/lib/python3.6/tkinter/init.py", line 2020, in init self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: no display name and no $DISPLAY environment variable

Any ideas?

VainF commented 6 years ago

This problem is caused by the python package matplotlib. It tries to display images but your ssh client does not support X11 forwarding. You can comment or delete those lines with 'plt' (line 85~91). However, If you want to run the code and view the pictures directly through ssh, try Xming+Putty on windows and XQartz on macOS.

I hope these will help you.