How to write the requirements.txt file with "–no-binary"?
Question:
I have to install the python package in the following way,
pip install --no-binary=protobuf protobuf
But How to write requirements.txt
with --no-binary=protobuf
?
Answers:
If you want, you can use pip freeze > requirements.txt
after you install the package.
Turning my comment into an answer:
pip
supports reading options from requirement files. This means that a requirements file
protobuf
--no-binary=protobuf
is a valid requirements line, same as e.g. a file consisting out of a single line
protobuf --no-binary=protobuf
This means that you can also reference other requirement files, e.g.
# requirements.txt
-r test_requirements.txt
spam eggs
Note, however, that pip install -r requirements.txt
is roughly equivalent to running cat requirements.txt | xargs pip
, so the options are applied to the whole command and not a single line or file. For example, this file defines conflicting options:
# requirements.txt
spam --no-binary=eggs
bacon --only-binary=eggs
An attempt of installing from this requirements file will lead to an error.
I have to install the python package in the following way,
pip install --no-binary=protobuf protobuf
But How to write requirements.txt
with --no-binary=protobuf
?
If you want, you can use pip freeze > requirements.txt
after you install the package.
Turning my comment into an answer:
pip
supports reading options from requirement files. This means that a requirements file
protobuf
--no-binary=protobuf
is a valid requirements line, same as e.g. a file consisting out of a single line
protobuf --no-binary=protobuf
This means that you can also reference other requirement files, e.g.
# requirements.txt
-r test_requirements.txt
spam eggs
Note, however, that pip install -r requirements.txt
is roughly equivalent to running cat requirements.txt | xargs pip
, so the options are applied to the whole command and not a single line or file. For example, this file defines conflicting options:
# requirements.txt
spam --no-binary=eggs
bacon --only-binary=eggs
An attempt of installing from this requirements file will lead to an error.