Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

platform.py line _sys_version function #64218

Closed
wesmadrigal mannequin opened this issue Dec 18, 2013 · 12 comments
Closed

platform.py line _sys_version function #64218

wesmadrigal mannequin opened this issue Dec 18, 2013 · 12 comments
Labels
stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@wesmadrigal
Copy link
Mannequin

wesmadrigal mannequin commented Dec 18, 2013

BPO 20019
Nosy @malemburg, @ned-deily

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:

assignee = None
closed_at = <Date 2013-12-19.09:06:27.182>
created_at = <Date 2013-12-18.23:08:47.067>
labels = ['invalid', 'library', 'type-crash']
title = 'platform.py line _sys_version function'
updated_at = <Date 2013-12-19.15:22:09.425>
user = 'https://bugs.python.org/wesmadrigal'

bugs.python.org fields:

activity = <Date 2013-12-19.15:22:09.425>
actor = 'wesmadrigal'
assignee = 'none'
closed = True
closed_date = <Date 2013-12-19.09:06:27.182>
closer = 'lemburg'
components = ['Library (Lib)']
creation = <Date 2013-12-18.23:08:47.067>
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']

@wesmadrigal
Copy link
Mannequin Author

wesmadrigal mannequin commented Dec 18, 2013

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:

http://stackoverflow.com/questions/19105255/praw-failed-to-parse-cpython-sys-version-when-creating-reddit-object

@wesmadrigal wesmadrigal mannequin added topic-2to3 type-crash A hard crash of the interpreter, possibly with a core dump labels Dec 18, 2013
@malemburg
Copy link
Member

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 ?

@malemburg malemburg added stdlib Python modules in the Lib dir and removed topic-2to3 labels Dec 18, 2013
@wesmadrigal
Copy link
Mannequin Author

wesmadrigal mannequin commented Dec 18, 2013

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\>


@malemburg
Copy link
Member

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 ?

@wesmadrigal
Copy link
Mannequin Author

wesmadrigal mannequin commented Dec 18, 2013

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\>


@ned-deily
Copy link
Member

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

@wesmadrigal
Copy link
Mannequin Author

wesmadrigal mannequin commented Dec 19, 2013

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\>


@wesmadrigal
Copy link
Mannequin Author

wesmadrigal mannequin commented Dec 19, 2013

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\>
> _______________________________________
>

@malemburg
Copy link
Member

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.

@wesmadrigal
Copy link
Mannequin Author

wesmadrigal mannequin commented Dec 19, 2013

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\>


@malemburg
Copy link
Member

Closing, since there's nothing much we can do about the problem.

@wesmadrigal
Copy link
Mannequin Author

wesmadrigal mannequin commented Dec 19, 2013

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\>


@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

2 participants