Connect Python IDE to Google Cloud - python

Is there a way for me to work on the environment like Python IDE (such as Spyder) while leveraging the power of GPU in a compute engine? Google has data lab but that is a Jupyter Notebook environment, which is not ideal for code development. I would like to be in an environment where I can debug easily and have a good variable explorer. I would appreciate it if anyone knows a solution to this. Thank you!

With Visual Studio Code you can get a set up similar as you say: with the SSH Remote extension, you can connect VS Code from your PC to a GCP VM and run the workload powered by it. VS Code works in this set up as almost an IDE (actually it is a code editor).
Download and install VS Code (https://code.visualstudio.com/download). Install the SSH Remote extension (https://code.visualstudio.com/docs/remote/ssh). Install Google SDK and log in your GCP account
gcloud init can be enough). Then on the Power Shell or CMD or Google Cloud SDK run: gcloud compute shh-config, and all the started VMs will appear listed and ready to connect through SSH Remote extension.
If you have not a lot of firewall rules closed and security issues.
Hope it works it out.

There is a public documentation describing the steps to set a remote desktop on a Compute Engine instance
You can also manually use the GUI of a ubuntu VM or use the Remote Desktop that comes by default with the Windows Server desktop experience images to install your IDE

You could also try https://cloud.google.com/blog/products/application-development/introducing-cloud-shell-editor, Cloud Shell Editor, an IDE with many GCP tools built-in running on a pre-provisioned cloud instance.
Direct link is http://ide.cloud.google.com/ - make sure you have Google Cloud account.

Related

Azure Text to Speech Error: 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND) when deploying to Azure App Services Linux environment

I adapted the quick start code Python version here for Azure text to speech.
The app runs correctly on my local server. However, when I deploy the app through Visual Studio Code to Azure App Services, I got the error: 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND).
I found that this error is the same as the posts here and here. The reason seems to be that the Python interpreter used was from Microsoft Store instead of from Python.org. The solution, therefore, seems to be switching from the Microsoft Store version of Python to the Python.org version of python.
However, the solution above seems only work for those apps that run on a local or remote server. Since I am deploying my app to Azure App Services, and the deployment builds everything remote using oryx, I don't know how to switch from Microsoft Store version Python to the Python.org version python remotely.
I tried to change the Azure App Services Python version using Powershell, following the instruction from this post, but I was only able to change it from the current version of Python 3.9 to Python 3.8. When trying to change to version 3.10, I got an error message saying Python 3.10 is not supported.
After changing to Python 3.8, a new error was given:
ModuleNotFoundError at /
No module named '_speech_py_impl'
Thanks to #RajkumarMamidiChettu-MT for the instruction in the answer below. I think the solution is at the right direction. However, I got stuck at Step 3: My Azure app resource group is Linux (this seems to be default for Python apps and I can't change it). Therefore my kudu site does not have the UI of Debug Console and I cannot drag and drop my local Python package to the server. I do see that I have SSH and BASH interface. However, I don't know how and where to upload the package with either SSH or Bash.
Hopefully, someone can point me to the right direction. I feel I am getting so close.
For what it's worth, I found the Azure Text to Speech Error: 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND) error in my situation is because the deployment process was looking for the Linux version of Azure-Congnitiveservices-speech library, which ends with .so. However, for whatever reason, those .so library files were not generated when deploying my app to the Azure Linux environment. And the method mentioned in another post Azure Speech to text 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND) of manually pasting .dll (library files in windows) files to the execution path didn't work, because the web app environment is Linux, which is the default environment by Azure App Services for the Python web app. And there is no way to change the web app environment from Linux to Windows if using Azure's preconfigured web app environment to deploy a python app.
I was not able to figure out how to generate .so files for the Azure-Congnitiveservices-Speech pack with the default Linux environment. So I end up creating a custom Docker Windows Server container with Python 3.10, WindowsServer2019 (python:3.10.4-windowsservercore-1809 2022 is not supported at the time of this post), and then deploying it to Azure App Services with the customer docker container. It is working now.

Do I need a SFTP if I use an online IDE?

I've only been using Filezilla over the past few years to upload simple landing page templates to my hosting company. I've now created a new Django project on Google Cloud Platform that comes with pre-installed LAMP (P for python) Package, so far neither a Cpanel nor FTP credentials have been mentioned anywhere, only SSH, which confused me very much.
But, I quickly figured that I would need an IDE to start building a web application.There are many options including local IDEs (Vcode, Pycharm, Eclipse) and Cloud IDEs (Replit, Cloud9). I decided to go with C9 as it offers a GCP integration and it's free.
AWS Cloud9, a cloud-based IDE lets you write, run, and debug your code with just a browser, you don’t need to install files or configure any development machine to start new projects.
So, is there any reason to use a SFTP to transfer or upload files?
As default Linux VM instances from Google Cloud Cloud Platform has OpenSSH installed so you could use SCP or SFTP to transfer files here is the documentation to learn how to transfer files to the VM Instances, Unless your online IDE has the ssh-keys authentication with SFTP to transfer files like this online editor, you will require a SFTP client to copy files.

Is it possible to deploy Python AWS Lambda on Windows?

I have a Python AWS Lambda running on a Linux, but due to some dependencies, I need it to be deployed on a Windows. I have tried using Python Azure Functions and have successfully deployed it on a Linux as well, but found out they cannot be deployed on Windows. Is it possible to do it with AWS Lambda?
Basically my solution has a few .exe that need to be run by a python library (Tesseract OCR and pytesseract)
AWS Lambda and Azure Functions are considered Function as a Service (FaaS) solutions, where the developer worries about the code and the cloud provider worries about availability, scalability and the platform underneath to run the code.
In that aspect, you can't run any of them on a server. If you need specific Windows dependencies, you must create a Python project as you normally would, install the dependencies and configure the Windows Server, being responsible for infrastructure and OS configurations and management.

Run custom script when deployed Azure vm boots

I'm using Azure Python SDK to deploy a Linux Vm in the Cloud. This Vm has a public IP and ssh enabled. I need to have this Vm running a custom script immediately after it boots . This script would install pip, python, docker etc and start a docker container.
How could I pass this script when deploying the vm ? / How could I instruct the vm to run this script after it has started ?
Cheers,
Steve
According to your scenario, you could use Azure Custom Script Extension.
The Custom Script Extension downloads and executes scripts on Azure
virtual machines. This extension is useful for post deployment
configuration, software installation, or any other configuration /
management task. Scripts can be downloaded from Azure storage or other
accessible internet location, or provided to the extension run time.
If you want to use python to do this, please refer to this python sdk documentation.
Please refer to the similar question.

python cloud app on windows azure

Hello i am an absolute beginner on cloud computing and on python. I would like to start develope a password manager app to Azure using Python. Please can you advice me some tools to start with my project? (which Apps - frameworks to use)
Python apps, in general, run in Windows Azure as they would run anywhere else, as they'd be running in Web or Worker roles (which are basically Windows Server 2008 R2 or SP2 VMs) or Virtual Machines (which are Windows Server or Linux images you manage). You just need to provide the python sdk and supporting libraries for your app.
Having said that: Windows Azure has a python sdk to interact with Windows Azure's services (today this covers Service Bus and Storage, a subset of Windows Azure services). When installing the Windows Azure sdk, you'll also get python 2.7 installed. You can get the installer in the python Develop portal for python, here. In this portal, you'll also find a few tutorials for working with python in Windows Azure.
If you want to see the source of the Windows Azure SDK for Python, it's available on github, here.

Categories

Resources