Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.64k stars 2.84k forks source link

ImportError: cannot import name 'AbstractSummaryAction' #27663

Closed csaras84 closed 2 years ago

csaras84 commented 2 years ago

Hello, I received an approval to use the gated preview of Azure's Abstractive Summarization and I'm following the sample code from here - https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_abstract_summary.py

However I get an import error:

from azure.ai.textanalytics import ( ImportError: cannot import name 'AbstractSummaryAction'

versions used:

azure-ai-textanalytics 5.2.0b4 azure-common 1.1.28 azure-core 1.24.2

I also tried the --pre version and it still doesn't import 'AbstractSummaryAction'

kristapratico commented 2 years ago

Hi @csaras84, thanks for your issue. The AbstractSummaryAction was not added until the 5.3.0b1 release of the client library. Please try installing this version and let me know if works for you.

pip install azure-ai-textanalytics==5.3.0b1

csaras84 commented 2 years ago

pip install azure-ai-textanalytics==5.3.0b1

This doesn't work, here is the error:

Could not find a version that satisfies the requirement azure-ai-textanalytics==5.3.0b1 (from versions: 1.0.0b1, 1.0.0b2, 1.0.0b3, 1.0.0b4, 1.0.0b5, 1.0.0b6, 1.0.0, 5.0.0, 5.1.0b1, 5.1.0b2, 5.1.0b3, 5.1.0b4, 5.1.0b5, 5.1.0b6, 5.1.0b7, 5.1.0, 5.2.0b1, 5.2.0b2, 5.2.0b3, 5.2.0b4) No matching distribution found for azure-ai-textanalytics==5.3.0b1

Please note I'm using a python virtual environment.

kristapratico commented 2 years ago

@csaras84 which version of Python are you using? azure-ai-textanalytics==5.3.0b1 requires Python 3.7 or greater.

edit: I ask this because the available versions that pip is showing are the ones that still support <3.7.

csaras84 commented 2 years ago

@csaras84 which version of Python are you using? azure-ai-textanalytics==5.3.0b1 requires Python 3.7 or greater.

edit: I ask this because the available versions that pip is showing are the ones that still support <3.7.

Thanks, the version was the issue. It works now, however the results from the 'try out' on language studio and sdk are different. Do I have to raise a different issue for this? I have a story with 6 sentences and no matter what max_sentence_count we provide, with the python sdk I'm getting just a single same sentence as result, while the same yields a different result on the language studio portal 'try out'.

kristapratico commented 2 years ago

@csaras84 glad to hear this was resolved. I'm going to close out this issue since I see you opened a new issue regarding the difference in results. I will respond on that issue https://github.com/Azure/azure-sdk-for-python/issues/27683