'ImportError while importing ToneAnalayzer from ibm_watson

while I tried to import ToneAnalyzerV3 from ibm_watson using the code :

from ibm_watson import ToneAnalyzerV3
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

but its showing:

ImportError: cannot import name 'ToneAnalyzerV3' from 'ibm_watson' (/usr/local/lib/python3.7/dist-packages/ibm_watson/init.py)

while I was installing ibm_watson library there was also another error

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
google-colab 1.0.0 requires requests\~=2.23.0, but you have requests 2.27.1 which is incompatible.
datascience 0.10.6 requires folium==0.2.1, but you have folium 0.8.3 which is incompatible

but when I rerun the cell containing the code

!pip install ibm_watson

it was gone



Solution 1:[1]

I suspect that you have conflicting requirements across different projects.

To avoid conflicts like this leaking across projects, I would recommend isolating each environment using virtualenv or equivalent.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 chughts