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.
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
Related
I have several imports in my current code:
from flask import Flask
import datetime as dt
import numpy as np
import pandas as pd
When I run this in VSCODE I am getting this error:
However, running this in jupyter notebook has no problems. When I looked online it said to use python interpreter but when I go to do that I get this error:
And another error:
Anaconda prompt says modules/packages are installed but when I run pip install in default windows terminal it says pip has no module:
Delete and reinstall Python extensions according to the same problem on github.
The second problem is related to the location of your Python interpreter. You need to choose the correct interpreter. I still recommend using one Python version in one environment. You can use other Python versions in virtual environment, so it won't lead to confusion.
I have made a Python 3 translator, but it shows an error when I run it. This is the code I have used:
from translate import Translator
s = Translator(from_lang=input('From.Language:'), to_lang=input('To.Language:'))
res = s.translate(input('Write your text: '))
print('res')
The error is (screenshot):
ModuleNotFoundError: No module named 'translate'
How can I fix this on an Android phone? I am using Pydroid3.
The error is because the module is not installed in device. Before performing a Python project execution you should first install the package or pip from internet. For example for this question we need translate pip which will help you to run this project. You can first install pip in your device then can run the project for more read official document
I am trying to gather a list of users that follow a specific main user using twint in pycharm. I keep getting these errors when I run my code though.
CRITICAL:root:twint.get:User:'NoneType' object is not subscriptable
CRITICAL:root:twint.feed:Follow:IndexError
Here is my code:
import twint
import nest_asyncio
nest_asyncio.apply()
c = twint.Config()
c.Username = "brendan_webdev"
c.Followers = True
c.Resume = "resume.txt"
c.Output = "testing.csv"
twint.run.Following(c)
I have no idea why this isn't running. All the tutorials I have seen have had almost this exact code and seemed to work.
I also tried running command line for twint, but my machine won't recognize that twint exists on it.
I tried running this in command line as a test, after pip installing twint and cloning the repository.
twint -u "brendan_webdev"
Nothing seems to work. I have no idea why either.
Any help is appreciated!
Note: I am running Python 3.9 btw.
The error you are getting seems to be related to the version of twint that you are using.
Upgrade to the latest version using this command:
pip3 install --upgrade -e git+https://github.com/twintproject/twint.git#origin/master#egg=twint
This fixed the error for me.
I'm tyring to import wolfamalpha into my code but it gives a error saying:
ModuleNotFoundError: No module named 'wolframalpha'
I tried installing it with pip install wolframalpha, but it still doesn't work.
Here is my code:
import wolframalpha
client = wolframalpha.Client('*************')
When you run your python file, are you sure that you are using the correct python interpreter that you performed the pip install wolframalpha to? It sounds like you may have multiple versions of python on your machine and there is a mismatch. If you are using VSCode, it is easy to see which interpreter is running on the bottom of the screen, which may help you debug the issue.
Trying to access the todoist api, and I copied some code from the api documentation. However, on my system I get an error stating:
Unable to import 'todoist.api'pylint(import-error).
I installed it with:
pip install todoist-python
as mentioned in the documentation
from todoist.api import TodoistAPI
I get my error on the very first line. How do I not get this?
You did everything right, so it's probably related to the way your installation is set.
Be sure you are using the same python you used to install the library. Check if the library is installed (pip list) and check if you're using the right Python when running the code. It's possible that the library was installed in one version and you're using the other.
I had the same problem, I solved it by following the GitHub instructions, but the name of the module to install using pip is todoist.