Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Python3 in Google Cloud Platform for a Node app

I'm using google cloud platform for my nodejs app. Problem, after deploying the app i have access to python2.7 but not to the version 3. This one seems to be missing in the usr/bin folder.

const spawn = require("child_process").spawn;
spawn('python'); // working
spawn('/usr/bin/python3'); // not working
spawn('python3'); // not working 

Error: spawn python3 ENOENT

I used fs module to display the usr/bin folder :

...
pygettext2.7
python
python2
python2.7
pyversions
...

Any idea how can I install python3 during the deployment of the app ? Maybe changing the app.yaml file ?

Thank you

like image 543
Julie Rankata Avatar asked Oct 29 '25 06:10

Julie Rankata


1 Answers

If you need a runtime that has both a specific version of Node.js and Python, you'd probably be better off using Cloud Run and specifying a custom image instead of trying to use one language inside another's runtime.

Flex would also possibly work here, but Cloud Run will likely be significantly cheaper, have faster startup times, and can scale to zero.

like image 160
Dustin Ingram Avatar answered Oct 30 '25 20:10

Dustin Ingram



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!