You are not logged in.

#1 2016-02-28 10:48:53

mexus
Member
Registered: 2015-11-28
Posts: 14

[SOLVED] An issue with python after a system upgrade

Hi everyone!

After a recent system upgrade I've found that I'm not able to use the 'escrotum' application anymore:

Traceback (most recent call last):
  File "/usr/bin/escrotum", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 78, in <module>
    __import__('pkg_resources.extern.packaging.requirements')
  File "/usr/lib/python2.7/site-packages/pkg_resources/extern/__init__.py", line 42, in load_module
    __import__(extant)
  File "/usr/lib/python2.7/site-packages/packaging/requirements.py", line 59, in <module>
    MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)

At first I've thought that I should reinstall the package (escrotum-git from the AUR), but it failed with the very same error message.
While I'm using python for my needs from time to time, I'm not really good with it and it is mostly just a black box for me.
Having said that, I've tried to dig in a little bit and ended up with a minimal python example that reveals the problem:

from pkg_resources import load_entry_point

Yes, just a one-liner. Apparently it doesn't have to do anything with the 'escrotum' itself.

While it works with python3, it does not with python2. And my system is up to date:

/usr/lib/python2.7/site-packages/packaging/requirements.py is owned by python2-packaging 16.5-1
/usr/lib/python2.7/site-packages/pkg_resources/__init__.py is owned by python2-setuptools 1:20.2.2-1

Any ideas how to fix it?

Thanks for you attention!

Last edited by mexus (2016-02-28 13:05:47)

Offline

#2 2016-02-28 11:04:54

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,788
Website

Re: [SOLVED] An issue with python after a system upgrade

Mod note: moving to AUR issues.

Last edited by WorMzy (2016-02-28 11:23:11)


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

#3 2016-02-28 11:06:33

mexus
Member
Registered: 2015-11-28
Posts: 14

Re: [SOLVED] An issue with python after a system upgrade

@WorMzy, it's not an AUR issue: I've provide a minimal example that does not relate to an AUR package. It's just happened to be uncovered with the AUR package smile

Offline

#4 2016-02-28 11:22:43

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,788
Website

Re: [SOLVED] An issue with python after a system upgrade

Hm, I may have been too hasty there. However, your example works fine for me:

$ python2 
Python 2.7.11 (default, Dec  6 2015, 15:43:46) 
[GCC 5.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pkg_resources import load_entry_point
>>> 

My system is also up-to-date:

$ pacman -Qo /usr/lib/python2.7/site-packages/packaging/requirements.py /usr/lib/python2.7/site-packages/pkg_resources/__init__.py
/usr/lib/python2.7/site-packages/packaging/requirements.py is owned by python2-packaging 16.5-1
/usr/lib/python2.7/site-packages/pkg_resources/__init__.py is owned by python2-setuptools 1:20.2.2-1

and my files have the same content on the lines listed in your traceback:

$ sed -n '5p' /usr/bin/escrotum 
from pkg_resources import load_entry_point
$ sed -n '78p' /usr/lib/python2.7/site-packages/pkg_resources/__init__.py 
__import__('pkg_resources.extern.packaging.requirements')
$ sed -n '42p' /usr/lib/python2.7/site-packages/pkg_resources/extern/__init__.py                                
                __import__(extant)
$ sed -n '59p' /usr/lib/python2.7/site-packages/packaging/requirements.py
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")

Possibly there is a problem with your python environment. Do you set any python variables in your .bashrc, etc.?

Mod note: moving to Programming and Scripting.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

#5 2016-02-28 11:32:27

mexus
Member
Registered: 2015-11-28
Posts: 14

Re: [SOLVED] An issue with python after a system upgrade

Well, anything could happen smile

I've tried to run it from BASH (i didn't configure it at all) with the same result, and here is my environment:

XDG_VTNR=3
XDG_SESSION_ID=c5
ANDROID_HOME=/opt/android-sdk
ANDROID_SWT=/usr/share/java
TERM=linux
SHELL=/bin/bash
OLDPWD=/home/mexus
USER=mexus
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
MAIL=/var/spool/mail/mexus
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
HG=/usr/bin/hg
PWD=/home/mexus/test/python
LANG=en_US.UTF-8
SHLVL=1
XDG_SEAT=seat0
HOME=/home/mexus
LOGNAME=mexus
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
LESSOPEN=|/usr/bin/lesspipe.sh %s
XDG_RUNTIME_DIR=/run/user/1000
_=/usr/bin/env

Offline

#6 2016-02-28 11:41:02

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,788
Website

Re: [SOLVED] An issue with python after a system upgrade

Can you post the output of 'which python2'?


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

#7 2016-02-28 11:44:45

mexus
Member
Registered: 2015-11-28
Posts: 14

Re: [SOLVED] An issue with python after a system upgrade

Sure! Here it goes:

which python2
/usr/bin/python2
yaourt -Qo $(which python2)
/usr/bin/python2 is owned by python2 2.7.11-1

Just to be sure I've reinstalled the python2 package, but the "test" still fails for me. Looks like some magic is involved!

Offline

#8 2016-02-28 12:14:05

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,788
Website

Re: [SOLVED] An issue with python after a system upgrade

Okay, how about 'pacman -Qkk python2 python2-packaging python2-setuptools'?


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

#9 2016-02-28 12:15:04

mexus
Member
Registered: 2015-11-28
Posts: 14

Re: [SOLVED] An issue with python after a system upgrade

Wow, i didn't know pacman can even detect altered files! Awesome:)

pacman -Qkk python2 python2-packaging python2-setuptools
python2: 4720 total files, 0 altered files
python2-packaging: 29 total files, 0 altered files
python2-setuptools: 156 total files, 0 altered files

Offline

#10 2016-02-28 12:21:48

mexus
Member
Registered: 2015-11-28
Posts: 14

Re: [SOLVED] An issue with python after a system upgrade

felixonmars from #archlinux on freenode advised me to run the script with a "python2-hunter", so I've run

env PYTHONHUNTER="module_startswith=['packaging']" python2 -c "from pkg_resources import load_entry_point"

And here is an output: https://ptpb.pw/uiHl (it's too large to include it in the post). Maybe it would help.

Offline

#11 2016-02-28 13:05:33

mexus
Member
Registered: 2015-11-28
Posts: 14

Re: [SOLVED] An issue with python after a system upgrade

With the help of guys from #archlinux (freenode) the issue was solved: for some reason there was a "pyparsing.py" file in the "~/.local/lib/python2.7/site-packages", and removing it solved the issue.
I still wonder why python haven't told me anything about this file, but I'll leave it to the conscience of python developers smile

Offline

#12 2016-02-28 13:07:05

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,788
Website

Re: [SOLVED] An issue with python after a system upgrade

Thanks for reporting back. Out of interest, how did you find out about that file?


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

#13 2016-02-28 13:11:01

mexus
Member
Registered: 2015-11-28
Posts: 14

Re: [SOLVED] An issue with python after a system upgrade

I was asked to check the python's sys.path, and it told me about the "~/.local" path, so I looked there and found the nasty pyparsing file. And at the moment i saw it, its faith was already decided cool

Offline

Board footer

Powered by FluxBB