question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not find Python executable

See original GitHub issue

I just started using python so my apologies if the question sounds stupid.My web application is in php and i am calling gsutil from php using shell_exec.I am getting the following error

which: no python2 in ((null)) which: no python2.7 in ((null)) Traceback (most recent call last): File "/usr/local/bin/google-cloud-sdk/bin/bootstrapping/gsutil.py", line 75, in main() File "/usr/local/bin/google-cloud-sdk/bin/bootstrapping/gsutil.py", line 59, in main 'platform/gsutil', 'gsutil', *args) File "/usr/local/bin/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 45, in ExecutePythonTool execution_utils.ArgsForPythonTool(_FullPath(tool_dir, exec_name), *args)) File "/usr/local/bin/google-cloud-sdk/lib/googlecloudsdk/core/execution_utils.py", line 170, in ArgsForPythonTool python_executable = kwargs.get('python') or GetPythonExecutable() File "/usr/local/bin/google-cloud-sdk/lib/googlecloudsdk/core/execution_utils.py", line 59, in GetPythonExecutable raise ValueError('Could not find Python executable.') ValueError: Could not find Python executable.

My upload command is as follows

$upload_command = 'python="/usr/bin/python" /usr/local/bin/google-cloud-sdk/bin/gsutil -h "Cache-Control:max-age=31536000, public" cp ' . $tmp_path . ' gs://imgtest/'.$filename;

gcloud info

`Google Cloud SDK [138.0.0]

Platform: [Linux, x86_64] Python Version: [2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]] Python Location: [/usr/bin/python2] Site Packages: [Disabled]

Installation Root: [/usr/local/bin/google-cloud-sdk] Installed Components: core: [2016.12.09] core-nix: [2016.11.07] gcloud: [] gsutil-nix: [4.18] gsutil: [4.22] bq: [2.0.24] bq-nix: [2.0.24] System PATH: [/usr/local/bin/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin] Cloud SDK on PATH: [True] Kubectl on PATH: [False]

Installation Properties: [/usr/local/bin/google-cloud-sdk/properties] User Config Directory: [/root/.config/gcloud] Active Configuration Name: [default] Active Configuration Path: [/root/.config/gcloud/configurations/config_default] `

OS : Centos 7

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
hidekurocommented, Feb 1, 2017

@khavishbhundoo Try this workaround.

$upload_command="CLOUDSDK_PYTHON=/usr/bin/python YOUR_UPLOAD_COMMAND"

Other references: #236

3reactions
srikanth-mergucommented, Feb 1, 2018

I had same issue when executing gcloud commands.

which: no python2 in (/opt/google-cloud-sdk/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin)

I resolve this by adding symbolic link to “/usr/bin/python”

ln -s /usr/bin/python /usr/bin/python2

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm - "Can't find Python executable "python", you can set the ...
Try: Install all the required tools and configurations using Microsoft's windows-build-tools by running npm install -g windows-build-tools ...
Read more >
Windows can't find Python executable error [QUICK FIX]
How to fix Windows can't find Python executable error? This issue usually occurs if you don't have Windows Build Tools installed. To fix...
Read more >
Can't find Python executable "python" after installing · Issue #56
If you ever come across the above error on windows: Run CMD as Administrator: and run. npm --add-python-to-path='true' --debug install --global ...
Read more >
(Started 11/1/2021) Can't find Python executable "python", you ...
As of this morning, CircleCI is failing for me with this strange build error: Can't find Python executable "python", you can set the...
Read more >
Solution to "Can't find Python executable "python", you can set ...
I was just installing particle-cli on a new machine and got this error: Error: Can't find Python executable "python", you can set the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found