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

issue: pyodide.loadPackage behind proxy not working, env variables not considered #3304

Open
jabbasj opened this issue Jun 19, 2024 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed non-core maintainers aren't looking into this/low priority

Comments

@jabbasj
Copy link

jabbasj commented Jun 19, 2024

It seems like ENV Variables HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy are not respected here... so I am not able to build my own docker image behind a proxy

=> ERROR [build 14/14] RUN npm run build 7.7s

[build 14/14] RUN npm run build:
1.597
1.597 > [email protected] build
1.597 > npm run pyodide:fetch && vite build
1.597
2.292
2.292 > [email protected] pyodide:fetch
2.292 > node scripts/prepare-pyodide.js
2.292
2.420 Setting up pyodide micropip
7.022 Loading micropip, packaging
7.064 Didn't find package packaging-23.2-py3-none-any.whl locally, attempting to load from https://cdn.jsdelivr.net/pyodide/v0.26.0a4/full/
7.272 Didn't find package micropip-0.6.0-py3-none-any.whl locally, attempting to load from https://cdn.jsdelivr.net/pyodide/v0.26.0a4/full/
7.307 Failed to load micropip, packaging
7.310 The following error occurred while loading micropip:
7.313 fetch failed
7.313 The following error occurred while loading packaging:
7.314 fetch failed

@tjbck
Copy link
Contributor

tjbck commented Jun 19, 2024

PR Welcome!

@tjbck tjbck changed the title pyodide.loadPackage behind proxy not working, env variables not considered issue: pyodide.loadPackage behind proxy not working, env variables not considered Jun 20, 2024
@tjbck tjbck added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed non-core maintainers aren't looking into this/low priority labels Jun 20, 2024
@tcarwash
Copy link

@jabbasj are you using --build-args HTTP_PROXY="proxy.yourdoman.tld" in your docker build command to specify your proxy? It looks like --env is only used at runtime

@jabbasj
Copy link
Author

jabbasj commented Jun 25, 2024

@jabbasj are you using --build-args HTTP_PROXY="proxy.yourdoman.tld" in your docker build command to specify your proxy? It looks like --env is only used at runtime

I had my daemon configured to use the proxy based on this guide: https://docs.docker.com/config/daemon/proxy/

sudo systemctl show --property=Environment docker

Environment=HTTP_PROXY=proxy.yourdoman.tld HTTPS_PROXY=proxy.yourdoman.tld http_proxy=proxy.yourdoman.tld https_proxy=proxy.yourdoman.tld no_proxy=localhost,127.0.0.1,localaddress,localdomain.com NO_PROXY=localhost,127.0.0.1,localaddress,localdomain.com

But based on your feedback, I tried passing --build-arg HTTP_PROXY="proxy.yourdoman.tld" --build-arg HTTPS_PROXY="proxy.yourdoman.tld" --build-arg http_proxy="proxy.yourdoman.tld" --build-arg https_proxy="proxy.yourdoman.tld" explicitly

and also tried modifying ~/.docker/config.json

No luck :(

@bright-ren
Copy link

Also have this issue, my walk around is to make a base build image with pyodide micropip downloaded, and then use the base image to build final image behind proxy.

@jabbasj
Copy link
Author

jabbasj commented Jun 28, 2024

Also have this issue, my walk around is to make a base build image with pyodide micropip downloaded, and then use the base image to build final image behind proxy.

Ya that's fair, you can also just copy the pre-downloaded files directly into the static directory as a work-around but I chose to simply disable this feature entirely since executing python generated by the LLM in the browser isn't very useful for my use-case (this doesn't affect the ability to use Tools)

@bright-ren
Copy link

[> > Also have this issue, my walk around is to make a base build image with pyodide micropip downloaded, and then use the base image to build final image behind proxy.

Ya that's fair, you can also just copy the pre-downloaded files directly into the static directory as a work-around but I chose to simply disable this feature entirely since executing python generated by the LLM in the browser isn't very useful for my use-case (this doesn't affect the ability to use Tools)

Maybe you can try something like: https://github.com/gajus/global-agent?](https://github.com/pyodide/pyodide/issues/4891#issuecomment-2198004864)

global-agent works for me,modify package.json
"pyodide:fetch": "npm i global-agent --save-dev && GLOBAL_AGENT_HTTPS_PROXY=$HTTPS_PROXY GLOBAL_AGENT_HTTP_PROXY=$HTTP_PROXY node -r global-agent/bootstrap scripts/prepare-pyodide.js"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed non-core maintainers aren't looking into this/low priority
Projects
None yet
Development

No branches or pull requests

4 participants