GoogleCloudPlatform / python-docs-samples

Code samples used on cloud.google.com
Apache License 2.0
7.34k stars 6.39k forks source link

ImportError: No module named gapic.longrunning #1162

Closed mol3earth closed 6 years ago

mol3earth commented 6 years ago

In which file did you encounter the issue?

while importing from google.cloud import speech

Did you change the file? If so, how?

Nope

Describe the issue

Can't import speech.

I went through this: https://cloud.google.com/sdk/docs/quickstart-linux and did the entire Initialize the SDK section

Full error 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/google/cloud/speech/__init__.py", line 22, in <module>
    from google.cloud.speech.client import Client
  File "/usr/local/lib/python2.7/dist-packages/google/cloud/speech/client.py", line 25, in <module>
    from google.cloud.speech._gax import GAPICSpeechAPI
  File "/usr/local/lib/python2.7/dist-packages/google/cloud/speech/_gax.py", line 17, in <module>
    from google.cloud.gapic.speech.v1.speech_client import SpeechClient
  File "/usr/local/lib/python2.7/dist-packages/google/cloud/gapic/speech/v1/speech_client.py", line 31, in <module>
    from google.gapic.longrunning import operations_client
ImportError: No module named gapic.longrunning
theacodes commented 6 years ago

Hi @mol3earth, can you te me the output of pip freeze?

mol3earth commented 6 years ago

sure thing

appdirs==1.4.3
apt-xapian-index==0.45
asn1crypto==0.22.0
astroid==1.0.1
backports-abc==0.5
backports.shutil-get-terminal-size==1.0.0
backports.ssl-match-hostname==3.5.0.1
bcrypt==3.1.3
BeautifulSoup==3.2.1
beautifulsoup4==4.6.0
bleach==2.0.0
bs4==0.0.1
cachetools==2.0.1
certifi==2017.4.17
cffi==1.10.0
chardet==3.0.3
Cheetah==2.4.4
cloud-init==0.7.5
configobj==4.7.2
configparser==3.5.0
cryptography==1.9
cssselect==1.0.1
decorator==3.4.0
dill==0.2.7.1
docutils==0.11
entrypoints==0.2.3
enum34==1.1.6
functools32==3.2.3.post2
future==0.16.0
futures==3.1.1
gax-google-logging-v2==0.8.3
gax-google-pubsub-v1==0.8.3
google-auth==1.1.1
google-cloud-core==0.27.1
google-cloud-speech==0.29.0
google-gax==0.12.5
googleapis-common-protos==1.5.3
grpc-google-logging-v2==0.8.1
grpc-google-pubsub-v1==0.8.1
grpcio==1.4.0
html5lib==0.999999999
httplib2==0.10.3
idna==2.5
ipaddress==1.0.18
ipykernel==4.6.1
ipython==5.4.1
ipython-genutils==0.2.0
ipywidgets==6.0.0
Jinja2==2.7.2
jsonpatch==1.3
jsonpointer==1.0
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.0.1
jupyter-console==5.1.0
jupyter-core==4.3.0
Landscape-Client==14.12
logilab-common==0.61.0
lxml==3.7.3
MarkupSafe==0.18
matplotlib==1.3.1
mercurial==2.8.2
mistune==0.7.4
nbconvert==5.2.1
nbformat==4.3.0
notebook==5.0.0
numpy==1.8.2
oauth==1.0.1
oauth2client==4.0.0
olefile==0.44
packaging==16.8
PAM==0.4.2
pandocfilters==1.4.1
paramiko==2.2.1
pathlib2==2.3.0
pdfminer==20140328
pdfquery==0.4.3
pep8==1.4.6
pexpect==3.1
pickleshare==0.7.4
Pillow==4.2.1
ply==3.8
prettytable==0.7.2
prompt-toolkit==1.0.14
protobuf==3.4.0
psutil==1.2.1
ptyprocess==0.5.1
pyasn1==0.2.3
pyasn1-modules==0.0.8
pycparser==2.17
pycurl==7.19.3
pyflakes==0.8.1
Pygments==1.6
pylint==1.1.0
PyNaCl==1.1.2
pyOpenSSL==17.0.0
pyparsing==2.2.0
pyPdf==1.13
PyPDF2==1.26.0
pyquery==1.2.17
pyserial==2.6
pysolr==3.6.0
python-apt===0.9.3.5ubuntu2
python-dateutil==2.6.0
python-debian===0.1.21-nmu2ubuntu2
pytz==2012rc0
PyYAML==3.10
pyzmq==14.0.1
qtconsole==4.3.0
reportlab==3.4.0
requests==2.17.3
roman==2.0.0
rope==0.9.2
rsa==3.4.2
scandir==1.5
scipy==0.13.3
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.10.0
Sphinx==1.2.2
spyder==2.2.5
ssh-import-id==3.21
terminado==0.6
testpath==0.3.1
tornado==4.5.1
traitlets==4.3.2
Twisted-Core==13.2.0
Twisted-Names==13.2.0
Twisted-Web==13.2.0
Unidecode==0.4.20
uritemplate==3.0.0
urllib3==1.21.1
virtualenv==15.1.0
watson-developer-cloud==0.26.1
wcwidth==0.1.7
webencodings==0.5.1
widgetsnbextension==2.0.0
zope.interface==4.0.5
theacodes commented 6 years ago

Are you using a virtualenv? I would highly recommend trying to install this app's dependencies in a new virtualenv.

mol3earth commented 6 years ago

im not using a virtual environment. I am setting one up now why does it not work without one?

theacodes commented 6 years ago

why does it not work without one?

Likely a conflicting/older version of a package. In general, you should never install packages globally.

I'm going to close this, but if it still doesn't work after using virtualenv let us know.