Skip to content

Conversation

@mhucka
Copy link
Member

@mhucka mhucka commented Dec 23, 2025

This PR updates the dependencies in requirements.in and setup.py as follows:

  • Drop support for Python 3.9 (which was end-of-lifed last year)
  • Update the requirements to try to reduce them to the minimum

This PR also updates scripts/generate_requirements.sh to remove some no-longer-needed post-processing of the requirements.txt file. The modified script still needs to have one special case, to avoid pinning the version of PyYAML. PyYAML is a transitive dependency that, in older Pythons, was installed via distutils and not pip. Pinning the version (as pip-compile would normally do) causes pip to try to uninstall any existing versions of pyyaml in the environment, and fail, because pip didn't install it in the first place. The most robust solution I've found is to avoid pinning the version. Previously this was accomplished in scripts/generate_requirements.sh by editing the output using sed (ugh – my bad). This update uses pip-compile's feature for "unsafe" packages to simply leave pyyaml out of requirements.txt.

This adds additional version constraints on dependencies that are
necessary to generate a requirements.txt file that works with TensorFlow
2.16.2 and tf-keras.
The python_version actually means the constraint only applies to that
Python version. We need the packages installed no matter the Python
version; we just need the constraint on Python < 3.11.

It's simpler and still works to not add the python_version, so let's
just remove them.
This is the output of running pip-compile on requirements.in.
This adds more constraints so that the result works on Python 3.9.
This version works with Python 3.9.
@mhucka mhucka marked this pull request as ready for review December 24, 2025 02:47
@mhucka mhucka changed the title Further constrain requirements to support Python 3.9 Further constrain dependency versions in order to support Python 3.9 Dec 26, 2025
@mhucka mhucka changed the title Further constrain dependency versions in order to support Python 3.9 Further constrain versions of dependencies in requirements.txt in order to support Python 3.9 Dec 28, 2025
@mhucka mhucka changed the title Further constrain versions of dependencies in requirements.txt in order to support Python 3.9 Constrain dependency versions in requirements.txt for Python 3.9 & add script to generate requirements.txt Dec 30, 2025
After other changes in this script, using `set -eo pipefail` turns out
to be unnecessary. Let's go back to what was there before to slightly
reduce the noise in the diff.
@mhucka mhucka changed the title Constrain dependency versions in requirements.txt for Python 3.9 & add script to generate requirements.txt Update dependencies and add script to generate requirements.txt from requirements.in Jan 30, 2026
@mhucka mhucka changed the title Update dependencies and add script to generate requirements.txt from requirements.in Update requirements and add script to generate requirements.txt Jan 31, 2026
@mhucka mhucka changed the title Update requirements and add script to generate requirements.txt Update requirements and scripts/generate_requirements.sh Jan 31, 2026
The PyYAML library causes a lot of problems at `pip install` time; on
some python & platform combos, it tries to uninstall an existing pyyaml
that comes with the distutils package, and fails, with the result that
the whole installation fails. Pyyaml is a transitive dependency brought
in by something else and not something TFQ needs. The best solution I
can come up with is to use pip-compile's feature for "unsafe" packages
to leave pyyaml out of requirements.txt.
This removes more constraints and tries to reduce things to the minimum
I can get to work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant