https://pantsbuild.org/ logo
s

silly-queen-7197

02/15/2023, 7:50 PM
One of my engineers uses the package
tensorflow-ranking
which has a dependency on
tensforflow
. On M1 laptops, engineers install
tensforflow-macos
not
tensorflow
. We get around this by
pip
installing it with
--no-deps
. I tried checking to see if I could specify that flag in
requirements.txt
and solve this outside of
pants
but haven't found anything. Is there a way I can add
--no-deps
to
tensorflow-ranking
in
pants
?
e

enough-analyst-54434

02/15/2023, 7:56 PM
Nope. Neither in Pants nor Pex. You can in Pex (
--intransitive
), but Pex, like Pants is global in that you cannot build up a venv piecemeal. You specify a complete venv all at once with both.
It's very unfortunate
tensorflow-macos
exists. In any package ecosystem having the same symbol provided by two different package names is problematic. Here it's made worse by the fact that wheel tags and environment markers are already built to handle this.
Google, like Facebook with PyTorch, is a bad citizen
w

witty-crayon-22786

02/15/2023, 8:00 PM
you can make it a platform conditional requirement, i think?
e

enough-analyst-54434

02/15/2023, 8:00 PM
You missed the detail I think Stu.
w

witty-crayon-22786

02/15/2023, 8:00 PM
can’t remember where i saw that recently… looking.
e

enough-analyst-54434

02/15/2023, 8:00 PM
The issue is a transitive dep.
w

witty-crayon-22786

02/15/2023, 8:01 PM
ah, yea. i see what you’re saying.
s

silly-queen-7197

02/15/2023, 8:03 PM
This is probably just wishful thinking (and me still learning pants) but I can't do something like
Copy code
"tensorflow-ranking": {
    "dependencies": [
        "//:reqs#tensorflow"
    ]
},  
"tensorflow": {
    "requirements": (
        # Linux or intel Mac
        "tensorflow ~= 2.11.0 ; sys_platform != 'darwin' or platform_machine == 'x86_64'",
        # Mac M1
        "tensorflow-macos ~= 2.11.0 ; sys_platform == 'darwin' and platform_machine == 'arm64'",
    ),
}
in a
BUILD
file right?
e

enough-analyst-54434

02/15/2023, 8:03 PM
@silly-queen-7197 it looks like that's a pure python project: https://pypi.org/project/tensorflow-ranking/#files
So just fork, edit it's deps and depend on a VCS requirement
1
s

silly-queen-7197

02/15/2023, 8:04 PM
Thanks, that's a very pragmatic solution
Hrm, good luck with that actually. I have no clue how that wheel publishes - looks like a bazel project and I cannot find the setup.py or project.toml
You are in trouble
s

silly-queen-7197

02/15/2023, 8:09 PM
I think the reality is we'll need to just move to remote development so all engineers have an x86 machine (a plus is spinning up machines with gpus too). Fortunately this is on our roadmap
Thanks for the help though
e

enough-analyst-54434

02/15/2023, 8:09 PM
Developing on Linux for Linux is .... sane
c

curved-television-6568

02/15/2023, 9:30 PM
@witty-crayon-22786 did you think of this thread? https://pantsbuild.slack.com/archives/C046T6T9U/p1676331663918329
👍 1
w

witty-crayon-22786

02/15/2023, 9:32 PM
indeed, heh.
8 Views