nz_21
nz_21

Reputation: 7393

Unable to install pip for python 3.7 after updating from 3.6

I recently tried to upgrade my python 3.6 to pyhon 3.7 follwing the instruction here:

https://askubuntu.com/questions/1086649/how-to-update-python-to-the-latest-version-on-ubuntu-18-04

Now, I'm trying to install pip for python 3.7

python3.7 -m pip install pip

I get an error:

OFPEPFE
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.7/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.7/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 22, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 61, in <module>
    sys.path[:] = glob.glob(os.path.join(WHEEL_DIR, "*.whl")) + sys.path
AttributeError: module 'glob' has no attribute 'glob'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 21, in <module>
    from urllib.request import urlopen
  File "/usr/lib/python3.7/urllib/request.py", line 88, in <module>
    import http.client
  File "/usr/lib/python3.7/http/client.py", line 71, in <module>
    import email.parser
ModuleNotFoundError: No module named 'email.parser'; 'email' is not a package

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.7/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.7/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 22, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 61, in <module>
    sys.path[:] = glob.glob(os.path.join(WHEEL_DIR, "*.whl")) + sys.path
AttributeError: module 'glob' has no attribute 'glob'

How do I fix this?

Upvotes: 2

Views: 1732

Answers (1)

d_kennetz
d_kennetz

Reputation: 5359

run the following to update your package list:

sudo apt update

then install pip

sudo apt install python3.7-pip

check that it is correct:

pip3 --version

or more specifically you should be able to:

pip3.7 --version

pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.7)

Upvotes: 1

Related Questions