Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named packaging

I work on Ubuntu 14. I install python3 and pip3. When I try to use pip3, I have this error

Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 70, i
n <module>
    import packaging.version
ImportError: No module named 'packaging'

Does someone know what is the issue?

Many thanks

like image 209
Raouf Avatar asked Feb 14 '17 09:02

Raouf


2 Answers

First update your pip version itself. You can take a look at this answer

pip3 install --upgrade pip

And then try to install packaging, if its not already installed by now.

pip3 install packaging
like image 123
Vivek Kumar Avatar answered Oct 16 '22 21:10

Vivek Kumar


If I understand well, the issue that causes confusion in other's replies is that you have an error while running pip itself, which prevents self-updates of pip or installation of the missing package.

As requested, please state exactly how you installed Python 3 and pip. Ubuntu 14 does not come with Python 3.5.

For diagnosis, please give the output of

which python3

that is probably /usr/bin/python3 and refers to the system-wide python3 while your pip is located in /usr/local/bin/pip3.

Suggested solution: Uninstall system pip with apt-get remove python3-pip and try again with either pip3 or python3.5 -m pip.

like image 35
Pierre de Buyl Avatar answered Oct 16 '22 19:10

Pierre de Buyl