Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyoxidizer run fails behind proxy #15

Closed
jteiwes opened this issue Jun 25, 2019 · 7 comments
Closed

pyoxidizer run fails behind proxy #15

jteiwes opened this issue Jun 25, 2019 · 7 comments

Comments

@jteiwes
Copy link

jteiwes commented Jun 25, 2019

When running the getting started example the call to pyoxidizer run fails when downloading the python environment from behind a proxy. I am using windows cmd, the proxy settings are correctly set in the environment and working for e.g. cargo or wget:

~/pyapp> SET HTTPS_PROXY="http://user:pass@proxy_ip:proxy_port"
~/pyapp> SET HTTP_PROXY="http://user:pass@proxy_ip:proxy_port"
~/pyapp> pyoxidizer.exe run
no existing PyOxidizer artifacts found
processing config file ~/pyapp\pyoxidizer.toml
resolving Python distribution...
downloading https://github.com/indygreg/python-build-standalone/releases/download/20190617/cpython-3.7.3-windows-amd64-20190618T0516.tar.zst
thread 'main' panicked at 'unable to perform HTTP request: Error(Hyper(Error(Connect, Os { > code: 11001, kind: Other, message: "Der angegebene Host ist unbekannt." })), "https://github.com/indygreg/python-build-standalone/releases/download/20190617/cpython-3.7.3-windows-amd64-20190618T0516.tar.zst")', src\libcore\result.rs:997:5
note: Run with RUST_BACKTRACE=1 environment variable to display a backtrace.
~/pyapp>

Is there a way, to set the proxy login info into the pyoxidizer.toml config file? So far i did not find any info on this..

@indygreg
Copy link
Owner

Thank you for the valid bug report!

I would have expected the Rust crate we're using (reqwest) to automatically handle the environment variables, as many HTTP libraries do that automatically. But it appears it doesn't.

Until I have time to fix this (hopefully in ~10 hours), you can work around the problem by downloading the archives referenced in the pyoxidizer.toml file and then changing the url line in the pyoxidizer.toml to local_path and point to the downloaded file. Since I see you are using Windows, remember to escape path components \ with \\ in the TOML string or convert path \ characters to /.

@jteiwes
Copy link
Author

jteiwes commented Jun 25, 2019

work around the problem by downloading the archives referenced in the pyoxidizer.toml file and then changing the url line in the pyoxidizer.toml to local_path and point to the downloaded file

This is exactly what i did :-)

@indygreg
Copy link
Owner

This should be fixed in master. Please reopen if it doesn't work as expected.

@glandium
Copy link

It feels like reqwest should at least have a helper for this. Did you open an issue?

@indygreg
Copy link
Owner

It seems like seanmonstar/reqwest#547 implements the feature in reqwest.

@HarpPDX
Copy link

HarpPDX commented Sep 20, 2019

@indygreg
'pyoxidizer build' failing -- using PyOxidizer 0.3.0 on Linux behind corporate firewall/proxy. http_proxy and https_proxy environment variables are set.

~$ pyoxidizer init pyoxtst
     Created binary (application) package
creating pyoxtst/pyembed
creating pyoxtst/pyembed/src
writing pyoxtst/pyembed/src/config.rs
writing pyoxtst/pyembed/src/data.rs
writing pyoxtst/pyembed/src/importer.rs
writing pyoxtst/pyembed/src/lib.rs
writing pyoxtst/pyembed/src/osutils.rs
writing pyoxtst/pyembed/src/pyalloc.rs
writing pyoxtst/pyembed/src/pyinterp.rs
writing pyoxtst/pyembed/src/pystr.rs
writing pyoxtst/pyembed/Cargo.toml
writing pyoxtst/pyembed/build.rs
writing pyoxtst/src/main.rs
writing pyoxtst/pyoxidizer.toml

A new Rust binary application has been created in pyoxtst

This application can be built by doing the following:

  $ cd pyoxtst
  $ pyoxidizer build
  $ pyoxidizer run

The default configuration is to invoke a Python REPL. You can
edit the various pyoxidizer.*.toml config files or the main.rs
file to change behavior. The application will need to be rebuilt
for configuration changes to take effect.
~$ cd pyoxtst
~/pyoxtst$ pyoxidizer build
no existing PyOxidizer artifacts found
processing config file /home/redacted/pyoxtst/pyoxidizer.toml
resolving Python distribution...
downloading https://github.com/indygreg/python-build-standalone/releases/download/20190816/cpython-3.7.4-linux64-20190817T0224.tar.zst
thread 'main' panicked at 'unable to perform HTTP request: Error(Hyper(Error(Connect, Custom { kind: Other, error: Ssl(Error { code: ErrorCode(5), cause: None }, X509VerifyResult { code: 0, error: "ok" }) })), "https://github.com/indygreg/python-build-standalone/releases/download/20190816/cpython-3.7.4-linux64-20190817T0224.tar.zst")', src/libcore/result.rs:999:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
~/pyoxtst$ pyoxidizer --version
PyOxidizer 0.3.0
~/pyoxtst$ env | grep _proxy
https_proxy=https://proxy.redacted.com:912
http_proxy=http://proxy.redacted.com:911

wget of this URL works:

~/pyoxtst$ wget https://github.com/indygreg/python-build-standalone/releases/download/20190816/cpython-3.7.4-linux64-20190817T0224.tar.zst
--2019-09-20 09:21:42--  https://github.com/indygreg/python-build-standalone/releases/download/20190816/cpython-3.7.4-linux64-20190817T0224.tar.zst
Resolving proxy.redacted.com (proxy.redacted.com)... 10.7.211.16
Connecting to proxy.redacted.com (proxy.redacted.com)|10.7.211.16|:912... connected.
Proxy request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/162334160/b9e7a100-c05c-11e9-94d2-9c9a85c26b75?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190920%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190920T162142Z&X-Amz-Expires=300&X-Amz-Signature=ab9a7f94d1a27cff8d3ecfe69283f42d539aa58b9c3516a439e6f8b5ebd36c20&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dcpython-3.7.4-linux64-20190817T0224.tar.zst&response-content-type=application%2Foctet-stream [following]
--2019-09-20 09:21:42--  https://github-production-release-asset-2e65be.s3.amazonaws.com/162334160/b9e7a100-c05c-11e9-94d2-9c9a85c26b75?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190920%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190920T162142Z&X-Amz-Expires=300&X-Amz-Signature=ab9a7f94d1a27cff8d3ecfe69283f42d539aa58b9c3516a439e6f8b5ebd36c20&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dcpython-3.7.4-linux64-20190817T0224.tar.zst&response-content-type=application%2Foctet-stream
Connecting to proxy.redacted.com (proxy.redacted.com)|10.7.211.16|:912... connected.
Proxy request sent, awaiting response... 200 OK
Length: 25198692 (24M) [application/octet-stream]
Saving to: ‘cpython-3.7.4-linux64-20190817T0224.tar.zst’

cpython-3.7.4-linux64-20190817T0224.tar.zst 100%[===========================================================================================>]  24.03M  5.02MB/s    in 13s

2019-09-20 09:21:56 (1.88 MB/s) - ‘cpython-3.7.4-linux64-20190817T0224.tar.zst’ saved [25198692/25198692]

@rdbisme
Copy link

rdbisme commented Oct 28, 2021

Hello I'm hitting this problem behind corporate firewall. HTTP_PROXY and HTTPS_PROXY are set.

resolving Python distribution https://github.com/indygreg/python-build-standalone/releases/download/20211017/cpython-3.9.7-x86_64-unknown-linux-gnu-pgo-20211017T1616.tar.zst (sha256=1c490d71269eaeebe4de109d9bd1d22281cc028f2161bfe467f6df31de326e3a)
downloading https://github.com/indygreg/python-build-standalone/releases/download/20211017/cpython-3.9.7-x86_64-unknown-linux-gnu-pgo-20211017T1616.tar.zst
error[PYOXIDIZER_BUILD]: error sending request for url (https://github.com/indygreg/python-build-standalone/releases/download/20211017/cpython-3.9.7-x86_64-unknown-linux-gnu-pgo-20211017T1616.tar.zst): error trying to connect: dns error: failed to lookup address information: Name does not resolve

A curl command on the url https://github.com/indygreg/python-build-standalone/releases/download/20211017/cpython-3.9.7-x86_64-unknown-linux-gnu-pgo-20211017T1616.tar.zst works as expected. It might be a regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants