tylertreat/BigQuery-Python

ImportError: cannot import name get_client

j450h1 opened this issue · 6 comments

Hi there,

I can't seem to resolve this issue. I upgrade all my Anaconda packages and reinstalled this package. However, I keep getting this error:

ImportError: cannot import name get_client

When I try to import as such:

from bigquery import get_client

Any tips?

Here is what I see when I install this package:

Collecting bigquery-python
Requirement already satisfied (use --upgrade to upgrade): google-api-python-clie
nt in c:\python27_x64\lib\site-packages (from bigquery-python)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in c:\
python27_x64\lib\site-packages (from bigquery-python)
Requirement already satisfied (use --upgrade to upgrade): httplib2 in c:\python2
7_x64\lib\site-packages (from bigquery-python)
Requirement already satisfied (use --upgrade to upgrade): uritemplate<1,>=0.6 in
 c:\python27_x64\lib\site-packages (from google-api-python-client->bigquery-pyth
on)
Requirement already satisfied (use --upgrade to upgrade): oauth2client<3,>=2.0.0
 in c:\python27_x64\lib\site-packages (from google-api-python-client->bigquery-p
ython)
Requirement already satisfied (use --upgrade to upgrade): six<2,>=1.6.1 in c:\py
thon27_x64\lib\site-packages (from google-api-python-client->bigquery-python)
Requirement already satisfied (use --upgrade to upgrade): simplejson>=2.5.0 in c
:\python27_x64\lib\site-packages (from uritemplate<1,>=0.6->google-api-python-cl
ient->bigquery-python)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.7 in c:\py
thon27_x64\lib\site-packages (from oauth2client<3,>=2.0.0->google-api-python-cli
ent->bigquery-python)
Requirement already satisfied (use --upgrade to upgrade): pyasn1-modules>=0.0.5
in c:\python27_x64\lib\site-packages (from oauth2client<3,>=2.0.0->google-api-py
thon-client->bigquery-python)
Requirement already satisfied (use --upgrade to upgrade): rsa>=3.1.4 in c:\pytho
n27_x64\lib\site-packages (from oauth2client<3,>=2.0.0->google-api-python-client
->bigquery-python)
Installing collected packages: bigquery-python
Successfully installed bigquery-python-1.8.0

Try

import bigquery

print(bigquery.get_client)

Does it works?

No, it doesn't.

import bigquery

ImportError: cannot import name get_client

I think it might have something to do with the anaconda distribution or spyder?

Umm, I'm using anaconda but it works.

`--> python
Python 3.5.2 |Anaconda custom (x86_64)| (default, Jul  2 2016, 17:52:12)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bigquery
>>> bigquery.get_client
<function get_client at 0x101c582f0>
>>>

Okay, I got it working in iPython console. I think the issue is with the spyder IDE. Both the iPython console kernel and regular Python console kernel return this error within Spyder:

ImportError: cannot import name get_client

For Windows at least, since it worked fine in the Mac version of Spyder.

I solved it! Rookie move: I named my python file bigquery.py which is the same name as the module! That's why I was getting that error. Thanks for helping me troubleshoot!