I am trying to run few ML scripts using Azure pipeline on Azure ML studio. I have created a new ML environment with all the required dependencies as well but am facing a issue as below.
ModuleNotFoundError: No module named 'azure.keyvault'.
Things I have tried till now
pip install azure-keyvault-secrets
in the script section.Somehow the module azure-keyvault-secrets couldnt be found by my code even though it is the same environment. Please help
My Azure env's conda.yml file is as below
channels:
- anaconda
- conda-forge
dependencies:
- python=3.8.13
- pip:
- azureml-defaults~=1.51.0
- azureml-dataprep[pandas]
- azure-storage-blob
- pyarrow
- xlrd
- openpyxl
- pyyaml
- tqdm
- catboost
- pickle-mixin
- azure-keyvault-secrets
- scikit-learn
- ipykernel
- matplotlib
- pandas
- pip
- xlrd
- joblib
- tqdm
- time
name: project_ml
Python 3.8 is the minimum Python version supported by the package azure-keyvault-secrets
(see here). However, Python 3.8 is a quite older version and might have problem when running with the latest version of azure-keyvault-secrets
.
You can try to upgrade the Python version to the latest Python 3.12, then try the module again in your project.
In Azure DevOps pipelines, you can use the UsePythonVersion@0
task to install a specified Python version.
variables:
PythonVersion: '3.12'
steps:
- task: UsePythonVersion@0
displayName: 'Install Python v$(PythonVersion)'
inputs:
versionSpec: '$(PythonVersion)'
- script: |
pip install azure-keyvault-secrets
displayName: 'Install module azure.keyvault'
In addition, you also can use pip
to install the package "azure-keyvault
", it installs the following packages for Azure Key Vault: