Avi
Avi

Reputation: 1845

Getting error while using watson_developer_cloud in Jupyter Notebook

I am trying to use Watson Developer in my Jupyter Notebook, but for some reason I am getting error like this.

  This is the import part: 
  import json 
  from watson_developer_cloud import AlchemyLanguageV1 

After this I am getting error like this:

       No module named 'watson_developer_cloud'

I installed Watson Developer cloud using command shell and ANACONDA prompt. This is the command which I used and it installed successfully.

             pip install -I watson-developer-cloud==1.0.0

Do I need to configure any thing to avoid this error in my Jupyter Notebook while importing Watson Developer.

Upvotes: 1

Views: 326

Answers (1)

Simon O'Doherty
Simon O'Doherty

Reputation: 9359

There are a few issues here.

1. The install you can use is:

pip install --upgrade watson-developer-cloud

The current version as of writing this answer is 2.0.1, not version 1.0

2. Alchemy no longer exists. You should be using NLU instead. There is sample code contained within the SDK.

from watson_developer_cloud import NaturalLanguageUnderstandingV1
from watson_developer_cloud.natural_language_understanding_v1 import Features, EntitiesOptions, KeywordsOptions

nlu = NaturalLanguageUnderstandingV1(
    version='2017-02-27',
    username='USERNAME',
    password='PASSWORD')

features = Features(entities=EntitiesOptions(), keywords=KeywordsOptions())

response = nlu.analyze(language='en',
    text='The goal is not to be perfect by the end, the goal is to be better today. - Simon Sinek',
    features=features)

print(response)

You can view the SDK examples here: https://github.com/watson-developer-cloud/python-sdk/blob/master/examples

Upvotes: 2

Related Questions