When I try to import CosmosClient from azure.cosmos, I get a ModuleNotFoundError, like the azure-cosmos library was not installed:
$ python3.6 -c "from azure.cosmos import CosmosClient"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'azure.cosmos'
I'm using Linux with Python 3.6 I am trying to import CosmosClient from the azure-cosmos library. I have installed azure-cosmos in version 4.2.0 using python3.6 -m pip install --upgrade azure-cosmos
, then:
$ python3.6 -m pip show azure-cosmos
Name: azure-cosmos
Version: 4.2.0
Summary: Microsoft Azure Cosmos Client Library for Python
Home-page: https://github.com/Azure/azure-sdk-for-python
Author: Microsoft Corporation
Author-email: [email protected]
License: MIT License
Location: /usr/local/lib/python3.6/dist-packages
Requires: six, azure-core
The /usr/local/lib/python3.6/dist-packages
folder is present in sys.path:
$ python3.6 -c "import sys; print([p for p in sys.path])"
['', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/lib/python3/dist-packages']
This is similar to a problem I had yesterday, where a lower version of the library from global dist-packages was shadowing a higher version in local dist-packages, but this time the azure-cosmos package is not installed globally in dist-packages:
$ apt-get remove python3-azure-cosmos
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package python3-azure-cosmos
What am I missing here?