簡體   English   中英

Azure Pipeline 因依賴項沖突而失敗

[英]Azure Pipeline fails with conflicting dependencies

我創建了一個 Azure 函數,並且正在嘗試構建一個 Azure 管道。 管道在安裝應用程序依賴項時失敗,並出現以下錯誤。

ERROR: Cannot install -r requirements.txt (line 8) and azure-storage-blob==2.1.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested azure-storage-blob==2.1.0
    azure-storage-file-datalake 12.7.0 depends on azure-storage-blob<13.0.0 and >=12.12.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict.

下面是安裝依賴項中的代碼。

python -m venv worker_venv
source worker_venv/bin/activate
pip install setuptools
pip install -r  requirements.txt

在我的 requirements.txt 文件中,azure-storage-blob 版本是 2.1.0。 我是否應該刪除 requirements.txt 文件中的版本部分並嘗試運行管道。 有沒有其他方法可以解決這個問題。

謝謝你。

我剛剛刪除了 requirements.txt 文件中的版本,它是成功的。

我是否應該刪除 requirements.txt 文件中的版本部分並嘗試運行管道。 有沒有其他方法可以解決這個問題。

是的,當然您還有其他方法可以解決此問題。 但是您需要確保您的代碼向后兼容,如果您的代碼必須基於 azure-storage-blob 2.1.0 版,那么您不能使用 azure-storage-file-datalake 12.7.0 版。

如果您的代碼與“azure-storage-blob<13.0.0 and >=12.12.0”兼容,則可以在 requirements.txt 文件中指定此范圍內的任何版本。

例如,您可以這樣做:

要求.txt

azure-functions
azure-storage-blob==12.12.0
azure-storage-file-datalake==12.7.0

現在你的直接刪除版本是有效的,因為當前最新版本的 azure-storage-blob 是 12.12.0,可以滿足 azure-storage-file-datalake 12.7.0 的依賴要求:

https://pypi.org/project/azure-storage-blob/12.12.0/#history

但是如果你使用 12.7.0 版本的 azure-storage-file-datalake,近期還是會有版本沖突的。 因為如果不指定版本號,pip工具會默認安裝最新版本。 以后如果azure-storage-blob最新版本大於等於13.0.0,會再次遇到錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM