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

Closed
opened 2025-11-11 14:42:46 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @jabbasj on GitHub (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 > open-webui@0.3.5 build
1.597 > npm run pyodide:fetch && vite build
1.597
2.292
2.292 > open-webui@0.3.5 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

Originally created by @jabbasj on GitHub (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 > open-webui@0.3.5 build 1.597 > npm run pyodide:fetch && vite build 1.597 2.292 2.292 > open-webui@0.3.5 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
GiteaMirror added the enhancementgood first issuehelp wantednon-core labels 2025-11-11 14:42:46 -06:00
Author
Owner

@tjbck commented on GitHub (Jun 19, 2024):

PR Welcome!

@tjbck commented on GitHub (Jun 19, 2024): PR Welcome!
Author
Owner

@tcarwash commented on GitHub (Jun 24, 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

@tcarwash commented on GitHub (Jun 24, 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
Author
Owner

@jabbasj commented on GitHub (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 :(

@jabbasj commented on GitHub (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 :(
Author
Owner

@bright-ren commented on GitHub (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.

@bright-ren commented on GitHub (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.
Author
Owner

@jabbasj commented on GitHub (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)

@jabbasj commented on GitHub (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)
Author
Owner

@bright-ren commented on GitHub (Jul 13, 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)

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"

@bright-ren commented on GitHub (Jul 13, 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) 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" `
Author
Owner

@stringang commented on GitHub (Aug 20, 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.

@bright-ren Could you share your Dockerfile? This would help me better resolve the issue.

@stringang commented on GitHub (Aug 20, 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. @bright-ren Could you share your Dockerfile? This would help me better resolve the issue.
Author
Owner

@gaussiangit commented on GitHub (Oct 16, 2024):

any solution on this ? CDN is blocked by proxy, micropip and packaging does not work !
I tried https://github.com/open-webui/open-webui/issues/3304#issuecomment-2226727199 but did not work

Setting up pyodide + micropip
Loading micropip package
Loading micropip, packaging
Didn't find package micropip-0.6.0-py3-none-any.whl locally, attempting to load from https://cdn.jsdelivr.net/pyodide/v0.26.1/full/
Didn't find package packaging-23.2-py3-none-any.whl locally, attempting to load from https://cdn.jsdelivr.net/pyodide/v0.26.1/full/
Failed to load micropip, packaging
The following error occurred while loading micropip:
fetch failed
The following error occurred while loading packaging:
fetch failed
Failed to load or install micropip: PythonError: Traceback (most recent
@gaussiangit commented on GitHub (Oct 16, 2024): any solution on this ? CDN is blocked by proxy, micropip and packaging does not work ! I tried https://github.com/open-webui/open-webui/issues/3304#issuecomment-2226727199 but did not work ``` Setting up pyodide + micropip Loading micropip package Loading micropip, packaging Didn't find package micropip-0.6.0-py3-none-any.whl locally, attempting to load from https://cdn.jsdelivr.net/pyodide/v0.26.1/full/ Didn't find package packaging-23.2-py3-none-any.whl locally, attempting to load from https://cdn.jsdelivr.net/pyodide/v0.26.1/full/ Failed to load micropip, packaging The following error occurred while loading micropip: fetch failed The following error occurred while loading packaging: fetch failed Failed to load or install micropip: PythonError: Traceback (most recent ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#1321