Need some help with how python dependency version ...
# general
q
Need some help with how python dependency version resolution works. I am trying to run the
pants generate-lockfiles
command with python 3.9.18. But it is unable to resolve a dependency (
streamlit==1.33.0
) with constraints
!=3.9.7,>=3.8
.
Copy code
20:48:17.01 [ERROR] 1 Exception encountered:

Engine traceback:
  in `generate-lockfiles` goal

ProcessExecutionFailure: Process 'Generate lockfile for admin-app' failed with exit code 1.
stdout:

stderr:
pid 55212 -> /Users/narayan/.cache/pants/named_caches/pex_root/venvs/92715abbc7640feaf0b8be192084ece3fca91484/b6666a4144c9ea79f8daae007a4753439fcb6373/bin/python -sE /Users/narayan/.cache/pants/named_caches/pex_root/venvs/92715abbc7640feaf0b8be192084ece3fca91484/b6666a4144c9ea79f8daae007a4753439fcb6373/pex --disable-pip-version-check --no-python-version-warning --exists-action a --no-input --isolated -q --cache-dir /Users/narayan/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache --log /private/var/folders/lr/brx1l80d1j514d6wk0lx723c0000gn/T/pants-sandbox-PfCXs0/.tmp/pex-pip-log.ccf880ps/pip.log download --dest /private/var/folders/lr/brx1l80d1j514d6wk0lx723c0000gn/T/pants-sandbox-PfCXs0/.tmp/tmpsyd9khuz/usr.local.Cellar.python@3.9.3.9.18_1.Frameworks.Python.framework.Versions.3.9.bin.python3.9 Cython>=0.29.33 PyPDF2==3.0.1 adapter-transformers<3.3,>=3.2 altair==4.2.2 bert-score==0.3.7 boto3>=1.24.48 datasets<2.11,>=2.10 dawg2==0.11.1 elasticsearch==7.9.0 envyaml==1.10.211231 flair huggingface_hub==0.15.1 jsonlines==3.1.0 meerkat-ml==0.2.4 minsky-lab==0.0.7 mlflow<3,>=2.9.2 nltk>=3.4.5 oauth2client==4.1.3 openai==0.26.5 openpyxl==3.1.2 pandas<2.0 qa==0.1.3 ranx<0.4,>=0.3; sys_platform != "darwin" rbo>=0.1.3 rouge-score==0.0.4 schema==0.7.5 sentencepiece>=0.1.97 spacy-pkuseg<0.1.0,>=0.0.27 spacy-streamlit==1.0.6 spaczz==0.6.0 st-annotated-text==4.0.0 stanza streamlit-agraph==0.0.45 streamlit-chat==0.0.2.1 streamlit-keyup==0.2.0 streamlit-pills@ git+<https://github.com/cceyda/streamlit-pills@multiselect_release#egg=streamlit-pills> streamlit-searchbox<=0.1.3 streamlit-tags==1.2.8 streamlit==1.33.0 tabulate==0.8.10 tomotopy==0.12.5 toolz==0.11.1 tqdm<5,>=4.65 typer<0.5,>=0.4 typesense==0.17.0 uuid==1.30 weaviate-client==3.24.1 word2number==1.1 --index-url <https://pypi.org/simple/> --extra-index-url http://{USER}:{PWD}@{URL}:8081/repository/pypi/simple --trusted-host {USER}:{PWD}@{URL}:8081 --retries 5 --timeout 15 exited with 1 and STDERR:
ERROR: Ignored the following versions that require a different python version: 0.1.1 Requires-Python >=3.7, !=3.9.7; 0.1.2 Requires-Python >=3.7, !=3.9.7; 0.1.3 Requires-Python >=3.7, !=3.9.7; 0.1.4 Requires-Python >=3.7, !=3.9.7; 0.1.5 Requires-Python >=3.7, !=3.9.7; 0.1.6 Requires-Python >=3.7, !=3.9.7; 0.1.7 Requires-Python >=3.7, !=3.9.7; 0.1.8 Requires-Python >=3.8, !=3.9.7; 0.55.2 Requires-Python <3.5; 1.12.1 Requires-Python >=3.7, !=3.9.7; 1.12.1rc1 Requires-Python >=3.7, !=3.9.7; 1.12.2 Requires-Python >=3.7, !=3.9.7; 1.12.2rc1 Requires-Python >=3.7, !=3.9.7; 1.12.2rc2 Requires-Python >=3.7, !=3.9.7; 1.13.0 Requires-Python >=3.7, !=3.9.7; 1.13.0rc1 Requires-Python >=3.7, !=3.9.7; 1.13.0rc2 Requires-Python >=3.7, !=3.9.7; 1.14.0 Requires-Python >=3.7, !=3.9.7; 1.14.0rc1 Requires-Python >=3.7, !=3.9.7; 1.14.1 Requires-Python >=3.7, !=3.9.7; 1.14.1rc1 Requires-Python >=3.7, !=3.9.7; 1.15.0 Requires-Python >=3.7, !=3.9.7; 1.15.1 Requires-Python >=3.7, !=3.9.7; 1.15.2 Requires-Python >=3.7, !=3.9.7; 1.15.2rc1 Requires-Python >=3.7, !=3.9.7; 1.16.0 Requires-Python >=3.7, !=3.9.7; 1.17.0 Requires-Python >=3.7, !=3.9.7; 1.18.0 Requires-Python >=3.7, !=3.9.7; 1.18.1 Requires-Python >=3.7, !=3.9.7; 1.18.1rc1 Requires-Python >=3.7, !=3.9.7; 1.19.0 Requires-Python >=3.7, !=3.9.7; 1.20.0 Requires-Python >=3.7, !=3.9.7; 1.21.0 Requires-Python >=3.7, !=3.9.7; 1.22.0 Requires-Python >=3.7, !=3.9.7; 1.23.0 Requires-Python >=3.7, !=3.9.7; 1.23.1 Requires-Python >=3.7, !=3.9.7; 1.24.0 Requires-Python >=3.8, !=3.9.7; 1.24.1 Requires-Python >=3.8, !=3.9.7; 1.25.0 Requires-Python >=3.8, !=3.9.7; 1.26.0 Requires-Python >=3.8, !=3.9.7; 1.27.0 Requires-Python >=3.8, !=3.9.7; 1.27.1 Requires-Python >=3.8, !=3.9.7; 1.27.2 Requires-Python >=3.8, !=3.9.7; 1.28.0 Requires-Python >=3.8, !=3.9.7; 1.28.1 Requires-Python >=3.8, !=3.9.7; 1.28.2 Requires-Python >=3.8, !=3.9.7; 1.29.0 Requires-Python >=3.8, !=3.9.7; 1.30.0 Requires-Python >=3.8, !=3.9.7; 1.31.0 Requires-Python >=3.8, !=3.9.7; 1.31.1 Requires-Python >=3.8, !=3.9.7; 1.32.0 Requires-Python >=3.8, !=3.9.7; 1.32.1 Requires-Python >=3.8, !=3.9.7; 1.32.2 Requires-Python >=3.8, !=3.9.7; 1.32.2rc1 Requires-Python >=3.8, !=3.9.7; 1.33.0 Requires-Python !=3.9.7,>=3.8
ERROR: Could not find a version that satisfies the requirement streamlit==1.33.0 (from versions: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.8.2, 0.9.0, 0.11.0, 0.12.2, 0.12.3, 0.12.4, 0.13.0, 0.13.1, 0.13.3, 0.13.5, 0.14.2, 0.15.0, 0.15.1, 0.15.2, 0.15.3, 0.15.4, 0.15.5, 0.15.6, 0.16.0, 0.16.1, 0.16.2, 0.16.3, 0.17.0, 0.17.1, 0.17.2, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.20.0, 0.21.0, 0.22.0, 0.22.1, 0.22.2, 0.23.0, 0.24.0, 0.24.1, 0.24.2, 0.24.3, 0.25.0, 0.26.0, 0.26.1, 0.27.0, 0.28.0, 0.29.0, 0.30.0, 0.31.0, 0.32.0, 0.33.0, 0.34.0, 0.35.0, 0.36.0, 0.37.0, 0.40.0, 0.40.1, 0.41.0, 0.42.0, 0.43.0, 0.43.1, 0.43.2, 0.44.0, 0.45.0, 0.46.0, 0.47.0, 0.47.1, 0.47.2, 0.47.3, 0.47.4, 0.48.0, 0.48.1, 0.49.0, 0.50.0, 0.50.1, 0.50.2, 0.51.0, 0.52.0, 0.52.1, 0.52.2, 0.53.0, 0.54.0, 0.55.0, 0.56.0, 0.57.0, 0.57.1, 0.57.2, 0.57.3, 0.58.0, 0.59.0, 0.60.0, 0.61.0, 0.62.0, 0.62.1, 0.63.0, 0.63.1, 0.64.0, 0.65.0, 0.65.1, 0.65.2, 0.66.0, 0.67.0, 0.67.1, 0.68.0, 0.68.1, 0.69.0, 0.69.1, 0.69.2, 0.70.0, 0.71.0, 0.72.0, 0.73.0, 0.73.1, 0.74.0, 0.74.1, 0.75.0, 0.76.0, 0.77.0, 0.78.0, 0.79.0, 0.80.0, 0.81.0, 0.81.1, 0.82.0, 0.83.0, 0.84.0, 0.84.1, 0.84.2, 0.85.0, 0.85.1, 0.86.0, 0.87.0, 0.88.0, 0.89.0, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.5.0, 1.5.1, 1.6.0rc3, 1.6.0rc4, 1.6.0, 1.7.0, 1.8.0rc1, 1.8.0, 1.8.1rc1, 1.8.1, 1.9.0rc1, 1.9.0, 1.9.1rc1, 1.9.1rc2, 1.9.1, 1.9.2rc1, 1.9.2, 1.10.0rc1, 1.10.0rc2, 1.10.0, 1.11.0rc1, 1.11.0, 1.11.1rc1, 1.11.1, 1.12.0rc1, 1.12.0rc2, 1.12.0)
ERROR: No matching distribution found for streamlit==1.33.0
My
pants.toml
has this:
Copy code
[python]
interpreter_constraints = [">=3.9,<4"]
Given
streamlit==1.33.0
is not compatible with python 3.9.7 only, it should work with python 3.9.18, right?
b
It should, but the issue is right there in the error message:
Copy code
ERROR: Ignored the following versions that require a different python version: 0.1.1 Requires-Python >=3.7, !=3.9.7; 0.1.2 Requires-Python >=3.7, !=3.9.7; 0.1.3 Requires-Python >=3.7, !=3.9.7; 0.1.4 Requires-Python >=3.7, !=3.9.7; 0.1.5 Requires-Python >=3.7, !=3.9.7; 0.1.6 Requires-Python >=3.7, !=3.9.7; 0.1.7 Requires-Python >=3.7, !=3.9.7; 0.1.8 Requires-Python >=3.8, !=3.9.7; 0.55.2 Requires-Python <3.5; 1.12.1 Requires-Python >=3.7, !=3.9.7; 1.12.1rc1 Requires-Python >=3.7, !=3.9.7; 1.12.2 Requires-Python >=3.7, !=3.9.7; 1.12.2rc1 Requires-Python >=3.7, !=3.9.7; 1.12.2rc2 Requires-Python >=3.7, !=3.9.7; 1.13.0 Requires-Python >=3.7, !=3.9.7; 1.13.0rc1 Requires-Python >=3.7, !=3.9.7; 1.13.0rc2 Requires-Python >=3.7, !=3.9.7; 1.14.0 Requires-Python >=3.7, !=3.9.7; 1.14.0rc1 Requires-Python >=3.7, !=3.9.7; 1.14.1 Requires-Python >=3.7, !=3.9.7; 1.14.1rc1 Requires-Python >=3.7, !=3.9.7; 1.15.0 Requires-Python >=3.7, !=3.9.7; 1.15.1 Requires-Python >=3.7, !=3.9.7; 1.15.2 Requires-Python >=3.7, !=3.9.7; 1.15.2rc1 Requires-Python >=3.7, !=3.9.7; 1.16.0 Requires-Python >=3.7, !=3.9.7; 1.17.0 Requires-Python >=3.7, !=3.9.7; 1.18.0 Requires-Python >=3.7, !=3.9.7; 1.18.1 Requires-Python >=3.7, !=3.9.7; 1.18.1rc1 Requires-Python >=3.7, !=3.9.7; 1.19.0 Requires-Python >=3.7, !=3.9.7; 1.20.0 Requires-Python >=3.7, !=3.9.7; 1.21.0 Requires-Python >=3.7, !=3.9.7; 1.22.0 Requires-Python >=3.7, !=3.9.7; 1.23.0 Requires-Python >=3.7, !=3.9.7; 1.23.1 Requires-Python >=3.7, !=3.9.7; 1.24.0 Requires-Python >=3.8, !=3.9.7; 1.24.1 Requires-Python >=3.8, !=3.9.7; 1.25.0 Requires-Python >=3.8, !=3.9.7; 1.26.0 Requires-Python >=3.8, !=3.9.7; 1.27.0 Requires-Python >=3.8, !=3.9.7; 1.27.1 Requires-Python >=3.8, !=3.9.7; 1.27.2 Requires-Python >=3.8, !=3.9.7; 1.28.0 Requires-Python >=3.8, !=3.9.7; 1.28.1 Requires-Python >=3.8, !=3.9.7; 1.28.2 Requires-Python >=3.8, !=3.9.7; 1.29.0 Requires-Python >=3.8, !=3.9.7; 1.30.0 Requires-Python >=3.8, !=3.9.7; 1.31.0 Requires-Python >=3.8, !=3.9.7; 1.31.1 Requires-Python >=3.8, !=3.9.7; 1.32.0 Requires-Python >=3.8, !=3.9.7; 1.32.1 Requires-Python >=3.8, !=3.9.7; 1.32.2 Requires-Python >=3.8, !=3.9.7; 1.32.2rc1 Requires-Python >=3.8, !=3.9.7; 1.33.0 Requires-Python !=3.9.7,>=3.8
You might want to tighten up your
interpreter_constraints
to be something like:
Copy code
[python]
interpreter_constraints = [">=3.9.8,<4"]
This way, you can skip the release of Python that doesn’t work for streamlit and if you’re already using 3.9.18, your current interpreter will still match the new constraints
q
But streamlit should work with any version higher than 3.8 except for 3.9.7. Not sure tightening the interpreter_constraints is the right thing to do here. As long as the python interpreter is not 3.9.7 pants should be able to generate a lock file would be my expectation.
b
You might have to set the same requirement then
(!= 3.9.7)
, otherwise Pants doesn't know to ignore that version
q
Ok, while your suggestion worked I don’t want to enforce this change in the pants.toml file for something that impacts just one project in the monorepo. And adding
interpreter_constraints=[">=3.9,<4,!=3.9.7"]
to the
python_sources
of the impacted project does not work for some reason.
h
You almost certainly want to upper-bound your ICs more tightly.
>=3.9,<3.13
say, otherwise your resolve must support every latest interpreter version, and it may not (yet)
q
Agreed but my issue isn't that. Why adding the tighter IC !=3.9.7 in the specific project doesn't work while adding the tighter IC of >=3.9.8 works if done in the repo's pants.toml file?