Google Cloud SDk: Python was not found - python

After I install Google cloud sdk in my computer, I open the terminal and type "gcloud --version" but it says "python was not found"
note:
I unchecked the box saying "Install python bundle" when I install Google cloud sdk because I already have python 3.10.2 installed.
so, how do fix this?
Thanks in advance.

As mentioned in the document:
Cloud SDK requires Python; supported versions are Python 3 (preferred,
3.5 to 3.8) and Python 2 (2.7.9 or later). By default, the Windows version of Cloud SDK comes bundled with Python 3 and Python 2. To use
Cloud SDK, your operating system must be able to run a supported
version of Python.
As suggested by #John Hanley the CLI cannot find Python which is already installed. Try reinstalling the CLI selecting install Python bundle. If you are still facing the issue another workaround can be to try with Python version 2.x.x .
You can follow the below steps :
1.Uninstall all Python version 3 and above.
2.Install Python version -2.x.x (I have installed - 2.7.17)
3.Create environment variable - CLOUDSDK_PYTHON and provide value as C:\Python27\python.exe
4.Run GoogleCloudSDKInstaller.exe again.

On ubuntu Linux, you can define this variable in the .bashrc file:
export CLOUDSDK_PYTHON=/usr/bin/python3

On Windows, setting the CLOUDSDK_PYTHON environment variable fixes this, but when I first tried this I pointed the variable to the folder containing the python executable and that didn't work. The variable apparently must point to the executable file.

Related

How can I get neovim on windows to recognize python?

I think I'm not supposed to ask questions in other questions. This didn't answer my question Neovim on Windows can't find python provider
When I start neovim it says no python provider found. Run ":checkhealth provider".
checkhealth provider shows it found python 3 and that latest pynvim is installed. it also shows that python 2 is disabled (I set g:loaded_python_provider=0). I've also made a symbolic link to python.exe called python3.exe.
How can I get past this point?
You need to install a package that tell neovim how to use python. On arch Linux I had to install a package called python-neovim-git.
From what I've seen on windows, you probably need to install pynvim.

0x80070643 error while installing Python 3.6

