Execute the command, export requirements.txt
poetry export -f requirements.txt --output requirements.txt
Each library has a hash encrypted field
Execute the pip install
command
pip3 install --no-cache-dir --upgrade -r requirements.txt
Reported an error
#8 28.40 Collecting websockets==10.0
#8 28.51 Downloading websockets-10.0-cp39-cp39-manylinux2010_x86_64.whl (107 kB)
#8 29.38 Collecting cffi>=1.1
#8 29.38 ERROR: In --require-hashes mode, all requirements must have their versions pinned with ==. These do not:
#8 29.38 cffi>=1.1 from https://files.pythonhosted.org/packages/be/2a/6d266eea47dbb2d872bbd1b8954a2d167668481ff34ebb70ffdd1113eeab/cffi-1.14.6-cp39-cp39-manylinux1_x86_64.whl#sha256=f3ebe6e73c319340830a9b2825d32eb6d8475c1dac020b4f0aa774ee3b898d1c (from bcrypt==3.2.0->-r /code/requirements.txt (line 19))
------
executor failed running [/bin/sh -c pip install --no-cache-dir --upgrade -r /code/requirements.txt]: exit code: 1
Pass this flag in the poetry export command --without-hashes
poetry export --without-hashes -f requirements.txt --output requirements.txt
I’m using this method. I have practiced it and it’s ok. It’s suitable for friends who use poetry.
I haven’t tried the latter scenes
Stop using the pip --contstraints
flag to pass packets with a fixed hash
If you use pip directly, fix it to a version before 20.3
python -m pip install --upgrade pip==20.2.4
If you are using other virtualenv that depends on pip, make sure to fix its version
python -m pip install --upgrade virtualenv==20.0.26
Or use the environment variable VIRTUALENV_PIP=20.2.4