question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing modules from google.cloud package hangs indefinitely

See original GitHub issue

If I install google-cloud in a brand new virtual environment and don’t use the wheel distribution, importing modules from the package causes the program to hang indefinitely.

pip install google-cloud --no-binary :all:  # force pip to install sdist
python -c "from google.cloud import datastore"   # hangs 

The only material difference I see between installing wheel vs. egg is compiling the grpcio dependency, which has c extensions.

$ pip show google-cloud
Name: google-cloud
Version: 0.25.0
Summary: API Client library for Google Cloud
Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
Author: Google Cloud Platform
Author-email: jjg+google-cloud-python@google.com
License: Apache 2.0
Location: /home/yang/.virtualenvs/pyvatic/lib/python2.7/site-packages
Requires: google-cloud-bigquery, google-cloud-bigtable, google-cloud-core, google-cloud-datastore, google-cloud-dns, google-cloud-error-reporting, google-cloud-language, google-cloud-logging, google-cloud-monitoring, google-cloud-pubsub, google-cloud-resource-manager, google-cloud-spanner, google-cloud-speech, google-cloud-storage, google-cloud-translate, google-cloud-vision, google-cloud-runtimeconfig

$ python --version
Python 2.7.12

$ gcc --version
gcc (Ubuntu 4.9.4-2ubuntu1~16.04) 4.9.4

Installing from wheel distribution works fine, but if a package lists google-cloud as a dependency in its own setup.py, pip won’t install wheels since its not supported in setuptools and the program will hang whenever modules from google-cloud are imported.

I’m running on Ubuntu 16.04 LTS.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dhermescommented, May 17, 2017

Thanks for doing the sleuthing! Sorry this happened to you, happy to help if there is more we can do. Cheers.

0reactions
y4n9squaredcommented, Jul 14, 2020

@AnupJonchhe it’s been a very long time since I encountered this and I don’t remember what the root cause was anymore for me. From my comment three years ago, it seems like there was something special about my host. Try running strace (or your OS equivalent) of the simple import command:

strace python -c "import ..."

and see where it is hanging. This might be how I started debugging back then…

Read more comments on GitHub >

github_iconTop Results From Across the Web

python google cloud metrics hangs forever - Stack Overflow
I have a python module that queries google metrics. It works perfectly fine if I run it as a script on command line,...
Read more >
Troubleshoot Dataflow errors - Google Cloud
When running in streaming mode, a bundle including a failing item is retried indefinitely, which might cause your pipeline to permanently stall.
Read more >
Installing Python Dependencies in Dataflow | Google Cloud
The dependency may be public packages from PyPI or internal packages built in your team. It is not enough to install the dependencies...
Read more >
Google Cloud Client Libraries for Go - Go Packages
Package cloud is the root of the packages used to access Google ... This causes RPCs to appear to hang, because gRPC retries...
Read more >
Google Python Style Guide
2.2 Imports. Use import statements for packages and modules only, not for individual classes or functions. 2.2.1 Definition. Reusability ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found