Search code examples
pythonpython-2.7pippexpect

"AssertionError: Only python 2.7 and later is supported by ptyprocess", when installing pexpect via pip on python 2.6


I got following error when trying install pexpect via pip:

# pip install pexpect
Collecting pexpect
do_ypcall: clnt_call: RPC: Unable to receive; errno = Connection refused
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached pexpect-4.0.tar.gz
Collecting ptyprocess>=0.5 (from pexpect)
  Using cached ptyprocess-0.5.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-2X4It7/ptyprocess/setup.py", line 10, in <module>
        "Only python 2.7 and later is supported by ptyprocess.")
    AssertionError: Only python 2.7 and later is supported by ptyprocess.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-2X4It7/ptyprocess

It's pretty clear that downloaded ptyprocess works only with python 2.7, but doesn't pip should download correct packages versions, that are compatible with installed python versions?

My system info:

pip -V: pip 7.1.2 from /usr/lib/python2.6/site-packages (python 2.6)

python -V: Python 2.6.6

OS: CentOS 6.3

BTW: yum install pexpect succesfully installs pexpect package

Thank You


Solution

  • AssertionError: Only python 2.7 and later is supported by ptyprocess.

    pyexpect depends on ptyprocess>=0.5 (https://github.com/pexpect/pexpect/blob/master/setup.py#L66)

    You will need to install a version of ptyprocess that is >=0.5 but works with python 2.6 first, then install pyexpect.

    edit looks like you are out of luck, 0.5 requires python 2.7 (https://github.com/pexpect/ptyprocess/blob/master/setup.py#L9-L10). Your system package has it patched to work with 2.6 so you'll have to use that.