0

I am having a lot of struggles with getting the Google Cloud Natural Language API running. I am trying to run a Python program on Spyder. I've been trying everything since installed tweepy, nltk, google-cloud-language, python-telegram-bot to upgrade google-cloud-language.

The message that's shown in the console when I start debugging says:

"ImportError: cannot import name 'enums' from 'google.cloud.language' (C:\Users\Name\anaconda3\lib\site-packages\google\cloud\language\__init__.py)"
import tweepy
import re
from telegram.ext import Updater, MessageHandler
from google.cloud.language import enums
from google.cloud.language import types
from datetime import datetime, timedelta
from nltk.tokenize import WordPunctTokenizer

I already tried to modify the code to "from google.cloud.language_v1" still showing the same error.

Inside the "google\cloud\language_init_.py" file I found this. So long story short I have no clue what to do.

from google.cloud.language_v1.services.language_service.async_client import (
    LanguageServiceAsyncClient,
)
from google.cloud.language_v1.services.language_service.client import (
    LanguageServiceClient,
)
from google.cloud.language_v1.types.language_service import AnalyzeEntitiesRequest
from google.cloud.language_v1.types.language_service import AnalyzeEntitiesResponse
from google.cloud.language_v1.types.language_service import (
    AnalyzeEntitySentimentRequest,
)
from google.cloud.language_v1.types.language_service import (
    AnalyzeEntitySentimentResponse,
)
from google.cloud.language_v1.types.language_service import AnalyzeSentimentRequest
from google.cloud.language_v1.types.language_service import AnalyzeSentimentResponse
from google.cloud.language_v1.types.language_service import AnalyzeSyntaxRequest
from google.cloud.language_v1.types.language_service import AnalyzeSyntaxResponse
from google.cloud.language_v1.types.language_service import AnnotateTextRequest
from google.cloud.language_v1.types.language_service import AnnotateTextResponse
from google.cloud.language_v1.types.language_service import ClassificationCategory
from google.cloud.language_v1.types.language_service import ClassifyTextRequest
from google.cloud.language_v1.types.language_service import ClassifyTextResponse
from google.cloud.language_v1.types.language_service import DependencyEdge
from google.cloud.language_v1.types.language_service import Document
from google.cloud.language_v1.types.language_service import EncodingType
from google.cloud.language_v1.types.language_service import Entity
from google.cloud.language_v1.types.language_service import EntityMention
from google.cloud.language_v1.types.language_service import PartOfSpeech
from google.cloud.language_v1.types.language_service import Sentence
from google.cloud.language_v1.types.language_service import Sentiment
from google.cloud.language_v1.types.language_service import TextSpan
from google.cloud.language_v1.types.language_service import Token

__all__ = (
    "AnalyzeEntitiesRequest",
    "AnalyzeEntitiesResponse",
    "AnalyzeEntitySentimentRequest",
    "AnalyzeEntitySentimentResponse",
    "AnalyzeSentimentRequest",
    "AnalyzeSentimentResponse",
    "AnalyzeSyntaxRequest",
    "AnalyzeSyntaxResponse",
    "AnnotateTextRequest",
    "AnnotateTextResponse",
    "ClassificationCategory",
    "ClassifyTextRequest",
    "ClassifyTextResponse",
    "DependencyEdge",
    "Document",
    "EncodingType",
    "Entity",
    "EntityMention",
    "LanguageServiceAsyncClient",
    "LanguageServiceClient",
    "PartOfSpeech",
    "Sentence",
    "Sentiment",
    "TextSpan",
    "Token",
)

0 Answers0