ImportError: No module named packaging.version
Asked Answered
U

5

18

When I tried installing Flask I got this error:

ImportError: No module named packaging.version
Underneath answered 16/2, 2017 at 23:8 Comment(0)
U
15

To fix this, I had to do:

pip install setuptools
Underneath answered 16/2, 2017 at 23:9 Comment(1)
Thanks man. That worked like a charm, after wasting about an hour Googling for the error. :)Alcoran
C
13

If your Python runs on Ubuntu, try to do this:

cd /usr/local/lib/python2.7/dist-packages
mv pkg_resources/ pkg_resources_bak/

I'm not sure what package installed the "pkg_resources", it will make pip always show error.

Coupler answered 20/2, 2017 at 3:48 Comment(0)
C
7

Try this

wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
Cercus answered 3/3, 2017 at 16:41 Comment(2)
I was having the above-mentioned error on my raspberry pi model B. If anyone else comes here with my problem, this answer fixed it for me.Dialectician
I encountered this error on macOS after upgrading to High Sierra and re-installing MacPorts. Nothing worked until I tried this.Stacked
D
4

As an Ubuntu 14.04 user, upgrading pip to version 9.0.1 fixed this problem for me.

Upgrading pip normally

  • Download get-pip.py script
  • Run: python get-pip.py

Upgrading/installing pip behind a corporate firewall

  • Download get-pip.py script, along with pip, wheel, and setuptools from pypi
  • Place all files in the /tmp directory
  • Run the following command to install pip: sudo -H python /tmp/get-pip.py --no-index --find-links=/tmp pip
Detector answered 17/4, 2017 at 20:43 Comment(0)
P
1

In case anyone stumbles upon this problem, my solution was to change the packaging version from 22.0 to 21.3.

Pewit answered 12/12, 2022 at 15:41 Comment(2)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Sanson
I was getting the same error in 21.3 too. But I installed 23.1 and it worked.Isabellisabella

© 2022 - 2024 — McMap. All rights reserved.