Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python bigquery - ImportError: No module named google.apputils

I am trying to use the google bigquery python library but whenever I run import bq I get the following error;

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-21-923a4eec0450> in <module>()
----> 1 import bq

/Users/tahirfayyaz/anaconda/python.app/Contents/lib/python2.7/site-packages/bq.py in      <module>()
     31 import oauth2client.tools
     32 
---> 33 from google.apputils import app
     34 from google.apputils import appcommands
     35 import gflags as flags

ImportError: No module named google.apputils

I have installed and even upgraded google-apputils but I still get this error.

like image 396
tfayyaz Avatar asked Mar 17 '14 22:03

tfayyaz


1 Answers

The way Google Cloud tools are distributed has changed a bit, you'll be able to download a current version of the software via the Cloud SDK: * https://developers.google.com/cloud/sdk/

The SDK will install a hermetic environment that contains bigquery as well as all of it's dependencies, like oauth2client and google.apputils. It doesn't use ez-install anymore.

You can add the SDK to your PATH to pick up the current bq.py program. export PATH=$SDKROOT/platform/bigquery:$PATH

You can add the SDK to your PYTHONPATH if you're trying to import something directly as in your example above. export PYTHONPATH=$SDKROOT/platform/bigquery:$PYTHONPATH

like image 197
Eric Avatar answered Sep 25 '22 23:09

Eric