Advice for running Linux Virtual Machine on Windows - python

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

Related

Send command to MacBook Terminal from Pycharm installed on virtual Windows

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.

I need to run a specific python module which only works on a Linux device but I have a Windows laptop. What's my best option?

At university I have been working on Linux machines writing various Python scripts. A specific python module (PyEphem) that I have been running all term only works on Linux devices but I'm home for the holidays and need to run my code. Unfortunately I only have access to a 64-bit Windows laptop.
What's the best quick fix to be able to run Linux? I've been reading about downloading a virtual machine or using a duel boot OS on my laptop or running Linux straight from a USB / SD card?
What's my best option?
If your programs don't require a large amount of processing power, I'd go with a bootable copy of Linux on a USB stick. Note that unless you make the memory persistent (see link) then every time you boot the usb it will start without any of your programs installed and you would have to install them again.
In my experience, getting your computer to dual-boot just so you can work on Linux for a few weeks is not a good idea because once you partition the hard drive and do you work, the computer stays partitioned unless you go through the work of undoing the partition which is a pain.
Try reading this: https://www.howtogeek.com/howto/14912/create-a-persistent-bootable-ubuntu-usb-flash-drive/
There is multiple way to get around without dual boot and VM just install cygwin
from wiki
Cygwin is a Unix-like environment and command-line interface for
Microsoft Windows. Cygwin provides native integration of Windows-based
applications, data, and other system resources with applications,
software tools, and data of the Unix-like environment.
another one
Gow (Gnu On Windows)
and lite one
MSYS

How to read the list of Virtual Machines in the VmWare Workstation 12 Library?

I'm trying to find all the virtual machines installed in a machine. Generally all the VM's list is available in the library of the VmWare (side panel) in the application.
Is there anyway i can get the list of all the available vm's irrespective of running or not, outside of the application to run in python script.
I know I can get the running Machines using vmrun list command.
Kindly correct me if I am wrong or going in the wrong direction.
Preferences.ini file has all the detils of machines i am looking for
C:/Program Files/VMware/preferences.ini
The VMware Workstation Virtual Machines List (Library Panel) is in the file "inventory.vmls":
C:\Users\YourUser\AppData\Roaming\VMware

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.

Open URL command from Linux to Windows in Python

I have a Linux PC (running Ubuntu) and a Windows 7 PC, and they are connected to the same network.
I want to write a script in Python from the Linux PC that "tells" the Windows PC to open a specific URL.
I know the command in windows is e.g. "start www.google.com", so I think I have to somehow send this command from the Linux to the Windows PC using a Python script.
Thanks in advance for any suggestions!
Well, how the PC's connected, LAN, WAN, Bluetooth? I assume they use a LAN. In this case you can use a socket library to send data from one PC to another.
The Linux will be a client and Win7 will be a server, check this link for example: Server/Client implementation

Categories