Run on remote interpreter

Answered

Hi, 

I configured my project to use remote ssh python interpreter and further defined deployment to the remote server with an automatic upload. The automatic upload works fine and upload the project files whenever I change them. 

However, regarding the remote interpreter, when I try to run a python script, I'm getting an error:

ssh://ubuntu@exp:22/home/ubuntu/anaconda3/bin/python -u /path/in/local/machine/script.py
bash: line 0: cd: /path/in/local/machine: No such file or directory
/home/ubuntu/anaconda3/bin/python: can't open file '/path/in/local/machine/script.py': [Errno 2] No such file or directory

Basically, it attempts to run the code on the remote machine, but using path from local machine - which of course fails. 
I can manually modify the run configuration, and then run succeeds. But every time I re-run the script using the green run button on the script itself (i.e., not the one at the top close to the run configuration, but rather near the if __name__ == '__main__' part of code'), then PyCharm re-create a faulty run configuration where path is to the local machine .

I also have another project (on the same machine, using same remote interpreter), that seems to work perfectly ok and runs anything on a Python Console. However, I was not able to understand what is the difference between the projects. 

 

Thanks

 

System info below. 

PyCharm 2019.3.1 (Professional Edition)
Build #PY-193.5662.61, built on December 18, 2019
Licensed to Amazon Corporate, LLC

Runtime version: 11.0.5+10-b520.17 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.6
GC: ParNew, ConcurrentMarkSweep
Memory: 2014M
Cores: 4
Registry:
Non-Bundled Plugins: BashSupport

0
2 comments

Hello,

Have you checked that Path mappings of your interpreter (Preferences | Project | Project Interpreter) match the mappings of the deployment configuration?

1
Avatar
Permanently deleted user

Sergey Karpov: that was indeed the problem, thanks!

0

Please sign in to leave a comment.