I'm actually using Python for an audio steganography project but I have some troubles.
I searched this error code on the forum, but I found things about SQL installations and not Python.
I'm trying to re-install Python 3.6.5 after an uninstall, because of a bug with pip.
I installed Python 2.7, Python 3.6.5, Python with VS 2017, before uninstall it because it wasn't working.
However, when I'm runing the installer as an administrator, hit "customize installation", tick everything excpet "balblalblabal (this requires VS 2015 or later)", and click on "install", it tells me that :
.
I realy need Python to work and I'm now stuck ...
If anybody here could help me, it would be nice !
Thanks all,
maleik.
PS : I have the log for you :*
The log link
I found this in the log file which you have attached. Try cleaning the registry with CC cleaner and give it a try. If it still doesn't work, try installing python with web installer Python Web Installed 3.6.5.
[3DA0:2968][2018-12-05T20:46:18]e000: Error 0x80070643: Failed to install MSI package.
[3DA0:2968][2018-12-05T20:46:18]e000: Error 0x80070643: Failed to execute MSI package.
[2610:03A4][2018-12-05T20:46:18]e000: Error 0x80070643: Failed to configure per-machine MSI package.
[2610:03A4][2018-12-05T20:46:18]i319: Applied execute package: core_AllUsers, result: 0x80070643, restart: None
[2610:03A4][2018-12-05T20:46:18]e000: Error 0x80070643: Failed to execute MSI package
I installed python from Microsoft store after facing this problem and it magically got installed without any error as it may have directly been installed. I don't know but try if it eorks for you too.
You need to run the installation as a local administrator.
I had the same problem installing Python version 3.9 for the first time on my Windows 10, as this same problem happens to many users trying to install Python, the best solution I accidentally, just like #MANAN AGGARWAL discovered trying to check if I already had a version of Python installed on my computer by the DOS Command Prompt, was:
Open the DOS Command Prompt (cmd) and dictate "python": if a screen shows you a version, it's clearly not the first time you've installed Python, so if you want to upgrade you should try: https: / /www.delftstack.com/en/howto/python/how-to-update-python/ But if you've never installed any version of Python, the solution lies in updating your operating system to the latest version through Windows Update, and open the command prompt and type Python, or go directly to the Microsoft Store and search for Python followed by its latest version. It works without error.
** If by chance it does not automatically install on your PC after downloading, click "install on my devices" and select your computer name.
Why can't I install Python directly from the website file? Please note that when trying to install any software/applications from outside Microsoft's trusted locations, there are high chances of user settings interfering with the installation. When coming, for example, from the Microsoft Store, a chance of success is much greater, even without having problems related to User Permission Settings.
Another important thing to point out here is that installing a lot of software from outside Microsoft's trusted platforms can cause you to change some user permissions which can have positive effects with some software and negative effects with others, even with security your own system if you don't know what you're doing.
it's simple , Try Lower Version Like 'Python 3.6' but Download web install.
install it , then install last python version.
your python will update.
I've faced same/similar problem with installing Python 3.9.12 in a clean Windows 8.1 64-bit (VirtualBoxed test environment).
I thought the issue could have been fixed in a newer version of Python, but the freshest 3.10.10 fails with same issue.
The original log isn't available any longer, but luckily it is quoted in another answer, and the following line reveals the real problem:
Applied execute package: core_AllUsers, result: 0x80070643, restart: None
My log looks the same, and if you scroll the log up, you'll discover that core_AllUsers is a UCRT MSI-installer, which is downloaded from Python site (for 3.10.10 64-bit the link may look like https://www.python.org/ftp/python/3.10.10/amd64/ucrt.msi).
If you download it manually (Python installer is smart enough to do a cleanup even if it fails, so you won't find this MSI in a local cache) and run, it will probably crash. And if it is your case, I have a simple solution - just install update KB2999226 (Update for Universal C Runtime) for your OS, which you can download from Microsoft.
I also faced the similar issue. What the trick worked for me is I installed it for the individual user (as earlier installation was for the all users).
So earlier if one has installed it for the all users then install it for the specific user and vice versa.
I know this is not the resolution of the error faced. However, this approach will install Python which is the main motive to achieve.
I encountered the same issue after installing a fresh Windows 8.1 on my PC.
I solved that by using the Python v3.9 web installation file which you can find here.
However, you can choose any other version that has a web installation file
Note: You need internet connection to use this method.

Is there any way to use gcloud with python3?

I have a little confused about gcloud with python3
After I installed gcloud in python3 env and I tried to example Quickstart for Python in the App Engine Flexible Environment.
It said 'You need Google Cloud SDK', so I installed SDK. All the process after SDK(including SDK), It needs python2 env.
Here is a question, Is is impossible to run gcloud with python3 (officially ) yet? (SDK and python2 with gcloud library is best way?)
I worked around this issue by specifying the path to Python 2 (that I named python2 on my system).
$ export CLOUDSDK_PYTHON=$(which python2)
$ ./install.sh
I suggest adding the export to your .bashrc or .zshrc file.
As of 2019-12-17, version 274.0.0 officially supports Python 3. Release notes:
Cloud SDK now has GA support for Python 3. Please run gcloud topic
startup for:
Information on configuring the Python interpreter used by the Cloud SDK.
List of tools in the Cloud SDK that still require a Python 2.7 interpreter.
List of known issues with Python 3 support.
(That command shows that dev_appserver and endpointscfg are the exceptions.)
According to the search order, gcloud will still use Python 2 if it finds it. You can be explicit by setting CLOUDSDK_PYTHON=python3 (or similar) as an environment variable.
gcloud-python and gcloud-cli as in Cloud SDK are somewhat unrelated products. It is true that you need python 2.7.x to run gcloud-cli, but that does no preclude you from using python3 with gcloud-python library.
If you install multiple versions of python 2.7x and 3.5 for example (you can even make python3 default) as long as you set CLOUDSDK_PYTHON environment variable to point to python 2.7.x interpreter you should be able to run gcloud-cli while using python3 for your project.
On Windows for example, Cloud SDK packages its own python which does not conflict with any other version you might have on your system. It is pure runtime dependency for gcloud-cli.
Inside the install.sh, it says python3 is supported but not prioritised because python 2 is, I think, more ubiquitous. It means if you are running macOS, add a line of environment variable by echo "export CLOUDSDK_PYTHON=/your/path/to/python3" >> ~/.bash_profile will allow gcloud to use whichever python3 is located.
If it doesn't work, then point it to whichever python 2 and only use python 3 for your own work should solve the problem.
# if CLOUDSDK_PYTHON is empty
if [ -z "$CLOUDSDK_PYTHON" ]; then
# if python2 exists then plain python may point to a version != 2
if _cloudsdk_which python2 >/dev/null; then
CLOUDSDK_PYTHON=python2
elif _cloudsdk_which python2.7 >/dev/null; then
# this is what some OS X versions call their built-in Python
CLOUDSDK_PYTHON=python2.7
elif _cloudsdk_which python >/dev/null; then
# Use unversioned python if it exists.
CLOUDSDK_PYTHON=python
elif _cloudsdk_which python3 >/dev/null; then
# We support python3, but only want to default to it if nothing else is
# found.
CLOUDSDK_PYTHON=python3
else
# This won't work because it wasn't found above, but at this point this
# is our best guess for the error message.
CLOUDSDK_PYTHON=python
fi
fi
The system requirement explicitly said python 2.7.x https://cloud.google.com/sdk/downloads
why do you want to run gcloud with python3 anyway?

ImportError: No module named 'resource'

I am using python 3.5 and I am doing Algorithms specialization courses on Coursera. Professor teaching this course posted a program which can help us to know the time and memory associated with running a program. It has import resource command at the top. I tried to run this program along with the programs I have written in python and every time I received ImportError: No module named 'resource'
I used the same code in ubuntu and have no errors at all.
I followed suggestions in stackoverflow answers and I have tried adding PYTHONPATH PYTHONHOME and edited the PATH environment variable.
I have no idea of what else I can do here.
Is there any file that I can download and install it in the Lib or site-packages folder of my python installation ?
resource is a Unix specific package as seen in https://docs.python.org/2/library/resource.html which is why it worked for you in Ubuntu, but raised an error when trying to use it in Windows.
I ran into similar error in window 10. Here is what solved it for me.
Downgrade to the Apache Spark 2.3.2 prebuild version
Install (or downgrade) jdk to version 1.8.0
My installed jdk was 1.9.0, which doesn't seem to be compatiable with spark 2.3.2 or 2.4.0
make sure that when you run java -version in cmd (command prompt), it show java version 8. If you are seeing version 9, you will need to change your system ENV PATH to ensure it points to java version 8.
Check this link to get help on changing the PATH if you have multiple java version installed.
Hope this helps someone, I was stuck on this issue for almost a week before finally finding a solution.

Trying to install crc16, not detecting Python

I've got Python 2.7 (64-bit) installed and I'm trying to install crc16. I downloaded the relevant crc16 Python 2.7 installation file:
https://pypi.python.org/pypi/crc16/0.1.1#downloads
When I try and install it, however, it says that I don't have Python 2.7 installed and it doesn't see it in the registry. Looking in my C drive I can see that I absolutely have a folder for Python2.7. Am I having this issue because crc16 is 32-bit? How can I get crc16 to install correctly?
It seems that I missed the part where it had to be compiled. It looks like the developer only made a 32 bit version for Windows. You could try using a 32 bit version of Python
Most likely you need to add the location of the Python executable to your PATH environment variable.
Right click My computer and go to properties
Click Advanced System Settings.
Click Environment Variables.
Append ;C:\python27 to the Path variable.
Restart Command Prompt.
This is based on the answer from Adding Python Path on Windows 7

Categories

Resources