Re: google.cloud.language import enums ImportError: cannot import name 'enums'

2,165 views
Skip to first unread message
Message has been deleted

Mona Attariyan

unread,
Jun 8, 2018, 1:25:42 AM6/8/18
to sde, Luke Sneeringer, cloud-nl-discuss
+Luke

On Thu, Jun 7, 2018 at 1:46 PM, sde <searchd...@gmail.com> wrote:

 Hello,
I would like to use Google Cloud NLP API


I have this as result
  Traceback (most recent call last):
  File "google.py", line 2, in <module>
    from google.cloud import language
  File "/home/aa/anaconda3/lib/python3.6/site-packages/google/cloud/language.py", line 17, in <module>
    from google.cloud.language_v1 import LanguageServiceClient
  File "/home/aa/anaconda3/lib/python3.6/site-packages/google/cloud/language_v1/__init__.py", line 17, in <module>
    from google.cloud.language_v1 import types
  File "/home/aa/anaconda3/lib/python3.6/site-packages/google/cloud/language_v1/types.py", line 18, in <module>
    from google.api_core.protobuf_helpers import get_messages
  File "/home/aa/anaconda3/lib/python3.6/site-packages/google/api_core/__init__.py", line 20, in <module>
    from pkg_resources import get_distribution
  File "/home/aa/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3095, in <module>
    @_call_aside
  File "/home/aa/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3079, in _call_aside
    f(*args, **kwargs)
  File "/home/aa/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3123, in _initialize_master_working_set
    for dist in working_set
  File "/home/aa/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3123, in <genexpr>
    for dist in working_set
  File "/home/aa/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2633, in activate
    declare_namespace(pkg)
  File "/home/aa/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2170, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/home/aa/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2105, in _handle_ns
    loader.load_module(packageName)
  File "/home/aa/rn/scripts/google.py", line 3, in <module>
    from google.cloud.language import enums
ImportError: cannot import name 'enums'

I will appreciate any help.

Thanks



--
You received this message because you are subscribed to the Google Groups "cloud-nl-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-nl-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to cloud-nl-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-nl-discuss/13cb44b6-0988-40cb-9d46-6f883bdcceb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luke Sneeringer

unread,
Jun 8, 2018, 12:56:32 PM6/8/18
to Mona Attariyan, sde, cloud-nl-discuss
I can look into it more shortly, but what happens if the file is renamed to something other than google.py?
Python 3.6 is much better than previous versions about doing the right thing, but you do sometimes get into strange situations when import paths are ambiguous, and I note that the traceback is coming from within pkg_resources.

To unsubscribe from this group and stop receiving emails from it, send an email to cloud-nl-discu...@googlegroups.com.
To post to this group, send email to cloud-nl...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages