average-australia-85137
05/14/2021, 4:15 PM<http://requirements.in|requirements.in>
...
gevent>=21.1.0 --no-binary greenlet
...
Then:
pip-compile -o requirements.txt <http://requirements.in|requirements.in>
generates something like
# this file is generated blah blah blah
--no-binary greenlet
...
gevent==21.1.2
...
if you pip install -r requirements.txt
it will correctly build greenlet for you
when i'm going through the PythonRequirementLibrary
s that are generated for my project however I can't find anything referencing that I can't rely on the greenlet wheel
does that all make sense?enough-analyst-54434
05/14/2021, 4:48 PMenough-analyst-54434
05/14/2021, 4:53 PMpip wheel --no-deps --no-binary greenlet greenlet
what is the file name of the generated wheel?enough-analyst-54434
05/14/2021, 5:02 PMgreenlet-1.1.0-cp39-cp39-linux_x86_64.whl
and I find:
$ auditwheel show greenlet-1.1.0-cp39-cp39-linux_x86_64.whl
greenlet-1.1.0-cp39-cp39-linux_x86_64.whl is consistent with the
following platform tag: "manylinux_2_17_x86_64".
The wheel references external versioned symbols in these
system-provided shared libraries: libc.so.6 with versions
{'GLIBC_2.2.5', 'GLIBC_2.4', 'GLIBC_2.14'}, libgcc_s.so.1 with
versions {'GCC_3.0'}, libstdc++.so.6 with versions {'CXXABI_1.3'}
This constrains the platform tag to "manylinux_2_17_x86_64". In order
to achieve a more compatible tag, you would need to recompile a new
wheel from source on a system with earlier versions of these
libraries, such as a recent manylinux image.
enough-analyst-54434
05/14/2021, 5:17 PMpex-tools your.pex info | jq '.distributions | to_entries[] | .key | match("^greenlet.*") | .string'
Or without pex-tools:
unzip -qc your.pex PEX-INFO | jq '.distributions | to_entries[] | .key | match("^greenlet.*") | .string'
average-australia-85137
05/14/2021, 5:52 PM(.venv) [nate@ragin-cajun pants-docker]$ pip wheel --no-deps --no-binary greenlet greenlet
Collecting greenlet
Using cached greenlet-1.1.0.tar.gz (85 kB)
Building wheels for collected packages: greenlet
Building wheel for greenlet (setup.py) ... done
Created wheel for greenlet: filename=greenlet-1.1.0-cp38-cp38-linux_x86_64.whl size=149860 sha256=3289eb703bc2faf2f06aeb8ddb72a5bc62d9c2df1517e28f237eeaf8ed965e77
Stored in directory: /home/nate/.cache/pip/wheels/2f/e7/47/b6a893203ccff7cb1cb81576f22066a93657a6429a68a912d0
(so: greenlet-1.1.0-cp38-cp38-linux_x86_64.whl
)
From the generated pex:
(.venv) [nate@ragin-cajun pants-docker]$ unzip -qc dist/test_docker/test_greenlet.pex PEX-INFO | jq '.distributions | to_entries[] | .key | match("^greenlet.*") | .string'
"greenlet-1.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
"greenlet-1.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
enough-analyst-54434
05/14/2021, 6:02 PMpip install auditwheel
and run auditwheel show
against the greenlet wheel you built? For the PEX embedded greenlet-1.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
wheel not to work, the auditwheel should say your system does not support the glibc 2.17 spec.average-australia-85137
05/14/2021, 6:03 PM(.venv) [nate@ragin-cajun pants-docker]$ auditwheel show greenlet-1.1.0-cp38-cp38-linux_x86_64.whl
greenlet-1.1.0-cp38-cp38-linux_x86_64.whl is consistent with the
following platform tag: "manylinux_2_17_x86_64".
The wheel references external versioned symbols in these
system-provided shared libraries: libc.so.6 with versions
{'GLIBC_2.2.5', 'GLIBC_2.4', 'GLIBC_2.14'}, libgcc_s.so.1 with
versions {'GCC_3.0'}, libstdc++.so.6 with versions {'CXXABI_1.3'}
This constrains the platform tag to "manylinux_2_17_x86_64". In order
to achieve a more compatible tag, you would need to recompile a new
wheel from source on a system with earlier versions of these
libraries, such as a recent manylinux image.
average-australia-85137
05/14/2021, 6:07 PMaverage-australia-85137
05/14/2021, 6:07 PMenough-analyst-54434
05/14/2021, 6:14 PMenough-analyst-54434
05/14/2021, 6:14 PMaverage-australia-85137
05/14/2021, 6:17 PMgevent==20.6.2
greenlet==0.4.16
in both my requirements.txt
& constraints.txt
with a python library that used gevent
When creating a distribution it would correctly limit the gevent version to 20.6.2, but would not limit the greenlet version, even though it was included in the requirements/constraints file.
so if I make a python distribution from a library that depends on just gevent
I get:
(.venv) [nate@ragin-cajun remit-srv]$ pip install dist/remit_srv-0-py3-none-any.whl
...
(.venv) [nate@ragin-cajun remit-srv]$ pip freeze | grep gevent
gevent==20.6.2
(.venv) [nate@ragin-cajun remit-srv]$ pip freeze | grep greenlet
greenlet==1.1.0
(.venv) [nate@ragin-cajun remit-srv]$ python -m app
<frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
^ that's what I don't wantaverage-australia-85137
05/14/2021, 6:17 PMenough-analyst-54434
05/14/2021, 6:20 PMaverage-australia-85137
05/14/2021, 6:21 PM"//:greenlet"
as an explicit dependency on my distribution and then:
(.venvtwo) [nate@ragin-cajun remit-srv]$ pip install dist/remit_srv-0-py3-none-any.whl
(.venvtwo) [nate@ragin-cajun remit-srv]$ pip freeze | grep gevent
gevent==20.6.2
(.venvtwo) [nate@ragin-cajun remit-srv]$ pip freeze | grep greenlet
greenlet==0.4.16
enough-analyst-54434
05/14/2021, 6:23 PMenough-analyst-54434
05/14/2021, 6:23 PMenough-analyst-54434
05/14/2021, 6:24 PMenough-analyst-54434
05/14/2021, 6:24 PMaverage-australia-85137
05/14/2021, 6:25 PMaverage-australia-85137
05/14/2021, 6:27 PMaverage-australia-85137
05/14/2021, 6:27 PMenough-analyst-54434
05/14/2021, 6:28 PMthe gevent setup.py does install_requires greenlet? is that not used when figuring out dependenciesIt is. So .... digging more. But do you have an answer on the Pip resolver question? Do you configure that for Pants? Which Pants version?
average-australia-85137
05/14/2021, 6:30 PMaverage-australia-85137
05/14/2021, 6:30 PMpants_version = "2.5.0.dev3"
level = "info"
colors = true
files_not_found_behavior = "error"
#process_execution_local_parallelism=36
rule_threads_core=12
plugins=["compyman-pants-docker @ file:///home/nate/wave/pants-docker/dist/compyman_pants_docker-0.1a0-py3-none-any.whl"]
backend_packages = [
"pants.backend.python",
"pants.backend.python.lint.docformatter",
"pants.backend.python.lint.black",
"sendwave.pants_docker"
]
[source]
root_patterns = [
"/", "/src"
]
[pytest]
pytest_plugins.add = ["celery==4.4.7", "requests-mock", "faker==4.1.1"]
[python-setup]
interpreter_constraints = ["CPython==3.8.*"]
requirement_constraints = "contraints.txt"
[python-infer]
inits = true
average-australia-85137
05/14/2021, 6:31 PMenough-analyst-54434
05/14/2021, 6:32 PM$ unzip -qc ~/downloads/geve* gevent-20.6.2.dist-info/METADATA | grep Requires | grep greenlet
Requires-Dist: greenlet (>=0.4.16) ; platform_python_implementation == "CPython"
Which is legit. Pants / Pex / Pip should be honoring that and using your pin from constraints.txt.average-australia-85137
05/14/2021, 6:34 PMenough-analyst-54434
05/14/2021, 6:36 PMaverage-australia-85137
05/14/2021, 6:36 PMaverage-australia-85137
05/14/2021, 6:39 PMgevent==20.6.2
# via -r <http://requirements.in|requirements.in>
greenlet==0.4.16
# via gevent
constraints.txt
gevent==20.6.2
greenlet==0.4.16
enough-analyst-54434
05/14/2021, 6:41 PMpex -V
and then pex --constraints constraints.txt gevent==20.6.2 -onate.pex
?enough-analyst-54434
05/14/2021, 6:43 PM$ pex -V
2.1.42
$ cat constraints.txt
gevent==20.6.2
greenlet==0.4.16
$ pex --constraints constraints.txt gevent==20.6.2 -onate.pex
$ pex-tools nate.pex info | jq .distributions
{
"gevent-20.6.2-cp39-cp39-manylinux2010_x86_64.whl": "bf57b6087e29a0bb652e029522e30cf5a794edd6",
"greenlet-0.4.16-cp39-cp39-linux_x86_64.whl": "8a34135ee4a0f738cf8eff15aabb139e72d894b2",
"setuptools-56.2.0-py3-none-any.whl": "4c58b9c155902d9c63742e1862a7ef4ba4886751",
"zope.event-4.5.0-py2.py3-none-any.whl": "29e480254c9d32c09e95f9e58b759ecc1d309629",
"zope.interface-5.4.0-cp39-cp39-manylinux2010_x86_64.whl": "94f09dbe0ee11d80ac374261764597ebd489cea7"
}
average-australia-85137
05/14/2021, 6:45 PMpex-tools nate.pex info | jq .distributions
{
"gevent-20.6.2-cp39-cp39-manylinux2010_x86_64.whl": "bf57b6087e29a0bb652e029522e30cf5a794edd6",
"greenlet-0.4.16-cp39-cp39-linux_x86_64.whl": "8a34135ee4a0f738cf8eff15aabb139e72d894b2",
"setuptools-56.2.0-py3-none-any.whl": "4c58b9c155902d9c63742e1862a7ef4ba4886751",
"zope.event-4.5.0-py2.py3-none-any.whl": "29e480254c9d32c09e95f9e58b759ecc1d309629",
"zope.interface-5.4.0-cp39-cp39-manylinux2010_x86_64.whl": "94f09dbe0ee11d80ac374261764597ebd489cea7"
}
average-australia-85137
05/14/2021, 6:46 PMenough-analyst-54434
05/14/2021, 6:47 PMpex --python=/path/to/same/python ...
enough-analyst-54434
05/14/2021, 6:47 PMenough-analyst-54434
05/14/2021, 6:50 PM./pants package
or is just when building a distribution / wheel?average-australia-85137
05/14/2021, 6:54 PM'install_requires': (
...
'gevent==20.6.2',
...
),
no greenlet at all - so then when I pip install that package it only follows the constraints on the gevent package (>= 0.4.16) & picks up the most recent version (and its binary incompatibility)enough-analyst-54434
05/14/2021, 6:57 PMyourdist[greenlet]
and you can use that extra to express your constraint.enough-analyst-54434
05/14/2021, 6:59 PMaverage-australia-85137
05/14/2021, 6:59 PMaverage-australia-85137
05/14/2021, 7:00 PMaverage-australia-85137
05/14/2021, 7:01 PMenough-analyst-54434
05/14/2021, 7:02 PMaverage-australia-85137
05/14/2021, 7:02 PMenough-analyst-54434
05/14/2021, 7:03 PMenough-analyst-54434
05/14/2021, 7:03 PMenough-analyst-54434
05/14/2021, 7:03 PMaverage-australia-85137
05/14/2021, 7:03 PMenough-analyst-54434
05/14/2021, 7:04 PMaverage-australia-85137
05/14/2021, 7:10 PMbut what i'm actually trying to do here is really what the pex implementation is doing and get a full list of of transitive dependencies + versions (in a plugin)
enough-analyst-54434
05/14/2021, 7:20 PMenough-analyst-54434
05/14/2021, 7:22 PMenough-analyst-54434
05/14/2021, 7:24 PMaverage-australia-85137
05/14/2021, 7:26 PMaverage-australia-85137
05/14/2021, 7:26 PMenough-analyst-54434
05/14/2021, 7:27 PMaverage-australia-85137
05/14/2021, 7:29 PMpip install {dependency line}
in the dockerfile for each python library dependencyenough-analyst-54434
05/14/2021, 7:32 PMPEX_TOOLS=1 /venv.mode.pex venv right/here
to build the venv up front - say in a Dockerfile RUN
.average-australia-85137
05/14/2021, 7:36 PMaverage-australia-85137
05/14/2021, 7:36 PMenough-analyst-54434
05/14/2021, 7:37 PMenough-analyst-54434
05/14/2021, 7:38 PMRUN PEX_TOOLS=1 ./my.pex venv right/here && rm my.pex
average-australia-85137
05/14/2021, 7:38 PMenough-analyst-54434
05/14/2021, 7:38 PMaverage-australia-85137
05/14/2021, 7:39 PMaverage-australia-85137
05/14/2021, 7:39 PM