Trying to read data from one of my google spreadsheet.
I've got the JSON file from google, trying to put it as a string in the script.
this is what I have so far:
import json
import os
from google.oauth2 import service_account
from google.cloud import translate
.
.
.
json_as_string = """........"""
info = json.loads(os.environ[json_as_string])
creds = service_account.Credentials.from_service_account_info(info)
# Instantiates a client
translate_client = translate.Client(credentials=creds)
# credentials = ServiceAccountCredentials.from_json_keyfile_name("SendMyCardCheckUP-2e671ca3c2eb.json", scope)
client = gspread.authorize(credentials)
sheet = client.open("file_name").sheet1
this is what I get back :
from google.oauth2 import service_account
ModuleNotFoundError: No module named 'google'
Already tried through cmd -
pip install -t lib google-auth google-auth-httplib2 google-api-python-client --upgrade
pip install --upgrade google-api-python-client
For some reason, the import of the "google" package doesn't work, any ideas?
EDIT:
pip list:
Package Version
------------------------ ----------
altgraph 0.16.1
asn1crypto 0.24.0
attrs 19.1.0
beautifulsoup4 4.8.0
cachetools 3.1.0
certifi 2018.11.29
cffi 1.12.3
chardet 3.0.4
cryptography 2.6.1
cycler 0.10.0
decorator 4.4.0
future 0.17.1
google 2.0.2
google-api-core 1.14.2
google-api-python-client 1.7.11
google-auth 1.6.3
google-auth-httplib2 0.0.3
google-auth-oauthlib 0.4.0
google-cloud 0.34.0
google-cloud-core 1.0.3
google-cloud-storage 1.18.0
google-cloud-translate 1.6.0
google-oauth 1.0.1
google-resumable-media 0.3.2
googleapis-common-protos 1.6.0
grpcio 1.23.0
gspread 3.1.0
httplib2 0.12.3
idna 2.8
ipython-genutils 0.2.0
jsonschema 3.0.1
jupyter-core 4.4.0
kiwisolver 1.1.0
macholib 1.11
matplotlib 3.0.3
nbformat 4.4.0
numpy 1.16.3
oauth2client 4.1.3
oauthlib 3.0.1
opencv-python 4.1.0.25
pefile 2018.8.8
pip 19.2.2
plotly 3.8.1
protobuf 3.8.0rc1
py 1.8.0
pyasn1 0.4.5
pyasn1-modules 0.2.5
pycparser 2.19
pygame 1.9.6
PyInstaller 3.4
pyOpenSSL 19.0.0
pyparsing 2.4.0
pyrsistent 0.15.1
python-dateutil 2.8.0
python-pygaze 0.6.0a25
pytz 2019.1
pywin32-ctypes 0.2.0
requests 2.22.0
requests-oauthlib 1.2.0
retrying 1.3.3
rsa 4.0
selenium 3.141.0
setuptools 39.0.1
six 1.12.0
soupsieve 1.9.2
traitlets 4.3.2
uritemplate 3.0.0
urllib3 1.24.1
FOUND IT -
pip install google_oauth2_tool
will make the service account work.
pip install google-cloud-storage
will make from google.cloud work
pip install google.cloud.translate
Related
I am trying to pip install dbt-sqlserver and am having issues downloading or building the wheel for pyodbc. I am using python version 3.11 and on a virtual machine. I have not had this issue previously on my local machine.
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
It then details that this is a legacy install failure. I previously downloaded the Microsoft Visual Studio build tools based off a prior error and these are the packages selected.
I am expecting to hopefully download dbt-sqlserver. I have tried multiple different things from stackoverflow to no avail.
Here is my current pip list covering everything within my virtual environment on my VM.
Package Version
------------------------ -----------
agate 1.7.0
aiosqlite 0.18.0
alembic 1.9.2
anyio 3.6.2
apprise 1.2.1
asgi-lifespan 2.0.0
asyncpg 0.27.0
attrs 22.2.0
Babel 2.11.0
betterproto 1.2.5
cachetools 5.3.0
certifi 2022.12.7
cffi 1.15.1
charset-normalizer 3.0.1
click 8.1.3
cloudpickle 2.2.1
colorama 0.4.6
coolname 2.2.0
croniter 1.3.8
cryptography 39.0.0
dateparser 1.1.6
dbt-core 1.4.1
dbt-extractor 0.4.1
docker 6.0.1
fastapi 0.89.1
fsspec 2023.1.0
future 0.18.3
google-auth 2.16.0
graphql-core 3.2.3
greenlet 2.0.2
griffe 0.25.4
grpclib 0.4.3
h11 0.14.0
h2 4.1.0
hologram 0.0.15
hpack 4.0.0
httpcore 0.16.3
httpx 0.23.3
hyperframe 6.0.1
idna 3.4
isodate 0.6.1
Jinja2 3.1.2
jsonpatch 1.32
jsonpointer 2.3
jsonschema 3.2.0
kubernetes 25.3.0
leather 0.3.4
Logbook 1.5.3
Mako 1.2.4
Markdown 3.4.1
markdown-it-py 2.1.0
MarkupSafe 2.1.2
mashumaro 3.3.1
mdurl 0.1.2
minimal-snowplow-tracker 0.0.2
msgpack 1.0.4
multidict 6.0.4
networkx 2.8.8
oauthlib 3.2.2
orjson 3.8.5
packaging 21.3
parsedatetime 2.4
pathspec 0.10.3
pendulum 2.1.2
pip 23.0
prefect 2.7.10
prefect-dbt 0.2.7
prefect-shell 0.1.3
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycparser 2.21
pydantic 1.10.4
Pygments 2.14.0
pyodbc 4.0.35
pyparsing 3.0.9
pyrsistent 0.19.3
python-dateutil 2.8.2
python-slugify 8.0.0
pytimeparse 1.1.8
pytz 2022.7.1
pytz-deprecation-shim 0.1.0.post0
pytzdata 2020.1
pywin32 305
PyYAML 6.0
readchar 4.0.3
regex 2022.10.31
requests 2.28.2
requests-oauthlib 1.3.1
rfc3986 1.5.0
rich 13.3.1
rsa 4.9
setuptools 67.1.0
sgqlc 16.1
six 1.16.0
sniffio 1.3.0
SQLAlchemy 1.4.46
sqlparse 0.4.3
starlette 0.22.0
stringcase 1.2.0
text-unidecode 1.3
toml 0.10.2
typer 0.7.0
typing_extensions 4.4.0
tzdata 2022.7
tzlocal 4.2
urllib3 1.26.14
uvicorn 0.20.0
websocket-client 1.5.0
Werkzeug 2.2.2
wheel 0.38.4
I am trying to use DialogFlow to make a small talk chatbot on Raspberry Pi 4, and I am getting this error:
ImportError: /usr/local/lib/python3.7/dist-packages/grpc/_cython/cygrpc.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: aes_hw_encrypt
My code is as follows:
"""
Libraries used:
dialogflow 1.1.0 - I did pip3 install dialogflow -U and it upgraded to this
google-api-core 1.29.0
os Latest version - not sure
"""
import os
import dialogflow
from google.api_core.exceptions import InvalidArgument
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = 'secrets.json'
DIALOGFLOW_PROJECT_ID = '[test_id]'
DIALOGFLOW_LANGUAGE_CODE= '[en]'
SESSION_ID = 'me'
text_to_be_analyzed = "Howdy"
session_client = dialogflow.SessionsClient()
session = session_client.session_path(DIALOGFLOW_PROJECT_ID, SESSION_ID)
text_input = dialogflow.types.TextInput(text=text_to_be_analyzed, language_code=DIALOGFLOW_LANGUAGE_CODE)
query_input = dialogflow.types.QueryInput(text=text_input)
try:
response = session_client.detect_intent(session=session, query_input=query_input)
except InvalidArgument:
raise
print("Query text:", response.query_result.query_text)
print("Detected intent:", response.query_result.intent.display_name)
print("Detected intent confidence:", response.query_result.intent_detection_confidence)
print("Fulfillment text:", response.query_result.fulfillment_text)
pip3 list gives me:
-------------------------------- ---------------
Adafruit-BBIO 1.2.0
Adafruit-Blinka 6.10.0
Adafruit-CharLCD 1.1.1
adafruit-circuitpython-busdevice 5.0.6
adafruit-circuitpython-framebuf 1.4.7
adafruit-circuitpython-ssd1306 2.11.4
Adafruit-GPIO 1.0.3
Adafruit-ILI9341 1.5.1
Adafruit-PlatformDetect 3.13.3
Adafruit-PureIO 1.1.8
Adafruit-SSD1306 1.6.2
appdirs 1.4.3
asn1crypto 0.24.0
astroid 2.1.0
asttokens 1.1.13
attrs 21.2.0
automationhat 0.2.0
beautifulsoup4 4.7.1
blinker 1.4
blinkt 0.1.2
bs4 0.0.1
buttonshim 0.0.2
cachetools 4.2.2
Cap1xxx 0.1.3
certifi 2018.8.24
chardet 3.0.4
Click 7.0
colorama 0.3.7
colorzero 1.1
cookies 2.2.1
cryptography 2.6.1
cupshelpers 1.0
cycler 0.10.0
decorator 4.4.2
dialogflow 1.1.0
docutils 0.14
drumhat 0.1.0
entrypoints 0.3
envirophat 1.0.0
ExplorerHAT 0.4.2
flake8 3.9.2
Flask 1.0.2
fourletterphat 0.1.0
fuzzywuzzy 0.18.0
google-api-core 1.29.0
google-auth 1.30.1
googleapis-common-protos 1.53.0
gpiozero 1.5.1
grpcio 1.38.0
guizero 0.6.0
html5lib 1.0.1
idna 2.6
imageio 2.9.0
importlib-metadata 4.0.1
iniconfig 1.1.1
ipykernel 4.9.0
ipython 5.8.0
ipython-genutils 0.2.0
isort 4.3.4
itsdangerous 0.24
jaraco.context 4.0.0
jedi 0.13.2
Jinja2 2.10
jupyter-client 5.2.3
jupyter-core 4.4.0
keyring 17.1.1
keyrings.alt 3.1.1
kiwisolver 1.3.1
lazy-object-proxy 1.3.1
logilab-common 1.4.2
lxml 4.3.2
MarkupSafe 1.1.0
matplotlib 3.4.2
mccabe 0.6.1
microdotphat 0.2.1
mongo-db 0.1
more-itertools 8.8.0
mote 0.0.4
motephat 0.0.3
mypy 0.670
mypy-extensions 0.4.1
networkx 2.5.1
nightly 0.0.1
nudatus 0.0.4
numpy 1.20.3
oauthlib 2.1.0
olefile 0.46
packaging 20.9
pandas 1.2.4
pantilthat 0.0.7
parso 0.3.1
pexpect 4.6.0
pgzero 1.2
phatbeat 0.1.1
pianohat 0.1.0
picamera 1.13
pickleshare 0.7.5
piglow 1.2.5
pigpio 1.78
Pillow 8.2.0
pip 18.1
pluggy 0.13.1
prompt-toolkit 3.0.18
protobuf 3.17.2
psutil 5.5.1
py 1.10.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycairo 1.16.2
pycodestyle 2.7.0
pycrypto 2.6.1
pycups 1.9.73
pyflakes 2.3.1
pyftdi 0.53.1
pygame 1.9.4.post1
Pygments 2.3.1
PyGObject 3.30.4
pyinotify 0.9.6
PyJWT 1.7.0
pylint 2.2.2
pymongo 3.4.0
pyOpenSSL 19.0.0
pyparsing 2.4.7
pyserial 3.4
pysmbc 1.0.15.6
pytest 6.2.4
python-apt 1.8.4.3
python-dateutil 2.8.1
python-espeak 0.5
python-Levenshtein 0.12.2
pytz 2021.1
pyusb 1.1.1
PyWavelets 1.1.1
pyxdg 0.25
PyYAML 5.4.1
pyzmq 17.1.2
qtconsole 4.3.1
rainbowhat 0.1.0
reportlab 3.5.13
requests 2.21.0
requests-oauthlib 1.0.0
responses 0.9.0
roman 2.0.0
rpi-ws281x 4.2.6
RPi.GPIO 0.7.0
rsa 4.7.2
RTIMULib 7.2.1
scikit-image 0.18.1
scipy 1.6.3
screen 1.0.1
scrollphat 0.0.7
scrollphathd 1.2.1
SecretStorage 2.3.1
semver 2.0.1
Send2Trash 1.5.0
sense-hat 2.2.0
setuptools 40.8.0
simplegeneric 0.8.1
simplejson 3.16.0
six 1.16.0
skywriter 0.0.7
sn3218 1.2.7
soupsieve 1.8
sox 1.4.1
spidev 3.4
ssh-import-id 5.7
sysv-ipc 1.1.0
thonny 3.3.6
tifffile 2021.4.8
toml 0.10.2
torch 1.0.0a0+8322165
torchvision 0.2.0
tornado 5.1.1
touchphat 0.0.1
traitlets 4.3.2
twython 3.7.0
typed-ast 1.3.1
typing 3.7.4.3
typing-extensions 3.10.0.0
uflash 1.2.4
unicornhathd 0.0.4
urllib3 1.24.1
wcwidth 0.2.5
webencodings 0.5.1
Werkzeug 0.14.1
wheel 0.32.3
wit 6.0.0
wolframalpha 5.0.0
wrapt 1.10.11
xmltodict 0.12.0
zipp 3.4.1
I might have accidentally installed the libraries some other way when I updated, but I don't think so...
I didn't install anything using apt.
I am using Thonny Python. Thanks!
cryptography lib was old. Thanks to everyone who helped!
Currently I am trying to implement django-summernote to my Django project.
I could pip-install it, set up the urls.py, setting.py, admin.py but it is not working properly on the admin page.
If I go to the page, the information is displayed but it is not editable.
Does anybody know how to fix this?
Here is the info about package versions.
Python 3.6.9
Django 2.1
django-summernote 0.8.11.6
And here is a screenshot of the admin page:
The data is displayed but the none of buttons for html customization is displayed, and this is not editable. I can not modify any sentence.
I would really appreciate if somebody gave me any advice on this.
Details package info↓ (This is result of pip list)
----------------------- ---------
asgiref 3.2.10
beautifulsoup4 4.9.3
bs4 0.0.1
cachetools 4.1.1
certifi 2019.6.16
chardet 3.0.4
cssselect2 0.3.0
cycler 0.10.0
decorator 4.4.1
Django 2.1
django-bootstrap4 1.1.1
django-cleanup 4.0.0
django-filter 2.4.0
django-modelcluster 5.1
django-pandas 0.6.1
django-summernote 0.8.11.6
django-taggit 1.3.0
django-treebeard 4.3.1
djangorestframework 3.12.1
draftjs-exporter 2.1.7
et-xmlfile 1.0.1
google-api-core 1.22.2
google-api-python-client 1.11.0
google-auth 1.21.1
google-auth-httplib2 0.0.4
googleapis-common-protos 1.52.0
gspread 3.2.0
html5lib 1.1
httplib2 0.17.0
idna 2.8
importlib-metadata 1.7.0
jdcal 1.4.1
Jinja2 2.10.1
kiwisolver 1.2.0
l18n 2018.5
lxml 4.4.1
MarkupSafe 1.1.1
matplotlib 3.2.1
mplfinance 0.12.3a3
mysqlclient 1.3.10
numpy 1.17.2
oandapyV20 0.6.3
oauth2client 4.1.3
oauthlib 3.1.0
openpyxl 3.0.5
pandas 0.25.1
pandas-datareader 0.8.1
pdfminer.six 20181108
Pillow 6.1.0
pip 19.2.2
protobuf 3.13.0
py 1.8.1
py-trello 0.17.1
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycryptodome 3.9.0
PyMySQL 0.9.3
pyparsing 2.4.7
python-dateutil 2.8.0
pytz 2019.2
reportlab 3.5.46
requests 2.22.0
requests-oauthlib 1.2.0
retry 0.9.2
rsa 4.0
selenium 3.141.0
setuptools 41.0.1
six 1.12.0
sortedcontainers 2.1.0
soupsieve 1.9.3
sqlparse 0.3.0
svglib 1.0.0
tablib 2.0.0
tinycss2 1.0.2
Unidecode 1.1.1
uritemplate 3.0.1
urllib3 1.25.5
webencodings 0.5.1
wheel 0.33.4
whitenoise 4.1.4
Willow 1.4
xlrd 1.2.0
XlsxWriter 1.3.7
xlwt 1.3.0
zipp 3.4.0
I resolved the same issue with this command:
python manage.py collectstatic
You need to get the latest files from django-summernote to where you currently have your static folder. The same applies to django-ckeditor.
I m trying to run my django app on appengine flexible environment. I m struck on Error.
from google.oauth2 import service_account
ModuleNotFoundError: No module named 'google'
here, i m importing service_account, because i m using google cloud storage. So in settings.py i have to write the code below
from google.oauth2 import service_account
GS_CREDENTIALS = service_account.Credentials.from_service_account_file(
os.path.join(BASE_DIR,'My Project..............001.json')
)
It is running fine on local virtual environment but not appengine flex env.
Extra:- in requirements.txt
Package Version
------------------------ ---------
asgiref 3.2.10
astroid 2.4.2
cachetools 4.1.1
certifi 2020.6.20
chardet 3.0.4
colorama 0.4.3
Django 3.0.2
django-storages 1.9.1
google-api-core 1.21.0
google-auth 1.18.0
google-cloud-core 1.3.0
google-cloud-storage 1.29.0
google-resumable-media 0.5.1
googleapis-common-protos 1.52.0
gunicorn 20.0.4
idna 2.10
isort 4.3.21
lazy-object-proxy 1.4.3
mccabe 0.6.1
Pillow 7.2.0
pip 19.0.3
protobuf 3.12.2
psycopg2 2.8.5
psycopg2-binary 2.8.5
pyasn1 0.4.8
pyasn1-modules 0.2.8
pylint 2.5.3
pytz 2020.1
requests 2.24.0
rsa 4.6
setuptools 40.8.0
six 1.15.0
sqlparse 0.3.1
toml 0.10.1
typed-ast 1.4.1
urllib3 1.25.9
wheel 0.34.2
wrapt 1.12.1
Thanks.
I'm using jupyter notebook in Raspberry Pi3. I have already installed pandas and other packages. My python3 IDLE can import all those packages but jupyter always shows an error saying
No module named pandas
Tried lots of things but none of them are working.
sudo pip3 install jupyter --upgrade
sudo pip3 install ipykernel --upgrade
pi#raspberrypi:~ $ pip3 list
Package Version
----------------------------- -----------
alabaster 0.7.12
appdirs 1.4.3
asn1crypto 0.24.0
astroid 2.1.0
asttokens 1.1.13
attrs 19.1.0
automationhat 0.1.0
Babel 2.7.0
backcall 0.1.0
beautifulsoup4 4.7.1
bleach 3.1.0
blinker 1.4
blinkt 0.1.2
bokeh 1.2.0
buttonshim 0.0.2
Cap1xxx 0.1.3
certifi 2018.8.24
chardet 3.0.4
Click 7.0
cloudpickle 1.2.1
colorama 0.3.7
colorzero 1.1
cookies 2.2.1
HeapDict 1.0.0
html5lib 1.0.1
idna 2.6
imagesize 1.1.0
ipykernel 5.1.1
ipyparallel 6.2.4
ipython 7.5.0
ipython-genutils 0.2.0
ipywidgets 7.4.2
isort 4.3.4
itsdangerous 0.24
jedi 0.13.2
Jinja2 2.10
jsonschema 3.0.1
jupyter 1.0.0
jupyter-client 5.2.4
jupyter-console 6.0.0
jupyter-core 4.5.0
keyring 17.1.1
keyrings.alt 3.1.1
kiwisolver 1.0.1
lazy-object-proxy 1.3.1
locket 0.2.0
logilab-common 1.4.2
lxml 4.3.2
packaging 19.0
pandas 0.24.2
import pandas as pd
ImportError: No modules named pandas