20

When I tried installing Flask I got this error:

ImportError: No module named packaging.version
SparkAndShine
18.2k27 gold badges100 silver badges140 bronze badges
asked Feb 16, 2017 at 23:08

6 Answers 6

15

To fix this, I had to do:

pip install setuptools
answered Feb 16, 2017 at 23:09
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks man. That worked like a charm, after wasting about an hour Googling for the error. :)
12

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.

Pang
10.2k146 gold badges87 silver badges126 bronze badges
answered Feb 20, 2017 at 3:48

Comments

7

Try this

wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
answered Mar 3, 2017 at 16:41

2 Comments

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.
I encountered this error on macOS after upgrading to High Sierra and re-installing MacPorts. Nothing worked until I tried this.
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
answered Apr 17, 2017 at 20:43

Comments

1

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

answered Dec 12, 2022 at 15:41

2 Comments

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.
I was getting the same error in 21.3 too. But I installed 23.1 and it worked.
0

i also have the problem when i install kats module, after try install a older packaging, such as "pip install packaging==21.0", i sovled my problem. hope helpfull.

answered Dec 24, 2024 at 7:09

1 Comment

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.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.