PyCharm: Difference between revisions
(Created page with "= 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 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
'''Copied From Berens Lab, Probably it's best to always update both.''' | |||
= configuring a remote python interpreter in pycharm. = | = configuring a remote python interpreter in pycharm. = | ||
Line 16: | Line 18: | ||
The line you interested in might look like: | The line you interested in might look like: | ||
<code> 9d4f24376537 | <code> 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 </code> | ||
Here 42368 is the number you are looking for. | Here 42368 is the number you are looking for. | ||
Line 28: | Line 30: | ||
2.1 Open PyCharm and log in with your JetBrains account to activate the license. | 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 "+". | 2.2 In PyCharm go to <code>Tools/Deployment/Configuration</code> and click "+". | ||
Enter any name. Choose SFTP. Enter "localhost" in host, the localhost portnumber in "port", your username (e.g. | 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. | Select Key Pair for authentification. Navigate to /.ssh and choose id_rsa. | ||
Line 35: | Line 37: | ||
=== 3. If your connection works, you still need to configure the interpreter. === | === 3. If your connection works, you still need to configure the interpreter. === | ||
3.1 File | Settings | Project | Python Interpreter --> Add interpreter | 3.1 <code>File | Settings | Project | Python Interpreter</code> --> <code>Add interpreter</code> | ||
3.2 Choose SSH Interpreter, click existing server configuration, choose your configuration from the dropdown menu, click next. | 3.2 Choose SSH Interpreter, click existing server configuration, choose your configuration from the dropdown menu, click next. | ||
Line 49: | Line 51: | ||
4.1 Go back to your connection under Tools/Deployment/Configuration and go to Mappings. | 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/ | Enter the paths of your home directory locally (e.g. "Z:/") and remotely (e.g. "/gpfs01/euler/user/inewton") |
Latest revision as of 12:15, 1 February 2022
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")