Search code examples
pythongoogle-app-enginecmdgoogle-translate

Importing translate from google.cloud


I am trying to do translate a document with google translate from the package google.cloud I already did:

pip install google.cloud 

and the result was:

Collecting google.cloud
  Using cached google_cloud-0.27.0-py2.py3-none-any.whl
Requirement already satisfied: google-cloud-logging<1.3dev,>=1.2.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-bigtable<0.27dev,>=0.26.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-datastore<1.3dev,>=1.2.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-error-reporting<0.27dev,>=0.26.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-pubsub<0.28dev,>=0.27.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-core<0.27dev,>=0.26.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-storage<1.4dev,>=1.3.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-resource-manager<0.27dev,>=0.26.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-language<0.28dev,>=0.27.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-translate<1.2dev,>=1.1.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-speech<0.29dev,>=0.28.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-videointelligence<0.26dev,>=0.25.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-monitoring<0.27dev,>=0.26.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-spanner<0.27dev,>=0.26.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-runtimeconfig<0.27dev,>=0.26.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-vision<0.27dev,>=0.26.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-dns<0.27dev,>=0.26.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: google-cloud-bigquery<0.27dev,>=0.26.0 in c:\anaconda\lib\site-packages (from google.cloud)
Requirement already satisfied: gapic-google-cloud-logging-v2<0.92dev,>=0.91.0 in c:\anaconda\lib\site-packages (from google-cloud-logging<1.3dev,>=1.2.0->google.cloud)
Requirement already satisfied: grpcio<2.0dev,>=1.2.0 in c:\anaconda\lib\site-packages (from google-cloud-logging<1.3dev,>=1.2.0->google.cloud)
Requirement already satisfied: google-gax<0.16dev,>=0.15.7 in c:\anaconda\lib\site-packages (from google-cloud-bigtable<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: gapic-google-cloud-datastore-v1<0.16dev,>=0.15.0 in c:\anaconda\lib\site-packages (from google-cloud-datastore<1.3dev,>=1.2.0->google.cloud)
Requirement already satisfied: gapic-google-cloud-error-reporting-v1beta1<0.16dev,>=0.15.0 in c:\anaconda\lib\site-packages (from google-cloud-error-reporting<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: gapic-google-cloud-pubsub-v1<0.16dev,>=0.15.0 in c:\anaconda\lib\site-packages (from google-cloud-pubsub<0.28dev,>=0.27.0->google.cloud)
Requirement already satisfied: protobuf>=3.0.0 in c:\anaconda\lib\site-packages (from google-cloud-core<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: tenacity<5.0.0dev,>=4.0.0 in c:\anaconda\lib\site-packages (from google-cloud-core<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: requests<3.0.0dev,>=2.4.0 in c:\anaconda\lib\site-packages (from google-cloud-core<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: google-auth<2.0.0dev,>=0.4.0 in c:\anaconda\lib\site-packages (from google-cloud-core<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: googleapis-common-protos>=1.3.4 in c:\anaconda\lib\site-packages (from google-cloud-core<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: six in c:\anaconda\lib\site-packages (from google-cloud-core<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: google-resumable-media>=0.2.3 in c:\anaconda\lib\site-packages (from google-cloud-storage<1.4dev,>=1.3.0->google.cloud)
Requirement already satisfied: gapic-google-cloud-spanner-v1<0.16dev,>=0.15.0 in c:\anaconda\lib\site-packages (from google-cloud-spanner<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: gapic-google-cloud-spanner-admin-database-v1<0.16dev,>=0.15.0 in c:\anaconda\lib\site-packages (from google-cloud-spanner<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: gapic-google-cloud-spanner-admin-instance-v1<0.16dev,>=0.15.0 in c:\anaconda\lib\site-packages (from google-cloud-spanner<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: proto-google-cloud-logging-v2[grpc]<0.92dev,>=0.91.3 in c:\anaconda\lib\site-packages (from gapic-google-cloud-logging-v2<0.92dev,>=0.91.0->google-cloud-logging<1.3dev,>=1.2.0->google.cloud)
Requirement already satisfied: oauth2client<4.0dev,>=2.0.0 in c:\anaconda\lib\site-packages (from gapic-google-cloud-logging-v2<0.92dev,>=0.91.0->google-cloud-logging<1.3dev,>=1.2.0->google.cloud)
Requirement already satisfied: dill<0.3dev,>=0.2.5 in c:\anaconda\lib\site-packages (from google-gax<0.16dev,>=0.15.7->google-cloud-bigtable<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: ply==3.8 in c:\anaconda\lib\site-packages (from google-gax<0.16dev,>=0.15.7->google-cloud-bigtable<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: future<0.17dev,>=0.16.0 in c:\anaconda\lib\site-packages (from google-gax<0.16dev,>=0.15.7->google-cloud-bigtable<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: proto-google-cloud-datastore-v1[grpc]<0.91dev,>=0.90.3 in c:\anaconda\lib\site-packages (from gapic-google-cloud-datastore-v1<0.16dev,>=0.15.0->google-cloud-datastore<1.3dev,>=1.2.0->google.cloud)
Requirement already satisfied: proto-google-cloud-error-reporting-v1beta1[grpc]<0.16dev,>=0.15.3 in c:\anaconda\lib\site-packages (from gapic-google-cloud-error-reporting-v1beta1<0.16dev,>=0.15.0->google-cloud-error-reporting<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: proto-google-cloud-pubsub-v1[grpc]<0.16dev,>=0.15.4 in c:\anaconda\lib\site-packages (from gapic-google-cloud-pubsub-v1<0.16dev,>=0.15.0->google-cloud-pubsub<0.28dev,>=0.27.0->google.cloud)
Requirement already satisfied: grpc-google-iam-v1<0.12dev,>=0.11.1 in c:\anaconda\lib\site-packages (from gapic-google-cloud-pubsub-v1<0.16dev,>=0.15.0->google-cloud-pubsub<0.28dev,>=0.27.0->google.cloud)
Requirement already satisfied: setuptools in c:\anaconda\lib\site-packages\setuptools-23.0.0-py3.5.egg (from protobuf>=3.0.0->google-cloud-core<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: monotonic>=0.6 in c:\anaconda\lib\site-packages (from tenacity<5.0.0dev,>=4.0.0->google-cloud-core<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: cachetools>=2.0.0 in c:\anaconda\lib\site-packages (from google-auth<2.0.0dev,>=0.4.0->google-cloud-core<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: rsa>=3.1.4 in c:\anaconda\lib\site-packages (from google-auth<2.0.0dev,>=0.4.0->google-cloud-core<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: pyasn1-modules>=0.0.5 in c:\anaconda\lib\site-packages (from google-auth<2.0.0dev,>=0.4.0->google-cloud-core<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: pyasn1>=0.1.7 in c:\anaconda\lib\site-packages (from google-auth<2.0.0dev,>=0.4.0->google-cloud-core<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: proto-google-cloud-spanner-v1[grpc]<0.16dev,>=0.15.3 in c:\anaconda\lib\site-packages (from gapic-google-cloud-spanner-v1<0.16dev,>=0.15.0->google-cloud-spanner<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: proto-google-cloud-spanner-admin-database-v1[grpc]<0.16dev,>=0.15.3 in c:\anaconda\lib\site-packages (from gapic-google-cloud-spanner-admin-database-v1<0.16dev,>=0.15.0->google-cloud-spanner<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: proto-google-cloud-spanner-admin-instance-v1[grpc]<0.16dev,>=0.15.3 in c:\anaconda\lib\site-packages (from gapic-google-cloud-spanner-admin-instance-v1<0.16dev,>=0.15.0->google-cloud-spanner<0.27dev,>=0.26.0->google.cloud)
Requirement already satisfied: httplib2>=0.9.1 in c:\anaconda\lib\site-packages (from oauth2client<4.0dev,>=2.0.0->gapic-google-cloud-logging-v2<0.92dev,>=0.91.0->google-cloud-logging<1.3dev,>=1.2.0->google.cloud)
Installing collected packages: google.cloud
Successfully installed google.

then I called the package in Spyder (Python 3.5):

import google.cloud
from google.cloud import translate

I obtained this error:

>Traceback (most recent call last):

>  File "<ipython-input-7-03a1edda6e65>", line 2, in <module>
    from google.cloud import translate

>  File "C:\Anaconda\lib\site-packages\google\cloud\translate.py", line 18, in <module>
    from google.cloud.translate_v2 import __version__

>  File "C:\Anaconda\lib\site-packages\google\cloud\translate_v2\__init__.py", line 19, in <module>
    __version__ = get_distribution('google-cloud-translate').version

>  File "C:\Anaconda\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 535, in get_distribution
    dist = get_provider(dist)

>  File "C:\Anaconda\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 415, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]

>  File "C:\Anaconda\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 943, in require
    needed = self.resolve(parse_requirements(requirements))

>  File "C:\Anaconda\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 834, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)

>ContextualVersionConflict: (pyasn1 0.1.9 (c:\anaconda\lib\site-packages), Requirement.parse('pyasn1==0.3.3'), {'pyasn1-modules'})

Solution

  • I realized it works by:

    pip install google-cloud-translate