2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[事故] pipが使えなくなった [とてもしょうもないメモ]

Posted at

注意

とてもしょーもないです orz が、とてもくやしかったので記録として残しておきます。 orz orz orz

概要

pipが以下のようなエラーを吐いて動作しなくなってしまいました。

% pip3 install --user --upgrade django                                                                                                                                                                                                                                
Collecting django                                                                                                                                                                                                                                                                 
Exception:                                                                                                                                                                                                                                                                        
Traceback (most recent call last):                                                                                                                                                                                                                                                
  File "/home/rare/.local/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/commands/install.py", line 335, in run
    wb.build(autobuilding=True)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/home/rare/.local/lib/python3.6/site-packages/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/home/rare/.local/lib/python3.6/site-packages/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/home/rare/.local/lib/python3.6/site-packages/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/index.py", line 792, in get_page
    "Cache-Control": "max-age=600",
  File "/home/rare/.local/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 488, in get
    return self.request('GET', url, **kwargs)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/home/rare/.local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 589, in urlopen
    self._prepare_proxy(conn)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 797, in _prepare_proxy
    conn.connect()
  File "/home/rare/.local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connection.py", line 254, in connect
    conn = self._new_conn()
  File "/home/rare/.local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connection.py", line 142, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/home/rare/.local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/util/connection.py", line 66, in create_connection
    if host.startswith('['):
AttributeError: 'NoneType' object has no attribute 'startswith'

事故原因

% env | grep proxy
ftp_proxy=http://
http_proxy=http://
https_proxy=http://

原因の原因

% cat /etc/environment
ftp_proxy=http://
http_proxy=http://
https_proxy=http://

まとめ

何故上記のような設定が紛れたのか、とんと検討つきません……。さようなら、私の2時間。
なお、pipに --verbose オプションつけたりとかで確認進めました。

2
2
2

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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?