0

I am trying to install python3.7 and pip on Ubuntu14.04, using this dockerfile:

FROM ubuntu:14.04

RUN apt update -y && apt install -y software-properties-common && add-apt-repository ppa:deadsnakes/ppa && apt -y update
RUN apt-get install -y python3.7
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.4 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
RUN apt install -y python3-pip

Build and run:

$ docker build -t doc .
$ docker run -it --rm doc bash

In container change python config: select option 2

$ update-alternatives --config python3

Then running pip3 returns this:

Traceback (most recent call last):
  File "/usr/bin/pip3", line 5, in <module>
    from pkg_resources import load_entry_point
  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'

The same steps on ubuntu18.04 work fine. Any suggestions?

  • https://stackoverflow.com/search?q=%5Bpip%5D+AttributeError%3A+module+%27importlib._bootstrap%27+has+no+attribute+SourceFileLoader – phd Jun 17 '20 at 11:07

1 Answers1

0

Please run this command:

python3 -m ensurepip --upgrade

kefi Kefi
  • 128
  • 10