Closed a62b8153-9399-4126-ad6e-f02d1f50817f closed 10 years ago
Marc-Andre, I'm on a Macbook pro OSX Mountain Lion
I've been automating virtual environment builds locally and remotely, but it seems that when my "pip install -r requirements.txt" tries to run and download.py in pip/ runs it invokes "platform.py". I'm getting a user-agent issue from the _sys_version function. Here is the error:
File "/Users/me/anaconda/lib/python2.7/platform.py", line 1500, in python_implementation return _sys_version()[0]
File "/Users/me/anaconda/lib/python2.7/platform.py", line 1464, in _sys_version repr(sys_version)) ValueError: failed to parse CPython sys.version: '2.7.5 (default, Sep 12 2013, 21:33:34) \n[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]'
I've found the following stack that also references this error:
I have tried this with a stock Python 2.7.6 version and don't get an error:
>>> platform._sys_version('2.7.5 (default, Sep 12 2013, 21:33:34) \n[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]')
('CPython', '2.7.5', '', '', 'default', 'Sep 12 2013 21:33:34', 'GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)')
The stackoverflow posting you mentioned obviously uses a Python version that was modified in incompatible ways, so it doesn't apply here.
Are you running an Apple version of Python or one that was installed using the python.org installer ?
Marc
Thanks for getting back to me so quickly on this. I'm running an apple version of python from the looks of it. I was running an Anaconda version at the time I posted this script, but I just reset my $PATH variable to use the mac factory python and still got the error.
Python 2.7.5 (default, Sep 12 2013, 21:33:34) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information.
On Wed, Dec 18, 2013 at 5:17 PM, Marc-Andre Lemburg \report@bugs.python.org\wrote:
Marc-Andre Lemburg added the comment:
I have tried this with a stock Python 2.7.6 version and don't get an error:
>>> platform._sys_version('2.7.5 (default, Sep 12 2013, 21:33:34) \n[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]') ('CPython', '2.7.5', '', '', 'default', 'Sep 12 2013 21:33:34', 'GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)')
The stackoverflow posting you mentioned obviously uses a Python version that was modified in incompatible ways, so it doesn't apply here.
Are you running an Apple version of Python or one that was installed using the python.org installer ?
---------- components: +Library (Lib) -2to3 (2.x to 3.x conversion tool)
Python tracker \report@bugs.python.org\ \http://bugs.python.org/issue20019\
On 19.12.2013 00:39, Wes wrote:
Marc
Thanks for getting back to me so quickly on this. I'm running an apple version of python from the looks of it. I was running an Anaconda version at the time I posted this script, but I just reset my $PATH variable to use the mac factory python and still got the error.
Python 2.7.5 (default, Sep 12 2013, 21:33:34) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information.
That looks pretty much the same.
I suspect that either Apple changed something in their Python version or that pip is picking up a non-standard platform.py from somewhere.
Could you check platform.__file__ and sys.version ?
Marc,
Here was the initial output:
>>> platform.__file__
'/Users/wesmadrigal/anaconda/lib/python2.7/platform.pyc'
>>> import sys
>>> sys.version
'2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Nov 11 2013, 10:49:09) \n[GCC
4.0.1 (Apple Inc. build 5493)]'
Here is what I had when I reverted back to the standard $PATH that comes stock in Mac OSX Mountain Lion on this new Macbook Pro:
>>> platform.__file__
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/platform.pyc'
>>> import sys
>>> sys.version
'2.7.5 (default, Sep 12 2013, 21:33:34) \n[GCC 4.2.1 Compatible Apple LLVM
5.0 (clang-500.0.68)]'
On Wed, Dec 18, 2013 at 5:46 PM, Marc-Andre Lemburg \report@bugs.python.org\wrote:
Marc-Andre Lemburg added the comment:
On 19.12.2013 00:39, Wes wrote: > > Marc > > Thanks for getting back to me so quickly on this. I'm running an apple > version of python from the looks of it. I was running an Anaconda version > at the time I posted this script, but I just reset my $PATH variable to use > the mac factory python and still got the error. > > Python 2.7.5 (default, Sep 12 2013, 21:33:34) > [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin > Type "help", "copyright", "credits" or "license" for more information.
That looks pretty much the same.
I suspect that either Apple changed something in their Python version or that pip is picking up a non-standard platform.py from somewhere.
Could you check platform.__file__ and sys.version ?
----------
Python tracker \report@bugs.python.org\ \http://bugs.python.org/issue20019\
The version string does not match either the Apple-supplied Python in 10.8 (Mountain Lion) nor that of a python.org Python. The "anaconda" directory name suggests this is probably a Python from the Anaconda Scientific distribution. There have been other issues with _sys_version as reported on their bug tracker; see https://github.com/ContinuumIO/anaconda-issues/search?q=_sys_version&type=Issues
I just commented out the _sys_version_parser regular expression in anaconda/lib/python2.7/platform.py on line 1363 and replaced it with the _sys_version_parser from /usr/lib/python2.7/platform.py and everything worked fine.
On Wed, Dec 18, 2013 at 5:53 PM, Ned Deily \report@bugs.python.org\ wrote:
Ned Deily added the comment:
The version string does not match either the Apple-supplied Python in 10.8 (Mountain Lion) nor that of a python.org Python. The "anaconda" directory name suggests this is probably a Python from the Anaconda Scientific distribution. There have been other issues with _sys_version as reported on their bug tracker; see https://github.com/ContinuumIO/anaconda-issues/search?q=_sys_version&type=Issues
---------- nosy: +ned.deily
Python tracker \report@bugs.python.org\ \http://bugs.python.org/issue20019\
The shitty part is, you pretty much need anaconda to run iPython notebook on a mac.
On Wed, Dec 18, 2013 at 6:08 PM, Wes Madrigal \wesley7879@gmail.com\ wrote:
I just commented out the _sys_version_parser regular expression in anaconda/lib/python2.7/platform.py on line 1363 and replaced it with the _sys_version_parser from /usr/lib/python2.7/platform.py and everything worked fine.
On Wed, Dec 18, 2013 at 5:53 PM, Ned Deily \report@bugs.python.org\ wrote:
> > Ned Deily added the comment: > > The version string does not match either the Apple-supplied Python in > 10.8 (Mountain Lion) nor that of a python.org Python. The "anaconda" > directory name suggests this is probably a Python from the Anaconda > Scientific distribution. There have been other issues with _sys_version as > reported on their bug tracker; see > https://github.com/ContinuumIO/anaconda-issues/search?q=_sys_version&type=Issues > > ---------- > nosy: +ned.deily > > > Python tracker \report@bugs.python.org\ > \http://bugs.python.org/issue20019\ > >
On 19.12.2013 00:52, Wes wrote:
>
> Marc,
>
> Here was the initial output:
>
>>>> platform.__file__
> '/Users/wesmadrigal/anaconda/lib/python2.7/platform.pyc'
>>>> import sys
>>>> sys.version
> '2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Nov 11 2013, 10:49:09) \n[GCC
> 4.0.1 (Apple Inc. build 5493)]'
The part '|Anaconda 1.8.0 (x86_64)|' in that string is not standard Python conform and as a result, the platform.py parser fails.
You'll have to open a ticket with the Anaconda vendor to get this fixed.
Here is what I had when I reverted back to the standard $PATH that comes stock in Mac OSX Mountain Lion on this new Macbook Pro:
>>> platform.__file__ '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/platform.pyc' >>> import sys >>> sys.version '2.7.5 (default, Sep 12 2013, 21:33:34) \n[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]'
This should parse correctly with the stock platform.py parser.
The only explanation I have is that the platform.py installed on your machine is not the original one that comes with the Python 2.7.5 we distribute from python.org.
I don't have a Mac OSX notebook available to check, so can't really help.
Marc,
Thanks for your help.
What I did was just copied the _sys_version_parser from the standard python platform.py into the anaconda version of platform.py and it fixed the issue. So it looks like Anaconda made a change to your regular expression.
Thanks for getting on the issue so quick and staying with it, though.
On Wed, Dec 18, 2013 at 6:14 PM, Marc-Andre Lemburg \report@bugs.python.org\wrote:
Marc-Andre Lemburg added the comment:
On 19.12.2013 00:52, Wes wrote: > > Marc, > > Here was the initial output: > >>>> platform.__file__ > '/Users/wesmadrigal/anaconda/lib/python2.7/platform.pyc' >>>> import sys >>>> sys.version > '2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Nov 11 2013, 10:49:09) \n[GCC > 4.0.1 (Apple Inc. build 5493)]'
The part '|Anaconda 1.8.0 (x86_64)|' in that string is not standard Python conform and as a result, the platform.py parser fails.
You'll have to open a ticket with the Anaconda vendor to get this fixed.
> Here is what I had when I reverted back to the standard $PATH that comes > stock in Mac OSX Mountain Lion on this new Macbook Pro: > >>>> platform.__file__ > '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/platform.pyc' >>>> import sys >>>> sys.version > '2.7.5 (default, Sep 12 2013, 21:33:34) \n[GCC 4.2.1 Compatible Apple LLVM > 5.0 (clang-500.0.68)]'
This should parse correctly with the stock platform.py parser.
The only explanation I have is that the platform.py installed on your machine is not the original one that comes with the Python 2.7.5 we distribute from python.org.
I don't have a Mac OSX notebook available to check, so can't really help.
----------
Python tracker \report@bugs.python.org\ \http://bugs.python.org/issue20019\
Closing, since there's nothing much we can do about the problem.
I'll submit this to Continuum Analytics so they know it's their issue.
On Thu, Dec 19, 2013 at 3:06 AM, Marc-Andre Lemburg \report@bugs.python.org\wrote:
Marc-Andre Lemburg added the comment:
Closing, since there's nothing much we can do about the problem.
---------- resolution: -> invalid status: open -> closed versions: +3rd party -Python 2.7
Python tracker \report@bugs.python.org\ \http://bugs.python.org/issue20019\
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at =
created_at =
labels = ['invalid', 'library', 'type-crash']
title = 'platform.py line _sys_version function'
updated_at =
user = 'https://bugs.python.org/wesmadrigal'
```
bugs.python.org fields:
```python
activity =
actor = 'wesmadrigal'
assignee = 'none'
closed = True
closed_date =
closer = 'lemburg'
components = ['Library (Lib)']
creation =
creator = 'wesmadrigal'
dependencies = []
files = []
hgrepos = []
issue_num = 20019
keywords = []
message_count = 12.0
messages = ['206560', '206561', '206562', '206563', '206564', '206565', '206566', '206567', '206568', '206569', '206590', '206618']
nosy_count = 3.0
nosy_names = ['lemburg', 'ned.deily', 'wesmadrigal']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = 'crash'
url = 'https://bugs.python.org/issue20019'
versions = ['3rd party']
```