Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'KeyVault' #13359

Closed
AkhilA4 opened this issue Aug 27, 2020 · 2 comments
Closed

ImportError: cannot import name 'KeyVault' #13359

AkhilA4 opened this issue Aug 27, 2020 · 2 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. KeyVault question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@AkhilA4
Copy link

AkhilA4 commented Aug 27, 2020

database001-01:/home/azureuser # python
Python 2.7.13 (default, Jan 11 2017, 10:56:06) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import azure.keyvault
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named keyvault
>>> import azure.keyvault.secrets
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named keyvault.secrets
>>> import azure.keyvault.secret
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named keyvault.secret
>>> exit()

We ran into a similar issue: #8591 and then upgarded the azure-keyvault to 4.1.0. Tried importing the azure.keyvault but running into the importError. We need SecretClient library for accessing our key vault which should be imported from azure.keyvault.secrets. We used this documentation for reference: key vault documentation.

Here is the list of packages we installed

database001-01:/home/azureuser # pip freeze | grep azure
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
azure==4.0.0
azure-applicationinsights==0.1.0
azure-batch==4.1.3
azure-common==1.1.25
azure-core==1.8.0
azure-cosmosdb-nspkg==2.0.2
azure-cosmosdb-table==1.0.6
azure-datalake-store==0.0.48
azure-eventgrid==1.3.0
azure-graphrbac==0.40.0
azure-identity==1.4.0
azure-keyvault==4.1.0
azure-keyvault-certificates==4.2.0
azure-keyvault-keys==4.2.0
azure-keyvault-nspkg==1.0.0
azure-keyvault-secrets==4.2.0
azure-loganalytics==0.1.0
azure-mgmt==4.0.0
azure-mgmt-advisor==1.0.1
azure-mgmt-applicationinsights==0.1.1
azure-mgmt-authorization==0.50.0
azure-mgmt-batch==5.0.1
azure-mgmt-batchai==2.0.0
azure-mgmt-billing==0.2.0
azure-mgmt-cdn==3.1.0
azure-mgmt-cognitiveservices==3.0.0
azure-mgmt-commerce==1.0.1
azure-mgmt-compute==4.6.2
azure-mgmt-consumption==2.0.0
azure-mgmt-containerinstance==1.5.0
azure-mgmt-containerregistry==2.8.0
azure-mgmt-containerservice==4.4.0
azure-mgmt-cosmosdb==0.4.1
azure-mgmt-datafactory==0.6.0
azure-mgmt-datalake-analytics==0.6.0
azure-mgmt-datalake-nspkg==3.0.1
azure-mgmt-datalake-store==0.5.0
azure-mgmt-datamigration==1.0.0
azure-mgmt-devspaces==0.1.0
azure-mgmt-devtestlabs==2.2.0
azure-mgmt-dns==2.1.0
azure-mgmt-eventgrid==1.0.0
azure-mgmt-eventhub==2.6.0
azure-mgmt-hanaonazure==0.1.1
azure-mgmt-iotcentral==0.1.0
azure-mgmt-iothub==0.5.0
azure-mgmt-iothubprovisioningservices==0.2.0
azure-mgmt-keyvault==1.1.0
azure-mgmt-loganalytics==0.2.0
azure-mgmt-logic==3.0.0
azure-mgmt-machinelearningcompute==0.4.1
azure-mgmt-managementgroups==0.1.0
azure-mgmt-managementpartner==0.1.1
azure-mgmt-maps==0.1.0
azure-mgmt-marketplaceordering==0.1.0
azure-mgmt-media==1.0.0
azure-mgmt-monitor==0.5.2
azure-mgmt-msi==0.2.0
azure-mgmt-network==2.7.0
azure-mgmt-notificationhubs==2.1.0
azure-mgmt-nspkg==3.0.2
azure-mgmt-policyinsights==0.1.0
azure-mgmt-powerbiembedded==2.0.0
azure-mgmt-rdbms==1.9.0
azure-mgmt-recoveryservices==0.3.0
azure-mgmt-recoveryservicesbackup==0.3.0
azure-mgmt-redis==5.0.0
azure-mgmt-relay==0.1.0
azure-mgmt-reservations==0.2.1
azure-mgmt-resource==2.2.0
azure-mgmt-scheduler==2.0.0
azure-mgmt-search==2.1.0
azure-mgmt-servicebus==0.5.3
azure-mgmt-servicefabric==0.2.0
azure-mgmt-signalr==0.1.1
azure-mgmt-sql==0.9.1
azure-mgmt-storage==2.0.0
azure-mgmt-subscription==0.2.0
azure-mgmt-trafficmanager==0.50.0
azure-mgmt-web==0.35.0
azure-nspkg==3.0.2
azure-servicebus==0.21.1
azure-servicefabric==6.3.0.0
azure-servicemanagement-legacy==0.20.7
azure-storage-blob==1.5.0
azure-storage-common==1.4.2
azure-storage-file==1.4.0
azure-storage-nspkg==3.1.0
azure-storage-queue==1.4.0
msrestazure==0.6.3
tdc-azure-all==8.1.0
tdc-azure-misc==2.0.0

