1
votes

I have make Tensorflow model using Python3.5.5. I want to deploy it on the Google Cloud Platform. But since Google Cloud Platform support python 3.6 and Python 3.7, I am not able to make out how to do it. And If possible please guide me how to access Google Cloud Storage Bucket data in my tensorflow model.

Thanks in Advance.

1

1 Answers

1
votes

You can either search in here if there is an image with that specific Python version or you can pick any Linux distribution image and install that specific Python version in it.

For the latter case here’s a working example:

ZONE=us-central1-a
INSTANCE_ID=my-vm-00

gcloud compute instances create $INSTANCE_ID --machine-type n1-standard-1 --image-project debian-cloud --image debian-9-stretch-v20190326 --metadata startup-script="sudo apt update && sudo apt install gcc make -y && wget https://www.python.org/ftp/python/3.5.5/Python-3.5.5.tgz && tar xvf Python-3.5.5.tgz && cd Python-3.5.5 && sudo ./configure --enable-optimizations && sudo make altinstall" --subnet default --zone $ZONE

Check Google Cloud SDK for more background on the command used above.

With the following command you can check which Python 3.5.x are available (you have to some seconds after the last command returns though).

gcloud compute ssh $INSTANCE_ID --command 'for pythonv in python3 python3.5; do type $pythonv; $pythonv --version; done' --zone $ZONE

Just remember to use the python3.5 executable when you need Python 3.5.3.

To deploy your code, you can use the following command:

gcloud compute scp --recurse my_code_local/ $INSTANCE_ID:~ --zone $ZONE

Or research a solution along the lines of Cloud Build.

To upload or download data to or from a Google Cloud Storage Bucket from your Python application, you just need to use Cloud Storage Client Libraries.

Along with links for examples with download and upload operations with it.