Repository: ipython/ipython

Issue:
ipython setup darwin/CPython error
Hi on some alternative project, ipython is failing to build on a linux system:

<pre>
Searching for ipython>=3.0.0
Reading https://pypi.python.org/simple/ipython/
Best match: ipython 4.1.1
Downloading https://pypi.python.org/packages/source/i/ipython/ipython-4.1.1.zip#md5=445ff597cccb7818c23c988010f62838
Processing ipython-4.1.1.zip
Writing /tmp/easy_install-gDd17B/ipython-4.1.1/setup.cfg
Running ipython-4.1.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-gDd17B/ipython-4.1.1/egg-dist-tmp-QzsqPK
error: Setup script exited with error in ipython setup command: Invalid environment marker: sys_platform == "darwin" and platform_python_implementation == "CPython"
</pre>


fixing the `requirements.txt` like this solves the problem:

<pre>
diff --git a/requirements.txt b/requirements.txt
index 2b00519..1a20c72 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -8,7 +8,7 @@ decorator
 wheel
 pyyaml
 werkzeug
-ipython>=3.0.0
+ipython==4.0.0
 statistics
 requests
 rlp>=0.4.4
</pre>


In short, ipython 4.1.1 is automatically choosen and fails, while 4.0.0 is fine, and it seems related to the following line in `setup.py`:
`207:  ':sys_platform == "darwin" and platform_python_implementation == "CPython"': ['gnureadline'],`

Cheers



Discussion:
You probably need to upgrade setuptools and/or pip.

Hello!
I am glad to have found this issue. It seems like i'm experiencing something similar.
It seems like this may be a bug in the latest setuptools (20.2.2).

> pip list
> pip (8.0.3)
> setuptools (22.2.2)
> wheel (0.29.0)
> 
> python ipython-4.1.1/setup.py egg_info
> error in ipython setup command: Invalid environment marker: sys_platform == "darwin" and python_implementation == "CPython"
> 
> pip list
> pip (8.0.3)
> setuptools (20.0)
> wheel (0.29.0)
> 
> python ipython-4.1.1/setup.py egg_info
> running egg_info
> creating ipython.egg-info
> writing requirements to ipython.egg-info/requires.txt
> writing ipython.egg-info/PKG-INFO
> writing top-level names to ipython.egg-info/top_level.txt
> writing dependency_links to ipython.egg-info/dependency_links.txt
> writing entry points to ipython.egg-info/entry_points.txt
> writing manifest file 'ipython.egg-info/SOURCES.txt'
> warning: manifest_maker: standard file 'setup.py' not found
> reading manifest file 'ipython.egg-info/SOURCES.txt'
> writing manifest file 'ipython.egg-info/SOURCES.txt'

20.1.1 also seems to work.
It seems to me that this may be a setuptools bug.

downgrading to `setuptools==20.1.1` seems to work for me


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -232,13 +232,6 @@ def run(self):
     else:
         install_requires.append('pexpect')
     
-    # workaround pypa/setuptools#147, where setuptools misspells
-    # platform_python_implementation as python_implementation
-    if 'setuptools' in sys.modules:
-        for key in list(extras_require):
-            if 'platform_python_implementation' in key:
-                new_key = key.replace('platform_python_implementation', 'python_implementation')
-                extras_require[new_key] = extras_require.pop(key)
 
 everything = set()
 for key, deps in extras_require.items():


Test patch: