indygreg / PyOxidizer

A modern Python application packaging and distribution tool
Mozilla Public License 2.0
5.4k stars 234 forks source link

can't install missing modules behind company firewall which does not allow automated downloads #654

Open spalbird opened 1 year ago

spalbird commented 1 year ago

can't install missing modules behind company firewall which does not allow automated downloads

=> I suggest to advise a directory where to copy the missing module downloaded manually => --verbose does not expose a traceback in this case which would be helpful to locate the calling code and solve this issue by its own.

copied from command window: """ error[PYOXIDIZER_BUILD]: error sending request for url (https://github.com/indygreg/python-build-standalone/releases/download/20221106/cpython-3.10.8%2B20221106-x86_64-pc-windows-msvc-shared-pgo-full.tar.zst): error trying to connect: tcp connect error: No connection could be made because the target machine actively refused it. (os error 10061)

Caused by:
    0: error trying to connect: tcp connect error: No connection could be made because the target machine actively refused it. (os error 10061)
    1: tcp connect error: No connection could be made because the target machine actively refused it. (os error 10061)
    2: No connection could be made because the target machine actively refused it. (os error 10061)
  --> .\pyoxidizer.bzl:19:14
   |
19 |     policy = dist.make_python_packaging_policy()
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ resolve_distribution

"""

indygreg commented 1 year ago

Instead of calling default_python_distribution() in your pyoxidizer.bzl, you can construct a PythonDistribution from a path or URL. This allows you to bypass firewall restrictions.

Docs at https://gregoryszorc.com/docs/pyoxidizer/0.23.0/pyoxidizer_config_type_python_distribution.html.

I'm receptive to suggestions on how to improve the docs to make this solution more obvious. (The docs currently are a bit of a mess and I need to spend a few days overhauling them.)

indygreg commented 1 year ago

Oh, and I agree the error context could be more useful. The dist.make_python_packaging_policy() function is a weird place to see the error attributed to! I think that's a side-effect of how PythonDistribution in Starlark are lazily resolved.