Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install PIP3 and PYTHON3.7 on Docker Ubuntu 18.04

I have to install Python3.7 and pip3 for Python3.7 on my Docker Ubuntu18.04. I can install the 3.7, but I cannot get rid of pip3 for Python3.6:

FROM ubuntu:18.04
# ...
RUN apt-get update && apt-get install -y \
        software-properties-common
    RUN add-apt-repository ppa:deadsnakes/ppa
    RUN apt-get update && apt-get install -y \
        python3.7 \
        python3-pip
    RUN python3.7 -m pip install pip
    RUN apt-get update && apt-get install -y \
        python3-distutils \
        python3-setuptools

and I have

root@ef0c924ba7fa:/tornado_api# python3.7 --version
Python 3.7.3
root@ef0c924ba7fa:/tornado_api# pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

while it should be pip3 under /usr/lib/python3.7/

Currently, I get

root@ef0c924ba7fa:/tornado_api# which pip3
/usr/bin/pip3
root@ef0c924ba7fa:/tornado_api# readlink $(which pip3)
root@ef0c924ba7fa:/tornado_api# 
like image 932
loretoparisi Avatar asked Jul 04 '19 18:07

loretoparisi


People also ask

How do I get pip3 on Ubuntu?

To install pip3 on Ubuntu or Debian Linux, open a new Terminal window and enter sudo apt-get install python3-pip . To install pip3 on Fedora Linux, enter sudo yum install python3-pip into a Terminal window. You will need to enter the administrator password for your computer in order to install this software.

Does Ubuntu 18.04 come with pip?

Ubuntu 18.04 has both Python 2 and Python 3 installed by default and hence it has two possible variants of PIP for each Python versions. Pip, by default, refers to the Python 2 version. Pip for Python 3 is referred to as pip3.


2 Answers

It looks like this has gone stale, nevertheless, I was wondering whether by simply doing a python3.7 -m pip install --upgrade pip

FROM ubuntu:18.04
# ...
RUN apt-get update && apt-get install -y \
        software-properties-common
    RUN add-apt-repository ppa:deadsnakes/ppa
    RUN apt-get update && apt-get install -y \
        python3.7 \
        python3-pip
    RUN python3.7 -m pip install pip
    RUN apt-get update && apt-get install -y \
        python3-distutils \
        python3-setuptools
    RUN python3.7 -m pip install pip --upgrade pip
like image 108
Carlos RT Avatar answered Oct 18 '22 04:10

Carlos RT


Try 'sudo apt purge pip3' or 'sudo apt-get purge pip3' If that does not work then try uninstalling pip3 with pip3. (I'm not that sure how)

My next thing to try is to update pip3 with 'pip3 install pip3' (I think)

If those don't work then I don't know.

like image 1
PaytonTheMartian Avatar answered Oct 18 '22 04:10

PaytonTheMartian