Hi everyone - we are considering Pants for a proje...
# general
s
Hi everyone - we are considering Pants for a project where we are moving from a monorepo to a "framework + plugin components" model, such that the plugins are versioned/packaged discretely. In our current POC we're using namespace packages for the plugins, and I had hoped to use pex directly to deploy each plugin in an isolated environment, but I don't believe pex files can be run on Windows. Does anyone see a path forward for this scenario with Pants?
h
Hi! @enough-analyst-54434 is working on pex support for Windows, which I believe is relatively close. It’ll be a while before you can run Pants itself on Windows, but as long as you have Windows wheels for all your transitive deps, then Pants on other platforms (including WSL2) should be able to build Windows-compatible pexes.
But you will be on the bleeding edge for a while…
s
That's great, thanks for the response! Is there any general idea of timeline?
e
I think Pex support for windows will land in a Pex release before Thanksgiving. Pants is a whole other issue. The known unknown is how much work getting all the bash scripts Pants rules use internally to work on Windows is. I have ideas there. The unknown unknowns ... well I'll leave that to Rumsfeld.
h
Well, but Pants on macos or linux or wsl2 can build a windows-compatible .pex file, if all wheels are available, once Pex is able to run on Windows, I assume?
So you can deploy to windows, but not build on windows
Until Pants itself runs on windows
e
Yes, that's correct.
s
Thanks for the replies! Checking back in...is it now possible to run pex files on Windows? As a note, for us it's not a priority to be able to build on Windows, just running the generated pex files
h
That has been possible for some time, as long as windows-compatible wheels are available (on PyPI or a custom repository you create) for all your transitive requirements
👍 1
s
Hmm, hopefully this isn't a PEBCAK situation but I'm on pex 2.2.2 (trying pex out directly before moving to Pants for builds) and I'm still having issues running the pex files on Windows: 1. Create pex file on macOS using
pex requests --platform win_amd64-cp-3.9.11-none -o ./Downloads/test_windows.pex
2. Try to excute resulting pex on Windows 10:
python ./test_windows.pex
3. Get the following traceback
Copy code
Traceback (most recent call last):
  File "C:\Users\s\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\s\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\s\Downloads\test_windows2.pex\__main__.py", line 99, in <module>
  File "C:\Users\s\Downloads\test_windows2.pex\__main__.py", line 17, in __ensure_pex_installed__
  File "<frozen zipimport>", line 259, in load_module
  File "C:\Users\s\Downloads\test_windows.pex\.bootstrap\pex\layout.py", line 11, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "C:\Users\s\Downloads\test_windows.pex\.bootstrap\pex\atomic_directory.py", line 7, in <module>
ModuleNotFoundError: No module named 'fcntl'
Happy to open a ticket instead if this is not the right forum for this, just wanted to make sure I hadn't misinterpreted the intended support!
h
Since this thread started pex has moved to its own org, with its own support, so a ticket at https://github.com/pex-tool/pex is probably a good place for such discussions. However, pex (to the best of my knowledge) still doesn't support running natively on Windows (that work stalled a while back for various reasons) so I wouldn't expect this to work. You can build a linux pex and run it on a Windows machine under WSL2 though.
Getting Windows support in PEX over the finish line would take some work by someone with the motivation and time to do so...
As it is not a small thing