简体   繁体   English

ERROR RUN pip install -r requirements.txt when using docker-compose up

[英]ERROR RUN pip install -r requirements.txt when using docker-compose up

How should I create and install the requirements.txt file in order to be able to read it properly when running docker-compose up?我应该如何创建和安装 requirements.txt 文件,以便在运行 docker-compose 时能够正确读取它?

Problems when running docker-compose up with the requirements.txt created via pip freeze > requirements.txt使用通过pip freeze > requirements.txt创建的 requirements.txt 运行docker-compose up问题

requirements.txt:要求.txt:

certifi==2021.5.30
charset-normalizer==2.0.3
Django==2.2.5
django-cors-headers==3.7.0
django-rest-framework==0.1.0
djangorestframework==3.12.4
idna==3.2
psycopg2 @ file:///C:/ci/psycopg2_1612298715048/work
python-decouple==3.4
pytz @ file:///tmp/build/80754af9/pytz_1612215392582/work
requests==2.26.0
sqlparse @ file:///tmp/build/80754af9/sqlparse_1602184451250/work
urllib3==1.26.6
wincertstore==0.2

I use anaconda and pip to install packages我使用 anaconda 和pip安装包

The Dockerfile for the backend of my app tries to RUN pip install -r requirements.txt rising the following errors.我的应用程序后端的 Dockerfile 尝试RUN pip install -r requirements.txt出现以下错误。 I could sense the @ packages arise error, but the strangest for me is the first one (#17 1.299) since it seems to be focusing on python-decouple==3.4 as just python.我能感觉到 @ 包出现错误,但对我来说最奇怪的是第一个 (#17 1.299),因为它似乎专注于 python-decouple==3.4,因为它只是 python。

=> ERROR [... 4/5] RUN pip install -r requirements.txt                                 1.8s 
------
> [... 4/5] RUN pip install -r requirements.txt:
#17 1.299 DEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429).
#17 1.345 Collecting certifi==2021.5.30 (from -r requirements.txt (line 1))
#17 1.515 Collecting charset-normalizer==2.0.3 (from -r requirements.txt (line 2))
#17 1.541   Could not find a version that satisfies the requirement charset-normalizer==2.0.3 (from -r requirements.txt (line 2)) (from versions: 0.1a0, 0.1.1a0, 0.1.4b0, 0.1.5b0, 0.1.7, 0.1.8, 0.2.0, 0.2.1, 0.2.2, 0.2.3)
#17 1.544 No matching distribution found for charset-normalizer==2.0.3 (from -r requirements.txt (line 2))
#17 1.708 You are using pip version 19.0.3, however version 19.1.1 is available.
#17 1.708 You should consider upgrading via the 'pip install --upgrade pip' command.```

TL;DR长话短说

Replace charset-normalizer==2.0.3 with chardet>=3.0.2,<5;charset-normalizer==2.0.3替换为chardet>=3.0.2,<5; in requirements.txt.在 requirements.txt 中。 You can choose some specific version to lock version in place aswell.您也可以选择一些特定版本来锁定版本。


I had to set up an old repo recently, faced a similar issue我最近不得不建立一个旧的回购协议,遇到了类似的问题

charset-normalizer was installed by requests which are no longer possible, yet to explore why/how it worked before! charset-normalizer是由不再可能的请求安装的,但要探索它以前工作的原因/方式!

But if you check the requirements of requests==2.26.0 psf/requests:v2.26.0::seup.py但是如果你查看requests==2.26.0 psf/requests:v2.26.0::seup.py的要求

For Python version less than 3 we have to install chardet>=3.0.2,<5;对于Python版本小于3的我们必须安装chardet>=3.0.2,<5; insterd of charset_normalizer~=2.0.0 charset_normalizer~=2.0.0

Errors messages are always helpful, at the least to identify issues origin错误消息总是有帮助的,至少可以确定问题的根源

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

相关问题 运行&#39;pip install -r requirements.txt --upgrade&#39;时出错 - Error when running 'pip install -r requirements.txt --upgrade' RUN pip install -r requirements.txt 不会在 docker 容器中安装需求 - RUN pip install -r requirements.txt does not install requirements in docker container docker-compose up后pip无法安装需求 - pip can not install requirements after docker-compose up 尝试安装requirements.txt时出现“找不到命令&#39;pip&#39;”错误 - Error of "Command 'pip' not found" when trying to install requirements.txt 如何从docker-compose安装requirements.txt? - How can I install requirements.txt from docker-compose? docker-compose 在 requirements.txt 更改时重置 django db - docker-compose resets django db when requirements.txt change 无法安装。 pip install -r requirements.txt - can't install. pip install -r requirements.txt pip install -r requirements.txt [Errno 2] 没有这样的文件或目录:'requirements.txt' - pip install -r requirements.txt [Errno 2] No such file or directory: 'requirements.txt' 为什么在运行“pip install -r requirements.txt”时出现错误“找不到满足要求 scipy==1.5.3 的版本”? - Why do I get error “Could not find a version that satisfies the requirement scipy==1.5.3” when running “pip install -r requirements.txt”? pip install -r requirements.txt安装django而不是升级它 - pip install -r requirements.txt installs django instead of upgading it
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM