-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 'BatchServiceClient' from 'azure.batch' #39676
Comments
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cRui861 @dpwatrous @jingjlii @JJJessieWang @wanghoppe @wiboris. |
Any updates on this? Thanks! |
@ShermanCAA @danchengcaa I'm not able to reproduce this. I created a fresh virtual environment, installed azure-batch==14.2.0, and was able to import the client: krpratic@KRPRATIC:~/azure-sdk-for-python$ pyenv virtualenv 3.10 azurebatch
krpratic@KRPRATIC:~/azure-sdk-for-python$ pyenv activate azurebatch
(azurebatch) krpratic@KRPRATIC:~/azure-sdk-for-python$ pip install azure-batch==14.2.0 --quiet
(azurebatch) krpratic@KRPRATIC:~/azure-sdk-for-python$ python
Python 3.10.0 (default, Feb 12 2025, 10:07:03) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from azure.batch import BatchServiceClient
>>> Can you describe your environment in more detail? |
Hi @ShermanCAA. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue. |
@kristapratico Thank you! Here is our vm settings in azure dev-ops logs. Also we are installing python 3.10.16 on the vm. Let us know if you need anything else. Found tool in cache: Python 3.10.16 x64 2025-02-12T00:02:28.8963944Z ##[section]Starting: Initialize job |
@danchengcaa Given this doesn't reproduce outside the pipeline, I think it would be helpful to do some debug logging in your pipeline to verify that |
@kristapratico I think here might be the problem: on Azure DevOps somehow it was building from a different wheel distribution We are on Microsoft-hosted machines in DevOps so it's harder to debug, but this is what I found by inspecting the module attributes of
so 14.2 (https://github.com/Azure/azure-sdk-for-python/tree/azure-batch_14.2.0/sdk/batch/azure-batch/azure/batch) has BatchServiceClient, but main ( https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/batch/azure-batch/azure/batch) doesn't. Logs show that we are pulling version 14.2 for azure-batch, but is it possible that somehow it got repointed to main in PyPi?
|
@kristapratico I think we found out the root cause. We have a dependency on azure-cli which the latest stable version got installed on 02/10/2025 , https://pypi.org/project/azure-cli/2.69.0/ Here is my steps to replicate locally after running
|
@ShermanCAA @danchengcaa nice investigation! So it seems there is a dependency conflict for azure-batch between the versions that azure-cli and Devops wants? I suggest opening an issue on azure-cli repo and referencing what you found in this issue. |
@kristapratico so is there any plan for official new release of azure-batch, since azure-cli is dependent on the new changes now? |
Can you elaborate what you mean by "official new release" of azure-batch? Do you mean stable release? I would have to tag the owners of the library to answer that question: @cRui861 @dpwatrous @jingjlii @JJJessieWang @wanghoppe @wiboris |
@kristapratico correct stable release for azure-batch, since 15.0.0b1 has been a pre-release version for almost 6 months now but somehow the latest stable release from other packages like azure-cli started depending on it, which is the root cause of this problem |
Describe the bug
Unable to import BatchServiceClient from azure.batch, despite being on a stable version of the package
newest version of azure-cli is depending on a pre-release version of azure-batch, which causes discrepancies when both packages are present
Full stack trace
To Reproduce
Steps to reproduce the behavior:
from azure.batch import BatchServiceClient
Expected behavior
BatchServiceClient should be imported and dependency resolved
Screenshots
Additional context
The text was updated successfully, but these errors were encountered: