I'm looking for an IDE that will allow me to edit remote Python projects and also has decent Django support, remote command execution, and maybe remote debugging. I've tried PyCharm and Aptana with PyDev but I'm not having much luck configuring them for remote editing. Thanks for your help!
I have Pycharm setup on a Ubuntu 10.10. The key is to use "sshfs" - it maps to my web-host - via ssh. Those are the pre-reqs : ssh access, sshfs. (unless you can figure out a way to map ssh to a windows shared drive).
So once ssh, sshfs are setup, I create a linux mount locally - so my webhost's directory appears locally as "/webhostx" .. From then on Pycharm (or WingIde or any editor) does not care that "/webhostx" is really a remote folder mounted locally.
If all else fails there's always Emacs (everything included :-) ).
Pycharm also has a remote debugging feature - I am in the process of testing it with my host (webfaction).
Emacs has tramp for remote editing on top of ssh, ftp or other protocols(works out of the box). nxhtml has support for editing Django templates (needs setup). I don't know about remote debugging. I've never done that.
Of course, Emacs is a lifestyle rather than an editor as most of its users will tell you so be warned.
Try WingIDE.
Related
Is it possible to remotely develop and debug Python code on another PC on the same network (both Windows 10)? If so, what is the best way to do this?
I tried mapping a network drive to the project folder on the remote PC. I could open the folder in vs code, but cannot get it to start my virtual environment on the remote machine to start debugging. When I do "Select Python Interpreter" and choose the appropriate venv on the remote machine it does nothing. The same process works fine if the venv is installed on the development machine.
I normally use WSL remote for C++ development and it works great but cant find any documentation for remote Windows development, just WSL, docker and SSH (maybe an option?)
Advice appreciated. Thanks in advance...
I want to do a python script that is able to copy log files from a remote windows 10 virtual machine to the script's machine (Windows) as well as deleting files. A developer in my work place uses WMI with C# to do these kind of stuff but I haven't been able to find anything for Python regarding this topic.
You can use SSH for that.
Paramiko is an awesome library that can run SSH in python: http://www.paramiko.org/
I am trying to set up a remote debugger with PyCharm on a Vagrant Machine.
I am following this PyCharm tutorial. However, the Add Remote option is not available for me. Just Add local and Create VirtualEnv.
Any idea why is this happening?
Just as a guess: are you using the free community edition of PyCharm? Unfortunately remote interpreters and remote debugging are only supported by the professional edition. You might take a look into the editions comparison on their website.
If you are using the pro version, we might have to dig a little deeper.
Not sure what host system you are using but if you don't mind a bit of delay, I was able to use Xforwarding over ssh and I pulled pycharm down from my remote system. (ssh -X) Pycharm detected it and gave a warning that it's updates are slowed but it worked.
I'm working on a project that is located in a remote server. Can I open it in PyCharm from my local machine ? I couldn't find the way.
The way I access the projects on my raspberry pi using PyCharm is the following (This expects you to be using PyCharm Pro, supporting SSH connections):
Mount the home folder on my local machine ( I use SFTP Drive on windows, under Linux use sshfs).
Open the project from the mounted drive in PyCharm
Go to Settings -> Project -> Project Interpreter and select the gear next to the Project Interpreter drop down. From there pick "Add Remote".
Configure the remote interpreter you want to use.
If the PyCharm project was already created on the server, I guess your run configuration should be in order and running it should work out of the box.
If you created the PyCharm project on your local machine:
If you have no run configuration yet, go to the file you want to run and do right-click -> Run yourfilename.py or simply hit Shift-F10
The remote interpreter will complain about non existent files. Go to the dropdown in the top right corner, click it and select 'Edit Configurations'
Change the script path and working directory to the actual remote directories. Remember, this is what your interpreter sees, and your interpreter is on your remote machine.
Hope this helps!
The following will configure PyCharm Professional 2021.3.1 on Windows 10 to run a project on a remote Linux server. It's likely the configuration will be similar for PyCharm on macOS.
Open PyCharm
Create a New Project and select Pure Python
Fill the Location and Remote project location, which may be new or existing.
Select the ellipsis next to Interpreter under Previously configured interpreter
Select SSH Interpreter and create New server connection
Supply your credentials
The default Interpreter will be /usr/bin/python, but an alternate location may be provided, for example /home/.../anaconda3/bin/python3.9
Create the project
Press Ctrl + Alt + S to open Settings
Select Deployment under Build, Execution, Deployment
Check Connection and Test Connection
Check Mappings to verify Local path and Deployment path
Select Python Interpreter under Project:...
Verify the remote interpreter is selected for the project.
As long as this is the case, the code will run relative to the remote system.
Close Settings with OK, or Apply
Use PUTTY or some other app to verify the project now exists on the remote system
Right click the project and select Deployment for deployment options
Note
This will likely require being connected to the corporate network through a VPN.
To update on excellent #Skusku answer given here:
https://stackoverflow.com/a/47614111/2119941
After mounting remote folder with SFTP Drive if Pycharm project browser doesn't recognize remote drive just copy-paste it in location bar on top and allow Pycharm to load it:
And when you load your project files to Pycharm you need to add remote interpreter which is present on your server:
In following screens just add host, credentials and than path to python in virtual env or whatever python is running your server project files.
Pycharm needs access to the project's directory.
You can open a remote project if the storage partition for that project directory is shared and mounted/mapped on your local machine with the right permissions by running pycharm on your machine and opening that locally visible project directory.
Note: you should not be opening the project in multiple such pycharm sessions simultaneously as they will collide/conflict with each-other.
Alternatively if you use a version control system (VCS) that supports remote repository access you can create a local copy of the project, work in that copy and push your changes to the remote project as needed (depending on your VCS specifics).
Search remote sync under plugins in pycharm. Many work. I think most common one is source sync.
In our company we using vagrant VM's to have the save env. for all. Is it possible to configure VisualStudio + PTVS (python tools for VS) to use vagrant based python interpreter via ssh for example?
There's no special support for remote interpreters in PTVS, like what PyCharm has. It's probably possible to hack something based on the existing constraints, but it would be some work...
To register an interpreter that can actually run, it would have to have a local (well, CreateProcess'able - so e.g. SMB shares are okay) binary that accepts the same command line options as python.exe. It might be possible to use ssh directly by adding the corresponding command line options to project settings. Otherwise, a proxy binary that just turns around and invokes the remote process would definitely work.
Running under debugger is much trickier. For that to work, the invoked Python binary would also have to be able to load the PTVS debugging bits (which is a bunch of .py files in PTVS install directory), and to connect to VS over TCP to establish a debugger connection. I don't see how this could be done without writing significant amounts of code to correctly proxy everything.
Attaching to a remotely running process using ptvsd, on the other hand, would be trivial.
For code editing experience, you'd need a local copy (or a share etc) of the standard library for that interpreter, so that it can be analyzed by the type inference engine.