Send command to MacBook Terminal from Pycharm installed on virtual Windows - python

Background:
Through VMWare Fusion installed on my MacBook, I have Windows installed virtually in the VMWare Fusion environment. On the Windows, I have Pycharm IDE through which I run automated python program to control bench instruments from Keysight and Techroniks. No issues.
PS- The instrument drivers are available only for Windows, thats the reason I am using Windows virtually on MacBook
Question:
From Pycharm (installed on virtual Windows), I would like to send any command (say, print Hello World) to the Terminal of the MacBook.
How to do this and what would be the command syntax (or package needed)?

There is no single package to do this.
At a minimum, your Mac host would need to run a server process. Then the VM would need to be on a host network bridge such that it is remotely addressable. Then, you can write a client that sends RPC requests to the host's server process.
At a low-level, you can use socket library, but you may want something higher level like httpserver.
Related - VMWare fusion: connecting to host's web server from guest
The other option without external dependencies would be to communicate over a file-system share.
If you want to install external software, then you can introduce a remote message queue or database.

Related

Can I install Python, Django and other packages on a USB device and and run a server from this USB?

I would like to have a Django server on a Windows machine which is not connected to Internet.
For that, would it be possible to install, from another Windows machine connected to Internet, Python, PyCharm, Django and other packages to a USB device that I will then connect to the other Windows machine in order to start the application ?
Would it work without problems ?
Thanks !
-

Access Jupyter notebook/lab running on a remote windows VM?

I want to access Jupyter lab interface on my local machine browser (also running on windows) from a Jupyter server running on a remote Windows VM.
Is there any analogous technique to SSH tunneling in linux but for windows?
Thanks in advance!
EDIT:
I am not looking for remote desktop since the code autocomplete doesn't work and it's really unresponsive (and I think people can relate to other problems of coding on a remote desktop platform)
Remote Desktop would be the easiest option.
If you need a browser, windows has ssh built in, but I think it has to be activated in the Windows options

Python on Windows, connect to linux/unix server to process

I work in an environment such that I have python installed on my laptop (windows 10). I also have access to a couple of Linux servers. I work with some very large datasets, some which would be too large for my machine's memory to handle.
My question, which I so far haven't found an answer to, is if it's possible to connect to the linux server and run the code from my windows PC. I want to take advantage of the processing and memory on the linux server, but don't want to log on to server and do all of my development there and execute the scripts on the linux environment.
As an aside, another person in my department has been asking if it's possible to do this from Jupyter Notebook or an IDE like Spyder?
For jupyter you could just run the Jupyter notebook on the server and connect to the server IP and edit the notebook locally.
Of course you'd have to save your local notebooks and import them on the server but that should be pretty straight forward.
You can see how to set up a public Jupyter instance on a server here:
https://jupyter-notebook.readthedocs.io/en/stable/public_server.html

Advice for running Linux Virtual Machine on Windows

I have a python application that I am currently operating in Windows (because I need to be able to send TCP commands to a 3rd party Windows application which is running on the same machine). However, I want to be able to use libgphoto2, which generally only runs on Linux machines. Is it possible to set up a virtual machine and run everything from a single computer? My Python scripts can currently be run from either Linux or Windows. An easy way to do this would be to have one computer with Windows which I control over TCP from a secondary computer running Linux...but this means that I will need 2 computers.
Any advice?
Light solutions, just a Linux compatibility layer:
latest Windows has native Linux support
for older Windows versions, cygwin
or mingw
If it doesn't work, you can resort to a real virtualization, e.g. VirtualBox.
Try VM Player.
Where you can setup linux over windows and communicate between virtual linux and windows host.
VM Player

Python plotting on remote server using PyCharm

I have started to learn Python and so far my setup has been following - Python 3.5 installation on Win10 64bit local machine with PyCharm as a great IDE. Everything works, matplotlib charts and other visual outputs display fine, debugging works, etc.
Now, I have came across some libraries which works only on Linux. I have set up Ubuntu 16.4 64bit VPS on Digital Ocean, installed Python 3.5. In PyCharm I have set up SFTP connection to remote host. Code running works, debugging works, however, I am not able to bring display output (matplotlib plots,...) to local (Win10) machine. As I am not at all familiar with Linux GUI environments (X11?), after googling I have following questions:
1) Should anything be installed on remote Linux machine? (e.g. x11 client/server/smth?)
2) Should anything be installed on local Win machine? (e.g. Xming?)
3) Should anything be configured on remote Linx machine? (e.g. X11 forwarding)
4) Should anything be configured on local Win machine PyCharm?
5) There are X11 forwarding settings in Putty and some have suggested to use those but I am not sure, should Putty session run in paraller with PyCharm and can that be avoided.
Thanks a lot!
PS - I have installed Jupyter Notebook (and latest Jupyter Lab) on remote machine and it works excellent, however I am still prefering PyCharm as primary IDE with better code completion, debugger and other perks.
Ok, after some more googling I finally managed to get this process working, hope it helps somebody:
1) on remote host (VPS, Ubuntu 16.04) I had to install X11 server, which I did by:
sudo apt-get install xorg
sudo apt-get install openbox
2) On remote host I had to make sure that X11Forwarding is enabled in /etc/ssh/sshd_config
3) On local Win10 machine I had to install Xming server and launch it with default settings.
4) On local Win10 machine I had to configure Putty to use X11 forwarding (Connection-> SSH -> X11 Forwarding) with default settings and keep connection open while running PyCharm (it seems there is no option in PyCharm to enable x11 forwarding, so putty must be running in the background)
5) On remote machine I had to check Display number (echo $DISPLAY) - this can be different for everyone. For me it was localhost:10.0
6) In PyCharm Run configuration -> Environment variables I had to add DISPLAY=localhost:10.0
After all these steps and Putty+Xming running in backgroud, I was able to execute remote code and bring graphic back to my Windows 10 PC!
PS - process is actually slow, I have to wait around 10 seconds before image is brought back to me. I am not sure why or how to speed it up. Might be another question. (reducing chipher strength and enabling compression does not help. It seems some sort of initialization problem with x11 remote and local)
Mac user should install XQuartz instead of Xming.
And another important thing: if you install xquartz via homebrew, you should relogin your macos or reboot.
As the rackpas's answer saying.

Categories