Pip Install Twisted Error 1

送分小仙女□ 提交于 2019-11-28 20:17:21

I had the same issue on a Mac OSX 10.11.6 in a new virtualenv with a fresh install of Python3.6.1. In my case, I had old versions of the Twisted dependency incremental installed, which prevented the installation.

pip install --upgrade incremental
pip install Twisted

Note I: I was installing a whole array of packages from a requirements file where the same incremental version was specified. I really wonder why the upgrade of incremental helped and have no clue what actually went wrong. If someone can clarify, that would be great.

Note II: Installing incremental ahead of of Twisted seems to be necessary on fresh installs, too [Experienced when working with CentOS7].

Note III: The issue was communicated to the amazing Twisted community and once Twisted ticket #9457 is implemented and in the release this question and my answer should become obsolete.

Jean-Paul Calderone

The error you reported is incomplete. There are almost certainly more details above it in the pip output. It would help if edit them into your question.

A survey of similar questions:

Suggests that:

  • You're missing setuptools. Inside a virtualenv (you did activate your virtualenv, right?) this seems implausible.
  • You're missing part of the C toolchain - a compiler, some necessary headers, etc. Twisted includes C extensions so this seems possible. Do you have a C toolchain?
  • You're using an incompatible version of Python. What version of Python are you using?

But the additional certificate verification failure errors you've included suggest it's not caused by any of these. Instead, a dependency cannot be downloaded because pip can't do a TLS handshake with the PyPI server it needs to download the dependency from.

This could be caused by many different things. Can your system's browsers load https://pypi.python.org/? If not, perhaps there's something wrong system-wide: you might have outdated certificate authority certificates or there might be a man-in-the-middle attack taking place.

openssl s_client can sometimes be useful for debugging issues like these. Try:

openssl s_client -showcerts -connect pypi.python.org:443

This may give you more details about what's happening at the TLS layer. If openssl s_client also has trouble verifying the certificate, you know there's something wrong system-wide. If not, we can narrow it down to a pip or Python problem.

FWIW I was getting the same bogus error trying to install twisted:

distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('incremental>=16.10.1')

In my case I had accidentally installed an ancient setuptools that was messing up pip. It came from a python setup.py install of a zfec 1.4.22 tarball.

I fixed this by removing that setuptools (rm -rf /usr/local/lib/python2.7/dist-packages/setuptools-0*). This allowed the pip install twisted to work and allowed me to specify a version (twisted==18.9.0). The old setuptools was also causing latest twisted 19 to be installed in some situations.

Try upgrading pip packages.

sudo pip install --upgrade pip

and Twisted has two required dependencies:

Installing a C compiler Since installing Twisted from source involves compiling C code, on OS X or Windows you’ll need to install a C compiler before you can install Twisted.

Installing zope.interface When installing from source, before you can use Twisted, you’ll also need to install zope.interface, which you can download from the Twisted home page.

And install it with your steps or follow this link

I had a similar problem when installing Twisted on my MacBook, after trying many different ways, I successfully install Twisted using conda.

You can try it, using either Anaconda or miniconda.

https://conda.io/docs/download.html

https://stackoverflow.com/a/20994790/1294704

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!