Pip Install Twisted Error 1

后端 未结 5 1876
半阙折子戏
半阙折子戏 2020-12-14 07:16

When using pip install Twisted in virtualenv on Mac osx 10.9.4, I get this result:

Command \"python setup.py egg_info\" failed with error code 1

相关标签:
5条回答
  • 2020-12-14 07:29

    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.

    0 讨论(0)
  • 2020-12-14 07:43

    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

    0 讨论(0)
  • 2020-12-14 07:44

    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

    0 讨论(0)
  • 2020-12-14 07:53

    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:

    • Python pip install gives "Command "python setup.py egg_info" failed with error code 1"
    • Can't install via pip because of egg_info error
    • Python pip install fails: invalid command egg_info
    • https://github.com/donnemartin/gitsome/issues/4

    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.

    0 讨论(0)
  • 2020-12-14 07:54

    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.

    0 讨论(0)
提交回复
热议问题