PyCharm

From AG Euler Wiki
Jump to navigation Jump to search

Copied From Berens Lab, Probably it's best to always update both.

configuring a remote python interpreter in pycharm.

1. Installing PyCharm

1.1 Download PyCharm - Professional edition https://www.jetbrains.com/de-de/pycharm/

1.2. Create a JetBrains account at the same website.

1.3 Apply for education license. https://www.jetbrains.com/community/education/ Confirm (again) that you agree with the terms and conditions otherwise the next step on the website.

2. Connecting PyCharm

2.1 Create a tunnel for PyCharm. Do this by connecting to a node with "ssh". Find the port of your container you want to connect to with "docker ps". The line you interested in might look like:

9d4f24376537 eulerlab/datajoint "/usr/local/bin/entr…" 5 months ago Up 21 hours 0.0.0.0:42368->22/tcp, 0.0.0.0:1610->8888/tcp nameOfContainer

Here 42368 is the number you are looking for.

Now create a tunnel, e.g. with:

ssh inewton@172.25.250.112 -p 60222 -L 1610:172.29.0.61:1610 -L 9393:172.29.0.61:42368

This creates two tunnels: One for the Jupyter Notebook (localhost:1610) and one for PyCharm (localhost:9393)

2.1 Open PyCharm and log in with your JetBrains account to activate the license.

2.2 In PyCharm go to Tools/Deployment/Configuration and click "+". Enter any name. Choose SFTP. Enter "localhost" in host, the localhost portnumber in "port", your username (e.g. inewton) in "username". Select Key Pair for authentification. Navigate to /.ssh and choose id_rsa.

If the key doesn't exist: Go onto the computing node and type ssh-keygen. Click test connection. If it works, click ok.

3. If your connection works, you still need to configure the interpreter.

3.1 File | Settings | Project | Python Interpreter --> Add interpreter

3.2 Choose SSH Interpreter, click existing server configuration, choose your configuration from the dropdown menu, click next. If you can't click next you might have to chosen one of the two options stated (copy or move).

3.3 In the field Interpreter, click the folder symbol and navigate to the python interpreter on the server

3.4 Unclick the box "automatically upload…"

3.5 Click finish

4. Create mapping.

4.1 Go back to your connection under Tools/Deployment/Configuration and go to Mappings. Enter the paths of your home directory locally (e.g. "Z:/") and remotely (e.g. "/gpfs01/euler/user/inewton")