Unable to install gcloud sdk using package "google-cloud-sdk-307.0.0-darwin-x86_64.tar.gz" downloaded from gcloud.
Supported Python versions are 3.5 to 3.7, and 2.7.9 or higher
Does it mean Python 3.7.4 is not supported?
enter code here
$ python3 -V
Python 3.7.4
$ which -a python3
/usr/local/bin/python3
/usr/bin/python3
$ ./google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
File "/Users/spalani/Documents/DownloadPackages/./google-cloud-sdk/bin/bootstrapping/install.py", line 12, in <module>
import bootstrapping enter code here
File "/Users/spalani/Documents/DownloadPackages/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 39, in <module>
from googlecloudsdk.core import config
File "/Users/spalani/Documents/DownloadPackages/google-cloud-sdk/lib/googlecloudsdk/core/config.py", line 33, in <module>
from oauth2client import client
File "/Users/spalani/Documents/DownloadPackages/google-cloud-sdk/lib/third_party/oauth2client/client.py", line 39, in <module>
from oauth2client import transport
File "/Users/spalani/Documents/DownloadPackages/google-cloud-sdk/lib/third_party/oauth2client/transport.py", line 17, in <module>
import httplib2
File "/Users/spalani/Documents/DownloadPackages/google-cloud-sdk/lib/third_party/httplib2/__init__.py", line 20, in <module>
from httplib2.python3.httplib2 import *
File "/Users/spalani/Documents/DownloadPackages/google-cloud-sdk/lib/third_party/httplib2/python3/httplib2/__init__.py", line 40, in <module>
import ssl
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: dlopen(/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_ssl.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_ssl.cpython-37m-darwin.so
Reason: image not found
Regarding your question “Does it mean Python 3.7.4 is not supported?”
According to this document:
Cloud SDK runs on Linux, macOS, and Windows. Cloud SDK requires Python. Supported versions are 3.5 to 3.7, and 2.7.9 or higher.
So, it seems that it is supported for the Cloud SDK installation.
On the other hand, I have found the following guide to configure the Python interpreter, it could help you to set it properly.
Also, It appears that the recommended option to install SDK on MacOS is through the interactive installer.
For Windows and macOS interactive installations, and all other use cases, run the interactive installer to install the latest release of Cloud SDK.
The steps to install it using the Google Cloud SDK installer are:
Enter the following at a command prompt:
curl https://sdk.cloud.google.com | bash
Restart your shell:
exec -l $SHELL
Run gcloud init to initialize the gcloud environment:
gcloud init
I hope you find this information useful.
Related
With the upgrade to Google Cloud SDK 360.0.0-0 i started seeing the following error when running the dev_appserver.py command for my Python 2.7 App Engine project.
File "/home/..................py", line 6, in <module>
from google.appengine.ext import ndb
File "/usr/lib/google-cloud-sdk/platform/google_appengine/python27/sdk/google/appengine/ext/ndb/__init__.py", line 22, in <module>
from tasklets import *
File "/usr/lib/google-cloud-sdk/platform/google_appengine/python27/sdk/google/appengine/ext/ndb/tasklets.py", line 85, in <module>
from .google_imports import apiproxy_stub_map
File "/usr/lib/google-cloud-sdk/platform/google_appengine/python27/sdk/google/appengine/ext/ndb/google_imports.py", line 44, in <module>
from google.appengine.runtime import apiproxy as callback
ImportError: cannot import name apiproxy
gcloud version
Google Cloud SDK 360.0.0
alpha 2021.10.04
app-engine-python 1.9.95
app-engine-python-extras 1.9.95
beta 2021.10.04
bq 2.0.71
cloud-build-local 0.5.2
cloud-datastore-emulator 2.1.0
core 2021.10.04
gsutil 5.3
EDIT
This issue seems to have been resolved with Google Cloud SDK version 371
On my debian based system i fixed it by downgrading the app-engine-python component to the previous version
sudo apt-get install google-cloud-sdk-app-engine-python=359.0.0-0
sudo apt-get install google-cloud-sdk-app-engine-python-extras=359.0.0-0
gcloud version (after downgrade)
Google Cloud SDK 360.0.0
alpha 2021.10.04
app-engine-python 1.9.94
app-engine-python-extras 1.9.95
beta 2021.10.04
bq 2.0.71
cloud-build-local 0.5.2
cloud-datastore-emulator 2.1.0
core 2021.10.04
gsutil 5.3
I created an issue for this bug: https://issuetracker.google.com/issues/202171426
For windows you can try this
gcloud components update --version 355.0.0
Google-cloud-sdk version 364 still hasn't been resolved. Windows or mac users can try this:
gcloud components update --version 359.0.0
(The 359 version also includes 'app-engine-python-extras'=1.9.94. So it works well.)
I'm trying FastAPI but I can't even run the Hello World example.
I've installed both uvicorn and fastapi with a venv and requirements.txt, also I'm running Python 3.5 (maybe that's the issue?)
The issue should be something with uvicorn because I can't run --help or --version
uvicorn --version
Traceback (most recent call last):
File "/home/...../.venv/bin/uvicorn", line 7, in <module>
from uvicorn.main import main
File "/home/...../.venv/lib/python3.5/site-packages/uvicorn/__init__.py", line 1, in <module>
from uvicorn.config import Config
File "/home/...../.venv/lib/python3.5/site-packages/uvicorn/config.py", line 131
message = f"Uvicorn running on {ip_repr} (Press CTRL+C to quit)"
^
SyntaxError: invalid syntax
I really don't have a clue where to start looking as I cannot seem to find anything on internet.
Surely with Python 3.5, FastAPI won't work.
FastAPI homepage:
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
uvicorn (from https://github.com/encode/uvicorn):
Requirements: Python 3.6+ (For Python 3.5 support, install version 0.8.6.)
I guess you should update Python to 3.6 at least. pyenv should help.
I installed pygame on my Arch Linux machine with the following command:
$ sudo pacman -S python2-pygame
I am using pyenv and the version of Python in my virtual environment for this project is 2.7.11
When I run my program
$ python smartcab/agent.py
here is what I get:
Traceback (most recent call last):
File "smartcab/agent.py", line 2, in <module>
from environment import Agent, Environment
File "/home/alex/machine-learning/projects/smartcab/smartcab/environment.py", line 5, in <module>
from simulator import Simulator
File "/home/alex/machine-learning/projects/smartcab/smartcab/simulator.py", line 4, in <module>
import pygame
ImportError: No module named pygame
How can I solve this please?
On my own Arch Linux machine...
I have created a 2.7.11 virtualenv using pyenv and installed python2-pygame with pacman. With my virtualenv activated, I couldn't import pygame from python. So I was able to reproduce your issue.
After that, I tried downloading and compiling pygame's source with python setup.py install without success. It is complaining about a missing linux/videodev.h which seems to be (from what I found on the web) deprecated and replaced by linux/videodev2.h (which is there).
I won't go further, I hope this will help someone finding the solution.
I'm learning Python in tandem with Django. I initially installed Python 3 on my machine (Debian Wheezy), but read about possible conflicts and removed it with some difficulty.
Now I'm using virtualenv and installed python3 within the env and Django using pip. Django and Python seem to have installed correctly:
# python -c "import django; print(django.get_version())"
1.9.1
# python -V
Python 3.2.3`
but when I try to start a new Django project, I get the following:
# django-admin.py startproject mysite
Traceback (most recent call last):
File "/home/rialaado/Projects/webenv/bin/django-admin.py", line 2, in <module>
from django.core import management
File "/home/rialaado/Projects/webenv/lib/python3.2/site-packages/django/core/management/__init__.py", line 10, in <module>
from django.apps import apps
File "/home/rialaado/Projects/webenv/lib/python3.2/site-packages/django/apps/__init__.py", line 1, in <module>
from .config import AppConfig
File "/home/rialaado/Projects/webenv/lib/python3.2/site-packages/django/apps/config.py", line 6, in <module>
from django.utils.module_loading import module_has_submodule
File "/home/rialaado/Projects/webenv/lib/python3.2/site-packages/django/utils/module_loading.py", line 67, in <module>
from importlib.util import find_spec as importlib_find
ImportError: cannot import name find_spec
A quick google turned up no results that would help me.
What should I do?
find_spec isn't available in Python 3.2.3; it was added in Python 3.4.
Try upgrading to 3.4 or later.
The version of Django you're using (v1.9.1) cannot be used with Python 3.2. Hence, #KarthiG and #MUNGAI NJOROGE are correct, and now you know why.
What Python version can I use with Django?
I got the same problem with docker containers.
find_spec is not available when using Docker containers and django 1.9 and python:3.3 dependency.
Adding the line below in your docker image as a dependency works.
FROM python:3.4
Upgrade to 13.04 has totally messed my system up .
I am having this issue when running
./manage.py runserver
Traceback (most recent call last):
File "./manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
File "/home/rats/rats/local/lib/python2.7/site-packages/django/core/management
/__init__.py", line 4, in <module>
from optparse import OptionParser, NO_DEFAULT
File "/usr/lib/python2.7/optparse.py", line 77, in <module>
import textwrap
File "/usr/lib/python2.7/textwrap.py", line 10, in <module>
import string, re
File "/usr/lib/python2.7/string.py", line 83, in <module>
import re as _re
File "/home/rats/rats/lib/python2.7/re.py", line 105, in <module>
import sre_compile
File "/home/rats/rats/lib/python2.7/sre_compile.py", line 14, in <module>
import sre_parse
File "/home/rats/rats/lib/python2.7/sre_parse.py", line 17, in <module>
from sre_constants import *
File "/home/rats/rats/lib/python2.7/sre_constants.py", line 18, in <module>
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
this is happening for both the real environment as well as for virtual environment .
i tried removing python with
sudo apt-get remove python
and sadly it has removed everything .
now google chrome does not show any fonts .
i am looking for getting things back to work .
help is needed for proper configuring it again.
If you are using virtualenvwrapper then you can recreate the virtualenv on top of the existing one (with no environment currently active):
mkvirtualenv <existing name>
which should pull in the latest (upgraded) python version from the system and fix any mismatch errors.
You don't need to recreate the environment.
You can upgrade the virtualenv running this command:
virtualenv /PATH/TO/YOUR_OLD_ENV
YOUR_OLD_ENV folder will be properly upgraded to the version 2.7.4.
I have just solved that problem on my machine.
The problem was that Ubuntu 13.04 use python 2.7.4. That makes conflict with the Python version of the virtualenv.
What I do was to re-create the virtualenv with the new version of python. I think it's the simplest way, but you can try to upgrade the python version without re-creating all of the virtualenv.