Tuesday, 7 February 2017

ImportError: No module named packaging.version

Recently, I face ImportError: No module named packaging.version  and I would like to share knowledge to fix that problem.

Terminal:

pip --version
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)



I am trying to upgrade pip

python -m pip install -U pip

    Traceback (most recent call last):
      File "<string>", line 3, in <module>
      File "setuptools/__init__.py", line 12, in <module>
        import setuptools.version
      File "setuptools/version.py", line 1, in <module>
        import pkg_resources
      File "pkg_resources/__init__.py", line 70, in <module>
        import packaging.version
    ImportError: No module named packaging.version
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 3, in <module>

  File "setuptools/__init__.py", line 12, in <module>

    import setuptools.version

  File "setuptools/version.py", line 1, in <module>

    import pkg_resources

  File "pkg_resources/__init__.py", line 70, in <module>

    import packaging.version

ImportError: No module named packaging.version



Solution:

sudo su root

apt-get purge -y python-pip


wget https://bootstrap.pypa.io/get-pip.py


python ./get-pip.py


apt-get install python-pip



13 comments:

  1. Thanks, this helped with my pip install on Debian 8 in order to run Jupyter.

    ReplyDelete
  2. Thanks a lot. It works for pip3 too.

    Just change the following:
    apt-get purge -y python3-pip
    wget https://bootstrap.pypa.io/get-pip.py
    python3 ./get-pip.py
    apt-get install python3-pip

    ReplyDelete
  3. Thanks a ton :)

    ReplyDelete
  4. Thanks a lot bro.. you saved my life

    ReplyDelete
  5. really thanks !

    ReplyDelete

Error: Hash Sum mismatch in GitLab

Recently, I have faced following error during instillation of Gitlab in Ubuntu. odedra@odedra-Lenovo-Z50-70:~$ sudo apt-get install gitla...