I'm having a challenging time getting the Python azure-cosmos library to correctly load for the purposes of locally testing a function in VS Code.
The specific error I'm getting (with the file path shortened) is: Exception: ImportError: cannot import name 'exceptions' from 'azure.cosmos' ([shortened]/.venv/lib/python3.8/site-packages/azure/cosmos/__init__.py)
Things I've checked/tried so far:
- Check that requirements.txt specifies azure-cosmos
- Manually go into python for each of the interpreters available within VS code and ensure I can manually import azure.cosmos
- As instructed here, attempt to reinstall the azure-cosmos library using
pip3
and ensuring the--pre
flag is used. - [Updated] Verified I can successfully
import azure.cosmos.cosmos_client as cosmos_client
without any errors
Any ideas? Thanks! Below is the relevant section of my code.
import datetime
import logging
import tempfile
import requests
import os
import zipfile
import pandas as pd
import azure.functions as func
from azure.cosmos import exceptions, CosmosClient, PartitionKey
def main(mytimer: func.TimerRequest, calendars: func.Out[func.Document]) -> None:
logging.info("Timer function has initiated.")