How do I use pip with Python 3.6 on Ubuntu 14.04?

I am trying to install Python 3.6 as per this answer, but I seem to be having troubles. My system is the following (it's on c9.io):

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty

When I follow the instructions in the answer (add deadsnakes repository, apt-get update, sudo apt-get install python3.6), it seems to work, i.e I can run the command python3.6 and the interpreter fires up.

However, when I try to use pip from inside this using python3.6 -m pip --version, I get the following error:

Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "/usr/lib/python3.6/runpy.py", line 142, in _get_module_details return _get_module_details(pkg_main_name, error) File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details __import__(pkg_name) File "/usr/lib/python3/dist-packages/pip/__init__.py", line 59, in <module> from pip.log import logger File "/usr/lib/python3/dist-packages/pip/log.py", line 9, in <module> import colorama, pkg_resources File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 656, in _load_unlocked File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible File "/usr/share/python-wheels/", line 1479, in <module> register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'

Googling a bit, I get this SO answer. However, when I run the command:

sudo pip3 install --upgrade pip

I now get the following problem:

Requirement already up-to-date: pip in /usr/local/lib/python3.4/dist-packages (18.0)

Uninstalling and installing python3.6 again doesn't help. I still get the same error when trying to run pip. How do I fix this?

EDIT in responses to duplicate:

The alleged duplicate's top answer does not seem to work for me. I ran the following command:

$ curl | sudo python3.6

From there I got this result:

 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
100 1604k 100 1604k 0 0 4637k 0 --:--:-- --:--:-- --:--:-- 4649k
Traceback (most recent call last): File "<stdin>", line 20651, in <module> File "<stdin>", line 197, in main File "<stdin>", line 119, in bootstrap File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 12, in <module> from setuptools.extension import Extension File "/usr/lib/python3/dist-packages/setuptools/extension.py", line 7, in <module> from setuptools.dist import _get_unpatched File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 16, in <module> import pkg_resources File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1479, in <module> register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'

Bear in mind that I did this with a completely new environment (i.e I first installed python, then ran get-pip.py).

What should I do?

7 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like