由于 SNI 警告无法更新 spyder

Cannot update spyder due to SNI warning

我在 Ubuntu 14.04.5 上有 python 2.7.6 和 spyder 2.2.5。我无法连接到 Ipython 控制台,所以我决定更新 spyder:

pip install spyder --upgrade

它抛出以下错误。置顶的文字是:

/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.

完整堆栈跟踪:

/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Collecting spyder
  Downloading spyder-3.1.4-py2-none-any.whl (3.5MB)
    100% |████████████████████████████████| 3.5MB 387kB/s 
Requirement already up-to-date: pygments>=2.0 in /usr/local/lib/python2.7/dist-packages (from spyder)
Requirement already up-to-date: jedi>=0.9.0 in /usr/local/lib/python2.7/dist-packages (from spyder)
Requirement already up-to-date: pyflakes in /usr/local/lib/python2.7/dist-packages (from spyder)
Requirement already up-to-date: pylint in /usr/local/lib/python2.7/dist-packages (from spyder)
Requirement already up-to-date: nbconvert in /usr/local/lib/python2.7/dist-packages (from spyder)
Requirement already up-to-date: qtpy>=1.1.0 in /usr/local/lib/python2.7/dist-packages (from spyder)
Requirement already up-to-date: pyzmq in /usr/local/lib/python2.7/dist-packages (from spyder)
Collecting numpydoc (from spyder)
  Downloading numpydoc-0.6.0.tar.gz
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run
    wb.build(autobuilding=True)
  File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 634, in _prepare_file
    abstract_dist.prep_for_dist()
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 129, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 412, in run_egg_info
    self.setup_py, self.name,
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 387, in setup_py
    import setuptools  # noqa
  File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 12, in <module>
    import setuptools.version
  File "/usr/local/lib/python2.7/dist-packages/setuptools/version.py", line 1, in <module>
    import pkg_resources
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 72, in <module>
    import packaging.requirements
  File "/usr/local/lib/python2.7/dist-packages/packaging/requirements.py", line 59, in <module>
    MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)

我尝试安装一些其他软件包,如 ndg-httpsclienturllib3[secure],但没有成功。它抛出完全相同的错误。我无法升级 python 本身。有人可以帮忙吗?

注意:我已经安装了 python-dev libffi-dev libssl-dev

原来我的requirements.py有问题(如错误提示)。我不知道它是否会对未来造成伤害,但向 MARKER_EXPR() 函数添加一个空字符串可以修复它。

MARKER_EXPR = originalTextFor(MARKER_EXPR(""))("marker")