Could someone please help us.

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Aug 27, 2020
@AkhilA4 AkhilA4 changed the title ImportError: cannot import name 'KeyVaultClient' ImportError: cannot import name 'KeyVault' Aug 27, 2020
@kaerm kaerm added Client This issue points to a problem in the data-plane of the library. KeyVault labels Aug 27, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 27, 2020
@iscai-msft
Copy link
Contributor

@AkhilA4 it has to do with the fact that you have the "azure" and "azure-keyvault" modules installed as well. Actually, when I went to install "azure-keyvault", pip threw an error (though it stil installed 4.1.0) that azure requires "azure-keyvault" version ~=1.0. I tried removing the "azure" and "azure-keyvault" modules, but that doesn't appear to be enough to clear it up. My solution is to create a new virtual environment, and just install "azure-keyvault-certificates", "azure-keyvault-secrets", and "azure-keyvault-keys", i.e. pip install azure-keyvault-keys azure-keyvault-secrets azure-keyvault-certificates (assuming you want all of the keyvault libraries)

@AkhilA4
Copy link
Author

AkhilA4 commented Aug 28, 2020

@iscai-msft , thanks for the response. We decided to stick with the azure-keyvault version 1.1.0 for now and we are able to import keyVaultClient comfortably. Closing the issue.

