【问题标题】:pip install urllib3 hanging on "Caching due to etag"pip install urllib3 挂在“由于 etag 导致缓存”
【发布时间】:2019-03-22 11:44:24
【问题描述】:

urllib3 的 Pip install 挂在“Caching due to etag”上。我正在构建一个不允许您指定 --no-cache-dir 的 AWS chalice 项目,因此我需要在没有该命令的情况下解决该问题。有任何想法吗?

在虚拟环境中使用 Python 3.6.5 和 Pip 10.0.1。

(partnerdb-virtualenv) C:\Windows\SysWOW64\partnerdb-project>pip install urllib3 -vvv
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Created temporary directory: C:\Users\Matt\AppData\Local\Temp\pip-ephem-wheel-cache-v0e8ikpl
Created temporary directory: C:\Users\Matt\AppData\Local\Temp\pip-req-tracker-d58lw_h5
Created requirements tracker 'C:\\Users\\Matt\\AppData\\Local\\Temp\\pip-req-tracker-d58lw_h5'
Created temporary directory: C:\Users\Matt\AppData\Local\Temp\pip-install-6qpv92ms
Collecting urllib3
  1 location(s) to search for versions of urllib3:
  * https://pypi.org/simple/urllib3/
  Getting page https://pypi.org/simple/urllib3/
  Looking up "https://pypi.org/simple/urllib3/" in the cache
  Request header has "max_age" as 0, cache bypassed
  Starting new HTTPS connection (1): pypi.org:443
  https://pypi.org:443 "GET /simple/urllib3/ HTTP/1.1" 200 6330
  Updating cache with response from "https://pypi.org/simple/urllib3/"
  Caching due to etag

编辑:基于其中一个 cmets,curl -vvv https://files/pythonhosted.org/ 返回:

*   Trying 2a04:4e42:2d::319...
* TCP_NODELAY set
* Connected to files.pythonhosted.org (2a04:4e42:2d::319) port 443 (#0)
* schannel: SSL/TLS connection with files.pythonhosted.org port 443 (step 1/3)
* schannel: checking server certificate revocation
* schannel: sending initial handshake data: sending 187 bytes...
* schannel: sent initial handshake data: sent 187 bytes
* schannel: SSL/TLS connection with files.pythonhosted.org port 443 (step 2/3)
* schannel: failed to receive handshake, need more data
* schannel: SSL/TLS connection with files.pythonhosted.org port 443 (step 2/3)
* schannel: encrypted data got 4096
* schannel: encrypted data buffer: offset 4096 length 4096
* schannel: encrypted data length: 4018
* schannel: encrypted data buffer: offset 4018 length 4096
* schannel: received incomplete message, need more data
* schannel: SSL/TLS connection with files.pythonhosted.org port 443 (step 2/3)
* schannel: encrypted data got 1024
* schannel: encrypted data buffer: offset 5042 length 5042
* schannel: encrypted data length: 815
* schannel: encrypted data buffer: offset 815 length 5042
* schannel: received incomplete message, need more data
* schannel: SSL/TLS connection with files.pythonhosted.org port 443 (step 2/3)
* schannel: encrypted data got 1051
* schannel: encrypted data buffer: offset 1866 length 5042
* schannel: sending next handshake data: sending 93 bytes...
* schannel: SSL/TLS connection with files.pythonhosted.org port 443 (step 2/3)
* schannel: encrypted data got 258
* schannel: encrypted data buffer: offset 258 length 5042
* schannel: SSL/TLS handshake complete
* schannel: SSL/TLS connection with files.pythonhosted.org port 443 (step 3/3)
* schannel: stored credential handle in session cache
> GET / HTTP/1.1
> Host: files.pythonhosted.org
> User-Agent: curl/7.55.1
> Accept: */*
>
* schannel: client wants to read 102400 bytes
* schannel: encdata_buffer resized 103424
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: encrypted data got 2412
* schannel: encrypted data buffer: offset 2412 length 103424
* schannel: decrypted data length: 2383
* schannel: decrypted data added: 2383
* schannel: decrypted data cached: offset 2383 length 102400
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: decrypted data buffer: offset 2383 length 102400
* schannel: schannel_recv cleanup
* schannel: decrypted data returned 2383
* schannel: decrypted data buffer: offset 0 length 102400
< HTTP/1.1 200 OK
< Content-Type: text/html
< Server: nginx/1.13.9
< Content-Length: 1822
< Accept-Ranges: bytes
< Date: Thu, 18 Oct 2018 18:18:01 GMT
< Age: 0
< Connection: keep-alive
< X-Served-By: cache-iad2138-IAD, cache-pao17439-PAO
< X-Cache: HIT, MISS
< X-Cache-Hits: 1, 0
< X-Timer: S1539886682.749014,VS0,VE70
< Vary: Accept-Encoding
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< X-Frame-Options: deny
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Permitted-Cross-Domain-Policies: none
< X-Robots-Header: noindex
<
<html> ... </html>
* Connection #0 to host files.pythonhosted.org left intact

【问题讨论】:

  • 看起来您的 ISP 已阻止 files.pythonhosted.orgcurl -vvv https://files.pythonhosted.org/ 返回什么?
  • @hoefling 请看我上面的编辑,评论太长了。
  • @hoefling,您为什么认为 OP 的 ISP 会阻止 pythonhosted.org?这是我听过的最疯狂的事情!使用 pip 的 --no-cache-dir 标志。
  • @jack-herer 你的评论是我在这里读到的最粗鲁和无知的东西。降低你的语气。
  • @hoefling,我关于您为什么认为 ISP 会阻止该站点的问题是一个严肃而真实的问题,因为这不是任何 ISP 都会阻止的站点!而且我认为您对无知的含义感到困惑,我没有忽略任何事情,我只是在质疑您的评论!也许你是需要冷静的人?

标签: python pip python-requests urllib3 chalice


【解决方案1】:

使用 pip 的 --no-cache-dir 标志来避免这个错误。

【讨论】:

  • OP 明确提到他不能使用--no-cache-dir 标志。
【解决方案2】:

一个远且晚的尝试,但值得一试:

我在缓存一个包时遇到了类似的问题。使用 --no-cache-dir 一切正常,但这不是解决方案。

我找到this answer,并删除了整个pip缓存,砰!

来自docs

缓存目录的默认位置取决于操作 系统:

Unix

~/.cache/pip and it respects the XDG_CACHE_HOME directory.

macOS

~/Library/Caches/pip

窗户

&lt;CSIDL_LOCAL_APPDATA&gt;\pip\Cache

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-11
    • 1970-01-01
    • 1970-01-01
    • 2022-01-04
    • 1970-01-01
    相关资源
    最近更新 更多