How to "Add Content Root" in Pycharm Pro for remote interpreter?

Viewed 179

Setup

I have some large project whose "Content Root" is configured like so (on Windows):

Windows.

I need to run that project on a remote (Ubuntu) server, which I configured using ssh interpreter like so:

Dragon

Using auto file transfer, configured like so (which works):

Mappings


The problem:

When attempting to use (the local) PyCharm to (remotely) run a file whose first line is

from Testing.TLI.run import run_db

I am getting an error:

sudo+ssh://epdadmin@192.168.80.81:22/home/epdadmin/noam/code/venv_noam/bin/python -u /home/epdadmin/noam/code/Kodex/Templates/Testing/TLI/run_pressure.py
Traceback (most recent call last):
  File "/home/epdadmin/noam/code/Kodex/Templates/Testing/TLI/run_pressure.py", line 1, in <module>
    from Testing.TLI.run import run_db
ModuleNotFoundError: No module named 'Testing.TLI'

Note that the same code runs OK on the local machine.

This path does exist on the remote as it can be accessed by terminal:

enter image description here


I suspect this has to do with the "Content Root" not being defined on the remote.

  • If this is the case, how to define the same content roots for the remote using PyCharm?
  • If this is not the problem, what is?

EDIT:

In the meanwhile, I found that what happens in Windows is Pycharm adds the paths in the "content roots" to the start of sys.path, thus allowing Python to see files and folders there.

I am not aware of how to make this happen easily on the remote, and will update when I get back to it.

0 Answers
Related