1
votes

I follow this Google guide: https://cloud.google.com/bigquery/docs/reference/libraries#client-libraries-install-python And after run script I got an error:

    Traceback (most recent call last):
      File "/home/pyc6eh4uk/PycharmProjects/fintech_python/bq_jobs/big_query_test.py", line 2, in <module>
        from google.cloud import bigquery
      File "/usr/local/lib/python2.7/dist-packages/google/cloud/bigquery/__init__.py", line 32, in <module>
        __version__ = get_distribution('google-cloud-bigquery').version
      File "/home/pyc6eh4uk/Programms/google-cloud-sdk/platform/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 311, in get_distribution
        if isinstance(dist,Requirement): dist = get_provider(dist)
      File "/home/pyc6eh4uk/Programms/google-cloud-sdk/platform/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 197, in get_provider
        return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
      File "/home/pyc6eh4uk/Programms/google-cloud-sdk/platform/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 666, in require
        needed = self.resolve(parse_requirements(requirements))
      File "/home/pyc6eh4uk/Programms/google-cloud-sdk/platform/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 565, in resolve
        raise DistributionNotFound(req)  # XXX put more info here
    pkg_resources.DistributionNotFound: google-cloud-bigquery

So I think that problem in confilcts between google-cloud-sdk that located in my home directory and bigquery package in /usr/local/lib/python2.7/dist-packages/google/cloud How avoid this conflict or may be how setup enviroment that work google sdk and bigqery?

1

1 Answers

0
votes

I just made a quick test and I can’t reproduce this behavior. To isolate the issue what you can do is use a virtualenv just by doing the following:

-$ virtualenv test

-$ pip freeze (make sure there’s nothing installed)

-$ source test/bin/activate

-$ pip install --upgrade google-cloud-bigquery

Once installed you can follow the tutorial you are using so far and execute the script inside de virtualenv. After you are done you can leave the virtualenv by running $ deactivate