uv icon indicating copy to clipboard operation
uv copied to clipboard

`uv pip compile|install` can't handle `--no-binary lxml` option in requirements file

Open sergei-maertens opened this issue 1 year ago • 5 comments

This obviously works on pip + pip-tools which we use.

Our relevant base.in:

# other dependencies

# see https://github.com/onelogin/python3-saml/issues/292 and
# https://bugs.launchpad.net/lxml/+bug/1960668 -> we can avoid this by compiling lxml
# against the system libxml2
--no-binary lxml
lxml

# other dependencies

which results in the base.txt:

#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    ./bin/compile_dependencies.sh
#
--no-binary lxml

# ... actual dependencies

pip-tools can produce this file, but uv pip compile doesn't understand this option:

(open-forms) ➜  open-forms git:(chore/1052-remove-defusedxml) uv pip compile requirements/base.in                 
error: Unexpected '-', expected '-c', '-e', '-r' or the start of a requirement in `requirements/base.in` at position 306

Details

Repository is https://github.com/open-formulieren/open-forms so you can take a look at the requirements files yourself (and the ./bin/compile_dependencies.sh script).

$ python --version
Python 3.10.13
$ uv --version
uv 0.1.2

Running in a pre-existing virtualenv.

sergei-maertens avatar Feb 16 '24 09:02 sergei-maertens

I should've searched better, this is related to #1332 and #977

sergei-maertens avatar Feb 16 '24 09:02 sergei-maertens

Ah yeah, I think this is a separate issue. We don't support all flags in requirements.txt, only a subset. We could consider adding this one.

charliermarsh avatar Feb 16 '24 14:02 charliermarsh

+1

All my projects with postgres I use a smaller lib from psycopg2 and uv doesn't support --no-binary yet

psycopg2==2.9.9 --no-binary psycopg2

felipewove avatar Feb 16 '24 15:02 felipewove

@felipewove -- Just to clarify, we do support --no-binary on the command-line, like uv pip install psycopg2==2.9.9 --no-binary psycopg2. We just don't support it within a requirements file yet.

charliermarsh avatar Feb 16 '24 15:02 charliermarsh

@charliermarsh got it, thanks!

I have it automated on my containers, so I'll make some workaround just for some env to test UV ;)

felipewove avatar Feb 16 '24 16:02 felipewove

Hi is there any update on supporting --no-binary in a requirements file?

feelmyears avatar Mar 26 '24 22:03 feelmyears

I can probably add support for this, it's come up multiple times now.

charliermarsh avatar Mar 26 '24 22:03 charliermarsh