Azure Pipeline因依赖冲突而失败



我已经创建了一个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文件中的版本部分吗尝试运行管道。有没有其他方法可以解决这个问题?

是的,当然你有其他的方法来解决这个问题。但是你需要确保你的代码是向后兼容的,如果你的代码必须基于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文件中指定此范围内的任何版本。

例如,可以这样做:

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/历史但是如果你使用12.7.0版本的azure-storage-file-datalake,在不久的将来你仍然会有版本冲突。因为如果您不指定版本号,pip工具将默认安装最新版本。如果将来azure-storage-blob的最新版本大于或等于13.0.0,您将再次遇到错误。

最新更新