Reputation: 83
I am trying to use Azure's computervision API, but I am getting this error:
Traceback (most recent call last):
File "lala.py", line 2, in <module>
from azure.cognitiveservices.vision.computervision import ComputerVisionClient
ModuleNotFoundError: No module named 'azure'
I have installed client library through pip install --upgrade azure-cognitiveservices-vision-computervision
.
I am still getting this error. Any help is welcomed.
Upvotes: 8
Views: 42127
Reputation: 24138
Based on my experience, the issue like yours was normally caused by the name confliction in Python.
Please open a Python interpreter in the current path of your lala.py
file and type the code below to show the path list of packages imported.
import sys
sys.path
# The result should be like as below.
# A virtualenv path on Windows, ['', '<your virtualenv path>\\Scripts\\python37.zip', '<your virtualenv path>\\DLLs', '<your virtualenv path>\\lib', '<your virtualenv path>\\Scripts', 'c:\\python37\\Lib', 'c:\\python37\\DLLs', '<your virtualenv path>', '<your virtualenv path>\\lib\\site-packages']
# A virtualenv path on Linux, ['', '<your virtualenv path>/lib/python36.zip', '<your virtualenv path>/lib/python3.6', '<your virtualenv path>/lib/python3.6/lib-dynload', '/usr/lib/python3.6', '<your virtualenv path>/lib/python3.6/site-packages']
Python will import packages searched from the path listed in order, so please inspect your current path whether there be a directory or file named azure
, then you need to rename the name conflicted one.
For example, I created a virtualenv directory for testing, and I created a directory named azure
with a file __init__.py
in it, then I tried to run my lala.py
file and I got the similar issue with yours, as the figure below.
Upvotes: 8
Reputation: 564
Could you please install via
pip install azure-cognitiveservices-vision-computervision
So without the --upgrade
flag. I know, in the docs they recommend to use the flag but actually this one is for upgrading a already installed package and it seems it is not installed in your environment yet.
Upvotes: 1