@AkhilA4 AkhilA4 closed this as completed Aug 28, 2020
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Apr 1, 2021
Merge Dev-containerservice-microsoft.containerservice-2021-03-01 API to master  (Azure#13737)

* Adds base for updating Microsoft.ContainerService from version stable/2021-02-01 to version 2021-03-01

* Updates readme

* Updates API version in new specs and examples

* fix the top swagger offenses caused by privateLinkResources, enableCSIProxy and OSDiskSize range (Azure#13349)

Co-authored-by: Charlie Li <charlili@microsoft.com>

* Add enableFIPS property to 2021-03-01 API in dev 2021-03-01 branch (Azure#13359)

* fix the top swagger offenses caused by privateLinkResources, enableCSIProxy and OSDiskSize range

* Add enableFIPS property to the 2021-03-01 API

* Add enableFIPS property to the 2021-03-01 API

Co-authored-by: Charlie Li <charlili@microsoft.com>

* adding node-image upgrade channel enum (Azure#13375)

Co-authored-by: Charlie McBride <Charlie.McBride@microsoft.com>

* Add httpProxyConfig specs to 2021-03-01 API - dev (Azure#13410)

* Add httpProxyConfig specs to 2021-03-01 API - dev

* Fix prettier

* aks: add `bindingSelector` to managed cluster pod identity profile (Azure#13399)

* AKS runCommand new feature  (Azure#13420)

* runCommand target to 03-01

* fix api-version in examples

* Add property disableLocalAccounts to 2021-03-01 API version (Azure#13385)

* Add property disableLocalAccounts

* Fix indentation

* Add OSSKU and GPUInstanceProfile to containerservice/microsoft.container API 2021-03-01 (Azure#13532)

* Add OSSKU and GPUInstanceProfile

* Add sample for OSSKU and GPUInstanceProfile

* Fix custom words

* Reference sample files

* update custom-words

* Update readme for sdks  (Azure#13515)

* update readme for sdks

* update readme for sdks

Co-authored-by: Charlie Li <charlili@microsoft.com>

* Add example to create agent pool with FIPS enabled (Azure#13557)

* add example to create agent pool with FIPS enabled

* change a property name in the example file

Co-authored-by: Charlie Li <charlili@microsoft.com>

* Added extended location parameter to managed cluster which will target all agent pools to that extended location. (Azure#13560)

* Add data model for get OS options. (Azure#13619)

* Add data model for get OS options.

* Add default resource name in API path.

* Fix container service tags. (Azure#13739)

Co-authored-by: Tongyao Si <tosi@microsoft.com>
Co-authored-by: Charlie Li <charlili@microsoft.com>
Co-authored-by: Charlie McBride <33269602+charliedmcb@users.noreply.github.com>
Co-authored-by: Charlie McBride <Charlie.McBride@microsoft.com>
Co-authored-by: Bo Wang <61758179+bowang-666@users.noreply.github.com>
Co-authored-by: hbc <bcxxxxxx@gmail.com>
Co-authored-by: Haitao Chen <haitch@users.noreply.github.com>
Co-authored-by: Tony Xu <tonyxu@microsoft.com>
Co-authored-by: Mirza Sikander <mirsik@microsoft.com>
Co-authored-by: Jun Sun <33297523+JunSun17@users.noreply.github.com>
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Apr 1, 2021
Merge Dev-containerservice-microsoft.containerservice-2021-03-01 API to master  (Azure#13737)

* Adds base for updating Microsoft.ContainerService from version stable/2021-02-01 to version 2021-03-01

* Updates readme

* Updates API version in new specs and examples

* fix the top swagger offenses caused by privateLinkResources, enableCSIProxy and OSDiskSize range (Azure#13349)

Co-authored-by: Charlie Li <charlili@microsoft.com>

* Add enableFIPS property to 2021-03-01 API in dev 2021-03-01 branch (Azure#13359)

* fix the top swagger offenses caused by privateLinkResources, enableCSIProxy and OSDiskSize range

* Add enableFIPS property to the 2021-03-01 API

* Add enableFIPS property to the 2021-03-01 API

Co-authored-by: Charlie Li <charlili@microsoft.com>

* adding node-image upgrade channel enum (Azure#13375)

Co-authored-by: Charlie McBride <Charlie.McBride@microsoft.com>

* Add httpProxyConfig specs to 2021-03-01 API - dev (Azure#13410)

* Add httpProxyConfig specs to 2021-03-01 API - dev

* Fix prettier

* aks: add `bindingSelector` to managed cluster pod identity profile (Azure#13399)

* AKS runCommand new feature  (Azure#13420)

* runCommand target to 03-01

* fix api-version in examples

* Add property disableLocalAccounts to 2021-03-01 API version (Azure#13385)

* Add property disableLocalAccounts

* Fix indentation

* Add OSSKU and GPUInstanceProfile to containerservice/microsoft.container API 2021-03-01 (Azure#13532)

* Add OSSKU and GPUInstanceProfile

* Add sample for OSSKU and GPUInstanceProfile

* Fix custom words

* Reference sample files

* update custom-words

* Update readme for sdks  (Azure#13515)

* update readme for sdks

* update readme for sdks

Co-authored-by: Charlie Li <charlili@microsoft.com>

* Add example to create agent pool with FIPS enabled (Azure#13557)

* add example to create agent pool with FIPS enabled

* change a property name in the example file

Co-authored-by: Charlie Li <charlili@microsoft.com>

* Added extended location parameter to managed cluster which will target all agent pools to that extended location. (Azure#13560)

* Add data model for get OS options. (Azure#13619)

* Add data model for get OS options.

* Add default resource name in API path.

* Fix container service tags. (Azure#13739)

Co-authored-by: Tongyao Si <tosi@microsoft.com>
Co-authored-by: Charlie Li <charlili@microsoft.com>
Co-authored-by: Charlie McBride <33269602+charliedmcb@users.noreply.github.com>
Co-authored-by: Charlie McBride <Charlie.McBride@microsoft.com>
Co-authored-by: Bo Wang <61758179+bowang-666@users.noreply.github.com>
Co-authored-by: hbc <bcxxxxxx@gmail.com>
Co-authored-by: Haitao Chen <haitch@users.noreply.github.com>
Co-authored-by: Tony Xu <tonyxu@microsoft.com>
Co-authored-by: Mirza Sikander <mirsik@microsoft.com>
Co-authored-by: Jun Sun <33297523+JunSun17@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. KeyVault question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

3 participants