so shouldn't pants be able to resolve to the earli...
# general
m
so shouldn't pants be able to resolve to the earlier version and pick up flask-login
0.2.11
?
e
Probably. This is likely worthy of a bug against pex, but it's also really not ideal:
Copy code
$ pex apache-airflow==1.10.0
**** Failed to install apache-airflow-1.10.0 (caused by: NonZeroExit("received exit code 1 during execution of `['/usr/bin/python3.7', '-', 'bdist_wheel', '--dist-dir=/tmp/tmp9oz6r7sr']` while trying to execute `['/usr/bin/python3.7', '-', 'bdist_wheel', '--dist-dir=/tmp/tmp9oz6r7sr']`")
):
stdout:

stderr:
Traceback (most recent call last):
  File "<stdin>", line 9, in <module>
  File "setup.py", line 124
    async = [
          ^
SyntaxError: invalid syntax


Traceback (most recent call last):
  File "/home/jsirois/.venv/pex/bin/pex", line 11, in <module>
    sys.exit(main())
  File "/home/jsirois/.venv/pex/lib/python3.7/site-packages/pex/bin/pex.py", line 735, in main
    pex_builder = build_pex(reqs, options, resolver_options_builder)
  File "/home/jsirois/.venv/pex/lib/python3.7/site-packages/pex/bin/pex.py", line 664, in build_pex
    for resolved_dist in resolveds:
  File "/home/jsirois/.venv/pex/lib/python3.7/site-packages/pex/resolver.py", line 566, in resolve_multi
    use_manylinux=use_manylinux):
  File "/home/jsirois/.venv/pex/lib/python3.7/site-packages/pex/resolver.py", line 502, in resolve
    return resolver.resolve(resolvables_from_iterable(requirements, builder))
  File "/home/jsirois/.venv/pex/lib/python3.7/site-packages/pex/resolver.py", line 300, in resolve
    dist = self.build(package, resolvable.options)
  File "/home/jsirois/.venv/pex/lib/python3.7/site-packages/pex/resolver.py", line 379, in build
    dist = super(CachingResolver, self).build(package, options)
  File "/home/jsirois/.venv/pex/lib/python3.7/site-packages/pex/resolver.py", line 258, in build
    raise Untranslateable('Package %s is not translateable by %s' % (package, translator))
pex.resolver.Untranslateable: Package SourcePackage('file:///home/jsirois/.pex/build/apache-airflow-1.10.0.tar.gz') is not translateable by ChainedTranslator(WheelTranslator, EggTranslator, SourceTranslator)
It would really help to have a working legit failure repro case.
You should be able to work around by declaring a direct dep on the correct solution for flask-appbuilder with appropriate comment pointing to the bug you file.
pypi says "Last released: Aug 27, 2018" - clearly no-one actually uses this version of airflow?
Or does everyone install from a git url with a fix or how even is this a thing?
m
that is why i had to put the constraint of <3.7 in my requirements. If you put that constraint i think you'd get a repro... will file an issue with pex.
e
Aha - I did not realize that was what the environment marker was for.
This thing is a nightmare!: "RuntimeError: By default one of Airflow's dependencies installs a GPL dependency (unidecode). To avoid this dependency set SLUGIFY_USES_TEXT_UNIDECODE=yes..."
m
I agree -.- i just got handed this ticket but seriously wtf how is nobody else googling for this problem..?
e
Repro - maybe - taking a long time to download the huge dep list
m
I got it with
pex apache-airflow==1.10.0 --interpreter-constraint='CPython<3.7'
e
Agreed:
Copy code
$ SLUGIFY_USES_TEXT_UNIDECODE=yes pex --python=python2 'apache-airflow==1.10.0; python_version < "3.7"'
Could not satisfy all requirements for flask-login==0.2.11:
    flask-login==0.2.11(from: apache-airflow==1.10.0; python_version < "3.7"), Flask-Login<0.5,>=0.3(from: apache-airflow==1.10.0; python_version < "3.7"->flask-appbuilder<2.0.0,>=1.11.1)
That is a clean minimal repro
m
e
Thank you! As soon as I confirm the workaround works I'll note that on the issue.
OK - workaround works. Hopefully that gets you by until we can devote some time to fixing the pex resolver implementation which likely needs better backtracking.
m
how would i specify it in pants requirement file?
Just adding
Flask-AppBuilder==1.11.1 ; python_version < '3.7'
to the requirements.txt file still gives me the same problem
e
1st - keep in mind this is a standard pip requirements file. So you'd add
Flask-AppBuilder==1.11.1
then in the target depending on - say -
3rdparty/python:apache-airflow
, add a new fake dependency on
3rdparty/python:Flask-AppBuilder
IE: requirements.txt contains all your repo requirements, but not all targets depend on all those things (I hope!)
Make sense?
m
attempting!
e
If you have lots of targets with this issue we can talk about a way to DRY this hack up
m
I don't understand
add a new fake dependency
e
python_library(name='BillysApp', sources=..., dependencies=[..., '3rdparty/python/Flask-AppBuilder'])
IOW you add a dependency to the exiting target needing airflow
Its fake in that that target doesn't actually directly need flask-appbuilder, its just being depended on to influence the resolver
Ditto if the target in question is a
python_binary
- trick works for either.
If this is still confusing perhaps paste your existing BUILD file with the target you wrote needing airflow.