1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WindowsのZscaler環境下でuvを実行する場合

Last updated at Posted at 2024-11-12

発生する問題

uv をZscaler環境下で実行すると以下のようなエラーを出力することがあります。
(ネットワーク(所内・在宅)で変わることもありますが)

> uv python pin 3.8.7
> uv sync
error: Failed to download https://github.com/indygreg/python-build-standalone/releases/download/20210103/cpython-3.8.7-x86_64-pc-windows-msvc-shared-pgo-20210103T1125.tar.zst
  Caused by: Request failed after 3 retries
  Caused by: error sending request for url (https://github.com/indygreg/python-build-standalone/releases/download/20210103/cpython-3.8.7-x86_64-pc-windows-msvc-shared-pgo-20210103T1125.tar.zst)
  Caused by: client error (Connect)
  Caused by: invalid peer certificate: UnknownIssuer

原因は、ZscalerがSSL検査を行っている場合は通信の中間に割り込み、
uvがMozillaの証明書を使用するため、検証できずエラーになります。

By default, uv loads certificates from the bundled webpki-roots crate. The webpki-roots are a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).

対応方法

uv sync --native-tls

OSが管理する証明書を使えば問題解消できます。
環境変数もあるみたいです。
あと、下記でも対応できましたが、エラーを無視しますし、ホスト毎に設定が必要なので微妙かと。オレオレ証明書の場合は仕方ないかもですが。
python: uv で trusted-host は、allow-insecure-host

蛇足

uv add pip pip_system_certs --native-tls

とするとちょっと幸せになるかも

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?