I am trying to deploy my rails app to AWS Beanstalk using the AWS CLI and it looks like when I am trying to initialize my repo I get an error because I don't have python installed? My question is, do I need python installed for this to work? Why would I need python if my app was developed in Ruby, or is this related to how Amazon built the tool?
$eb init
Traceback (most recent call last):
File "/usr/local/bin/eb", line 5, in <module>
from pkg_resources import load_entry_point
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 3131, in <module>
#_call_aside
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 3117, in _call_aside
The AWS website states the requirements:
The EB CLI is developed in Python and requires Python version 2.7 or 3.4 in order to run.
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html
The CLI has nothing to do with Ruby or Rails, it's just that Amazon chose to code their tool in Python so you will need python to use it.
Related
I'm trying to use gRPC to access to google home graph api.
in this tutorial I've found an example on how to compile a proto file to get some python code that can be used by a client.
The provided example generate some python files but they are not usable because they seems to import other files that do not exist.
The command I've used to compile is the following:
python -m grpc_tools.protoc -I./googleapis --python_out=. --grpc_python_out=. googleapis/google/home/graph/v1/homegraph.proto
to compile this proto file
when I try to import the generated file I got the following error.
(grpc_test) ➜ grpc_test git:(master) ✗ python test.py
Traceback (most recent call last):
File "test.py", line 2, in <module>
import google.home.graph.v1.homegraph_pb2 as home_graph
File "/home/corsair/code/grpc_test/google/home/graph/v1/homegraph_pb2.py", line 16, in <module>
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
ModuleNotFoundError: No module named 'google.api'
It's clear that some other files are expected to exist.
Is there a way to automatically compile also all the dependencies of the proto I need?
There is a compiled common ProtoBuf library for Google APIs: https://pypi.org/project/googleapis-common-protos/.
pip install googleapis-common-protos
After installing this package, the import error should go away.
Using PyCharm Pro 2019.1.1 on MacOS, writing my app in Python 3 w/Flask, Jinja2, etc. A version of my app is already deployed using App Engine Flexible, and I want the next version to use Datastore for my production environment variables. Having problems trying to follow this post, which requires the following import:
from google.appengine.ext import ndb
For the life of me, I cannot seem to get this import working. I'm sure it will work once my app is deployed (famous last words?), but I'd love to get it working locally too.
Initially tried pip install google-appengine and pip install appengine-sdk, only to discover neither could be installed on my venv.
Google Cloud SDK v241.0.0 is installed at /Users/<me>/google-cloud-sdk, and gcloud commands work in the terminal. gcloud components list shows the app-engine-python component is installed, which is probably irrelevant since I'm using a venv in PyCharm.
PyCharm's documentation instructed me to select the App Engine SDK directory under Languages & Frameworks > Google App Engine.
Selecting /Users/<me>/google-cloud-sdk yields this error:
Traceback (most recent call last):
File "/Users/<me>/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/191.6605.12/PyCharm.app/Contents/helpers/pydev/pydevconsole.py", line 5, in <module>
from _pydev_comm.rpc import make_rpc_client, start_rpc_server, start_rpc_server_and_make_client
File "/Users/<me>/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/191.6605.12/PyCharm.app/Contents/helpers/pydev/_pydev_comm/rpc.py", line 4, in <module>
from _pydev_comm.server import TSingleThreadedServer
File "/Users/<me>/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/191.6605.12/PyCharm.app/Contents/helpers/pydev/_pydev_comm/server.py", line 4, in <module>
from _shaded_thriftpy.server import TServer
File "/Users/<me>/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/191.6605.12/PyCharm.app/Contents/helpers/third_party/thriftpy/_shaded_thriftpy/server.py", line 5, in <module>
import logging
File "/Users/<me>/google-cloud-sdk/lib/surface/logging/__init__.py", line 22, in <module>
from googlecloudsdk.calliope import base
ModuleNotFoundError: No module named 'googlecloudsdk'
Selecting /Users/<me>/google-cloud-sdk/platform/google_appengine seems to get me a bit further, but still yields an error:
Traceback (most recent call last):
File "/Users/<me>/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/191.6605.12/PyCharm.app/Contents/helpers/pydev/pydevconsole.py", line 5, in <module>
from _pydev_comm.rpc import make_rpc_client, start_rpc_server, start_rpc_server_and_make_client
File "/Users/<me>/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/191.6605.12/PyCharm.app/Contents/helpers/pydev/_pydev_comm/rpc.py", line 1, in <module>
import socket
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 53, in <module>
from enum import IntEnum, IntFlag
ImportError: cannot import name 'IntFlag' from 'enum' (/Users/<me>/google-cloud-sdk/platform/google_appengine/lib/grpcio-1.9.1/enum/__init__.py)
As the console notes, there is no IntFlag object in 'enum'. These errors are immediately shown when I launch Python Console; I don't even get a cursor. Where am I going wrong?
The post you referenced applies to the 1st generation standard environment - Python 2.7 - that's the only environment in which the ndb library is supported:
The Python NDB Client Library Overview
For the other environments you need to use the generic datastore client library. References:
Using Cloud Datastore - for the 2nd generation standard environment
Using Cloud Datastore - for the flexible environment
Potentially of interest: How to tell if a Google App Engine documentation page applies to the standard or the flexible environment
I'm playing with GAE but I realized that when I try to start the .py file I get this error. What can I do?
Thanks
python3 test.py runserver
Traceback (most recent call last):
File "test.py", line 6, in <module>
from google.appengine.ext import ndb
File "/usr/local/lib/python3.6/dist-packages/google/appengine/ext/ndb/__init__.py", line 7, in <module>
from tasklets import *
ModuleNotFoundError: No module named 'tasklets'
The NDB library is only available in the standard environment GAE, which only works with python 2.7.
So either switch to the standard environment (and python 2.7) or use the flexible environment instructions for Using Cloud Datastore.
Maybe of interest: How to tell if a Google App Engine documentation page applies to the standard or the flexible environment
I am running the source version of web2py from an Ubuntu VM and Python 2.7. I'm trying to use the Paramiko library for SSH functionality, but the following code gives this error:
Code
from paramiko import client
Error
Traceback (most recent call last):
File "/home/localadmin/scanme/gluon/restricted.py", line 227, in restricted
exec ccode in environment
File "/home/localadmin/scanme/applications/nmap/controllers/default.py", line 418, in <module>
File "/home/localadmin/scanme/gluon/globals.py", line 417, in <lambda>
self._caller = lambda f: f()
File "/home/localadmin/scanme/applications/nmap/controllers/default.py", line 50, in login
except paramiko.ssh_exception.AuthenticationException:
NameError: global name 'paramiko' is not defined
What is confusing me is that importing and using the paramiko library works perfectly fine on my system when I run Python outside of web2py.
I thought that all modules available in my local Python install were supposed to be available in web2py when using the source version. This is how i launched the web server from the command line:
python2.7 web2py.py
Does anyone know what may be causing this issue? It's worth noting that I have not found a "paramiko" directory on my system after installing the library like I have with other modules that are working in web2py.
Your import statement is:
from paramiko import client
But in your code, you have:
except paramiko.ssh_exception.AuthenticationException
In order to reference paramiko, you must import it:
import paramiko
I'm trying to code a program to check files in Google Cloud Storage using Python.
Now I'm read the google doc -> https://developers.google.com/api-client-library/python/start/installation.
At the last step - "App Engine", it asks user to do following:
->> cd myproject
->> unzip google-api-python-client-gae-1.1.zip
So what's the next steps? I'm still having problem to run the Google sample python code about GCS, which throw error:
Traceback (most recent call last):
File "gcs_test.py", line 22, in <module>
from google.appengine.ext import webapp
ImportError: No module named google.appengine.ext
I tried to add below code but still got same error:
from sys import path
path.append(r"C:\Py_dev\gcs_test\google-api-python-client-gae-1.2.zip")
path.append(r"C:\Py_dev\gcs_test\C:\Py_dev\gcs_test\apiclient")
Thanks for all kind help!
google.appengine is the library used by App Engine apps, not by the api client library, the library you are looking for is apiclient
If you wish to run a normal python script instead of an App Engine app, you should remove references to App Engine specific libraries.
If you are running an app engine app, make sure you are using dev_appserver.py or the actual app engine servers, not just running the script using python