Install PyCharm
Download the PyCharm Community version from [here](https://www.jetbrains.com/pycharm/download)
Work remotely with PyCharm, TensorFlow and SSH
echo 'export LD_LIBRARY_PATH=”$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"' >> ~/.bashrc
echo 'export CUDA_HOME=/usr/local/cuda' >> ~/.bashrc
source ~/.bashrc
Setup the Console
Open “Preferences > Build, Execution, Deployment > Console > Python console” and select the “Python interpreter” to be your remote one. Next click on the “Dotted button” and input the required environment variables that we added before to ~/.bashrc when we set up the server. Notice that we also added a value to the “DISPLAY” variable we found out earlier when connecting to the server with SSH:
Create a run configuration
Now go to “Run > Edit Configurations…” Click on the “Plus button” and create a new Python configuration. Name it and select the script to run:
Now enter the required environment variables as before. Tips: You can copy them all from the console settings we specified earlier, by using Ctrl+A and then the copy/paste buttons in the lower left corner. You access them by clicking the “Dotted button” just to the right of the “Environment variables” line.
Setting Up Cygwin/X (on Windowx)
The Cygwin/X User’s Guide thoroughly documents the installation process. Installation is performed through Cygwin’s setup program.
Start XWin Server and Configurations
-
Start XWin Server
-
Start XTerm
-
Configurations
$ DISPLAY=:0.0 $ ssh -Y username@remoteIP
Get matplotlib backend
$ python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.get_backend()
'TkAgg'
Test Codes
# import tensorflow as tf
#
# print (tf.__version__)
import numpy as np
from keras.datasets import mnist
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
# from keras.models import Sequential
# from keras.layers import Dense, Dropout, Activation, Flatten
#
# from keras.layers import Convolution2D, MaxPooling2D
# from keras.utils import np_utils
np.random.seed(123) # for reproducibility
# Load pre-shuffled MNIST data into train and test sets
(X_train, y_train), (X_test, y_test) = mnist.load_data()
print(X_train.shape)
# (60000, 28, 28)
plt.plot(X_train[0])
plt.show()