简体   繁体   English

我没有更改我的 Divio 项目中的需求,那么为什么构建会因依赖项冲突而失败?

[英]I have not changed requirements in my Divio project, so why does the build fail with a dependency conflict?

The last time I deployed the project, the build worked perfectly.我上次部署该项目时,构建工作完美。

In the meantime I have changed nothing that would affect the pip requirements, yet I get an error when building:同时,我没有更改任何会影响 pip 要求的内容,但是在构建时出现错误:

Could not find a version that matches Django<1.10,<1.10.999,<1.11,
<1.12,<1.9.999,<2,<2.0,==1.9.13,>1.3,>=1.11,>=1.3,>=1.4,>=1.4.10,
>=1.4.2,>=1.5,>=1.6,>=1.7,>=1.8

I get the same error when building the project locally with docker-compose build web .使用docker-compose build web在本地构建项目时,我遇到了同样的错误。

What could be the problem?可能是什么问题呢?

The problem here is that although you may not have modified any requirements, the dependencies of a project can sometimes change on their own.这里的问题是,尽管可能没有修改任何需求,但项目的依赖项有时会自行更改。

You may even have pinned all of your own requirements (which is generally a good idea) but that still won't help if one of them itself has an unpinned dependency.您甚至可能已经固定了您自己的所有需求(这通常是一个好主意),但是如果其中一个本身具有未固定的依赖项,那仍然无济于事。

Anywhere an unpinned dependency exists, you can run into this.任何存在未固定依赖项的地方,您都可能遇到这种情况。

Here's an example.这是一个例子。 Suppose your requirements.in contains super-django==1.2.4 .假设您的requirements.in包含super-django==1.2.4 That's better than simply specifying super-django , as you won't be taken by surprised if a new, incompatible version of the Super Django package is released.这比简单地指定super-django更好,因为如果发布了新的、不兼容的 Super Django 包版本,您不会感到惊讶。

But suppose that in turn Super Django 1.2.4, in its requirements, lists:但是假设 Super Django 1.2.4 在要求中列出:

Django==1.11
django-super-admin

If a new version of Django Super Admin is released, that requires say Django>=2.0 , your next build will fail because of the mutually exclusive requirements.如果发布了 Django Super Admin 的新版本,这需要说Django>=2.0 ,您的下一个构建将由于相互排斥的要求而失败。

To track down the culprit when you run into such a failure, you need to examine the build logs.要在遇到此类故障时追查罪魁祸首,您需要检查构建日志。 You'll see there something like:你会在那里看到类似的东西:

Could not find a version that matches Django==1.11,>=2.0 [etc].

So now you know to look back through the logs to find what is wanting to install Django>=2.0 , and you'll find:所以现在你知道回顾日志以找到想要安装Django>=2.0 ,你会发现:

adding Django>=2.0
  from django-super-admin==1.7.0

So now you know that it's django-super-admin==1.7.0 that is the key.所以现在你知道django-super-admin==1.7.0是关键。 Since you can't trust super-django to pin the correct version of django-super-admin , you'll have to do it yourself, by adding django-super-admin<1.7.0 to the requirements.in of your project.由于您不能相信super-django会固定正确版本的django-super-admin ,因此您必须自己完成,方法是将django-super-admin<1.7.0到项目的requirements.in中。

There's more information about this at How to identify and resolve a dependency conflict .如何识别和解决依赖冲突中有更多关于此的信息。

You can also Pin all of your project's Python dependencies to ensure this never happens again with any other dependency, though you sacrifice some flexibility for the guarantee.您还可以固定项目的所有 Python 依赖项,以确保任何其他依赖项不会再次发生这种情况,尽管您会为保证牺牲一些灵活性。


Note: I am a member of the Divio team.注意:我是 Divio 团队的成员。 This question is one that we see quite regularly via our support channels.这个问题是我们经常通过我们的支持渠道看到的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的Docker项目的“继续构建”失败了? - Why does “go build” fail for my Docker project? 为什么在运行“docker build”时我的 maven 依赖项获取失败并重置连接? - Why does my maven dependency fetching fail with a connection reset when running `docker build`? 为什么我的Docker构建无法在jenkins代理上失败? - Why does my docker build fail on jenkins agent? Docker:为什么我的项目有一个.env文件? - Docker: Why does my project have a .env file? 为什么我的 GitLab 构建失败并出现错误:“在 $PATH 中找不到可执行文件” - Why does my GitLab build fail with error: “executable file not found in $PATH” 为什么 FROM registry.hub.docker.com/library/centos:centos7 在我的 docker 构建中失败? - Why does FROM registry.hub.docker.com/library/centos:centos7 fail in my docker build? 如何使用docker-compose在Divio Cloud项目中定义其他服务? - How can I define additional services in a Divio Cloud project using docker-compose? 为什么我的自动构建在Docker容器中运行得如此之慢? - Why does my automated build run so slowly inside a Docker container? 当 cython 包含在 requirements.txt 中时,为什么 pyarrow 安装失败并找不到 cython? - Why does pyarrow installation fail with cython not found when cython is included in requirements.txt? 为什么 docker 构建失败:无法解析 Dockerfile:没有说明的文件 - Why does docker build fail with: failed to parse Dockerfile: file with no instructions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM