You are not logged in.

#1 2016-10-08 15:49:27

brainiac
Member
Registered: 2007-11-08
Posts: 26

I broke Python. Any Advice on how to fix it?

Some time ago i had trouble with a Python Program and did some(probably dumb and noobie) stuff(can't reallly remember what exactly) to fix it.
I didn't realize then that i had broke something.
Now i have this problem. Running pip gives me following output.

Traceback (most recent call last):
  File "/usr/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 71, in <module>
    from pkg_resources.extern import packaging
  File "/usr/lib/python3.5/site-packages/pkg_resources/extern/__init__.py", line 61, in load_module
    "distribution.".format(**locals())
ImportError: The 'packaging' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.

the same when updating some packages from AUR

Example

AUR Packages  (1) python-libusb1-1.5.3-1  

:: Proceed with installation? [Y/n] y
:: Retrieving package(s)...
:: python-libusb1 build files are up-to-date -- skipping
:: Checking python-libusb1 integrity...
==> Making package: python-libusb1 1.5.3-1 (Sat Oct  8 17:55:18 CEST 2016)
==> Retrieving sources...
  -> Updating python-libusb1 git repo...
Fetching origin
==> Validating source files with md5sums...
    python-libusb1 ... Skipped
:: Building python-libusb1 package(s)...
==> Making package: python-libusb1 1.5.3-1 (Sat Oct  8 17:55:19 CEST 2016)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating python-libusb1 git repo...
Fetching origin
==> Validating source files with md5sums...
    python-libusb1 ... Skipped
==> Extracting sources...
  -> Creating working copy of python-libusb1 git repo...
Reset branch 'makepkg'
==> Removing existing $pkgdir/ directory...
==> Starting build()...
Traceback (most recent call last):
  File "setup.py", line 16, in <module>
    from setuptools import setup
  File "/usr/lib/python3.5/site-packages/setuptools/__init__.py", line 10, in <module>
    from setuptools.extern.six.moves import filter, filterfalse, map
  File "/usr/lib/python3.5/site-packages/setuptools/extern/__init__.py", line 1, in <module>
    from pkg_resources.extern import VendorImporter
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 71, in <module>
    from pkg_resources.extern import packaging
  File "/usr/lib/python3.5/site-packages/pkg_resources/extern/__init__.py", line 61, in load_module
    "distribution.".format(**locals())
ImportError: The 'packaging' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
==> ERROR: A failure occurred in build().
    Aborting...
:: failed to build python-libusb1 package(s)

Its really hard for me to pinpoint the problem. My google-foo is weak on this one. I found some threads with the same problem but i really am lost on how to fix it.
Any advice on how to proceed? Any way to restore the default python state?

Last edited by brainiac (2016-10-08 15:56:47)

Offline

#2 2016-10-08 15:56:30

lockedout
Member
Registered: 2016-10-05
Posts: 2

Re: I broke Python. Any Advice on how to fix it?

ls -al /bin |grep python 

post output please.

EDIT: To clarify, your problem probably has to do with different versions of python being installed (which is fine). Follow this to fix:

http://stackoverflow.com/questions/1126 … python-2-x

Last edited by lockedout (2016-10-08 15:59:31)

Offline

#3 2016-10-08 15:57:44

brainiac
Member
Registered: 2007-11-08
Posts: 26

Re: I broke Python. Any Advice on how to fix it?

lockedout wrote:
ls -al /bin |grep python 

post output please.

No Output from that

Offline

#4 2016-10-08 15:58:59

brainiac
Member
Registered: 2007-11-08
Posts: 26

Re: I broke Python. Any Advice on how to fix it?

⬢  ~  ls -al /bin/ | grep python give the following

lrwxrwxrwx  1 root root         46 Aug 12 23:25 lirc-setup -> ../lib/python3.5/site-packages/lirc/lirc-setup
lrwxrwxrwx  1 root root          7 Jun 28 11:03 python -> python3
lrwxrwxrwx  1 root root          9 Jun 28 10:37 python2 -> python2.7
-rwxr-xr-x  1 root root       6312 Jun 28 10:37 python2.7
-rwxr-xr-x  1 root root       1681 Jun 28 10:37 python2.7-config
lrwxrwxrwx  1 root root         16 Jun 28 10:37 python2-config -> python2.7-config
lrwxrwxrwx  1 root root          9 Jun 28 11:03 python3 -> python3.5
-rwxr-xr-x  2 root root      10464 Jun 28 11:03 python3.5
lrwxrwxrwx  1 root root         17 Jun 28 11:03 python3.5-config -> python3.5m-config
-rwxr-xr-x  2 root root      10464 Jun 28 11:03 python3.5m
-rwxr-xr-x  1 root root       3129 Jun 28 11:03 python3.5m-config
lrwxrwxrwx  1 root root         16 Jun 28 11:03 python3-config -> python3.5-config
lrwxrwxrwx  1 root root         14 Jun 28 11:03 python-config -> python3-config

Offline

#5 2016-10-08 16:00:20

lockedout
Member
Registered: 2016-10-05
Posts: 2

Re: I broke Python. Any Advice on how to fix it?

Just for the case you missed my edit, go here to solve your problem:

http://stackoverflow.com/questions/1126 … python-2-x

Offline

#6 2016-10-08 16:00:30

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: I broke Python. Any Advice on how to fix it?

Have you installed packages with the python pip command in the system directories of the Arch packages? That's a bad idea, because pip will inevitably conflict with pacman and the Arch update process. You can use python virtualenv (provided in the package python-virtualenv) to make a virtual python environment which will help you to keep a clean system. Any packages installed by pip will land in the virtual environment.

To fix your problem; unless you know precisely what you have broken (but apparently you do not); the best solution is to uninstall the python package (use the -dd option to override dependencies). Remove any python leftover you have installed (just use the find command; they should be in /usr/lib/python2 or /usr/lib/python or /usr/include/python); then reinstall python.

Offline

#7 2016-10-08 16:02:06

brainiac
Member
Registered: 2007-11-08
Posts: 26

Re: I broke Python. Any Advice on how to fix it?

Yeah. Thanks olive. I think you are right.

Will try that.

Offline

#8 2016-10-09 00:30:41

basica
Member
From: Australia
Registered: 2012-10-31
Posts: 217

Re: I broke Python. Any Advice on how to fix it?

Just for future reference, the arch repos provide pip for both 2 and 3 (3 being the default).

[basica@someplace ~]$ pacman -Ss python pip
extra/python-pip 8.1.2-1
    The PyPA recommended tool for installing Python packages
extra/python2-pip 8.1.2-1
    The PyPA recommended tool for installing Python packages

Installing via the repos will basically give you the functionality present in that SO post.

Offline

Board footer

Powered by FluxBB