I am trying to use the microsoft azure custom vision service on a mac from Jupyter in VS Code
I have Python 3.8.3 installed.
I have done pip install azure.cognitiveservices.vision.customvision and confirmed it is there using pip show.
When I execute the command from azure.cognitiveservices.vision.customvision.prediction import CustomVisionPredictionClient
I get the error:
ModuleNotFoundError: No module named 'azure.cognitiveservices.vision.customvision'
I have tried adding the location where the package is installed to $PATH but that does not fix the problem.
Any thoughts gratefully received! thx
It is recommended that you always create and activate a python virtual environment to work with Jupyter notebooks, like an Anaconda environment, or any other environment in which you've installed the Jupyter package.
To select an environment, use the Python: Select Interpreter command from the Command Palette (
Ctrl+Shift+P
). Once the appropriate environment is activated, you can create and open a Jupyter Notebook and connect to a remote Jupyter server for running code cells. Check Working with Jupyter Notebooks in Visual Studio Code for more info.This is true for application development in Python in general as well.
A virtual environment is a folder within a project that isolates a copy of a specific Python interpreter. Once you activate that environment (which Visual Studio Code does automatically), running
pip install
installs a library into that environment only.When you then run your Python code, it runs in the environment's exact context with specific versions of every library. You can create a
requirements.txt
file for the libraries you need, then usepip install -r requirements.txt
.Here is a snippet from a sample requirements.txt file:
If you don't use a virtual environment, then Python runs in its global environment that is shared by any number of projects.
Refer to the Azure SDK for Python Developer docs for more information on configuring your local Python dev environment for Azure.