Docker Python3 6 Ubuntu



  • I’ve always been wondering how Docker works in this regards, and whether I should either make as many “RUN apt-get install” commands as possible, or if I should instead try to use as few RUN commands as possible, as these increases the number of layers (?). So for example: RUN apt-get update && apt-get install -y python-qt4 python-pyside python-pip python3-pip python3.
  • # apt update # apt install unit # apt install unit-dev unit-go unit-jsc8 unit-jsc11 unit-perl unit-php unit-python2.7 unit-python3.6 unit-python3.7 unit-ruby 16.04 Supported architectures: arm64, i386, x86-64.
  • Step 1: Install Docker on Ubuntu. If you want the latest Docker version, you can install Docker from Docker’s APT repository. For simplicity, this tutorial installs Docker from the default Ubuntu software repository. Sudo apt update sudo apt install docker.io. Once installed, the Docker daemon should be automatically started.
  • Assuming that you’re using Linux, I am going to show you how to install Tensorflow on Ubuntu. I have used Ubuntu 18.04 but the steps should be valid for other versions as well. Do note that while you can try building it from source for other platforms/distributions, TensorFlow primarily supports Ubuntu Linux. So, I’ll stick to that in this.

So running “python3.6” and “python3.4” has the same behavior as before, but now running “python3” gives 3.6.2. By default in Ubuntu (and so probably in Linux Mint) the system python links/binaries are in the /usr/bin folder, and it seems like when a user installs Python from source, by default the links/binaries are put in /usr.

If you’re into machine learning, you might need to utilize TensorFlow, if not PyTorch.

Assuming that you’re using Linux, I am going to show you how to install Tensorflow on Ubuntu. I have used Ubuntu 18.04 but the steps should be valid for other versions as well.

Do note that while you can try building it from source for other platforms/distributions, TensorFlow primarily supports Ubuntu Linux. So, I’ll stick to that in this article.

Installing TensorFlow on Ubuntu Linux

Before you start setting up TensorFlow, you need to enable the Universe Repository on Ubuntu. You can do that using this command:

Or go to the Software & Updates options and enable it from there:

Step 1: Get Python development environment

First, you have to set up a Python development environment to proceed. By default, you should have Python 3.6.x installed on Ubuntu. You can check Python version using:

Make sure you have Python 3.5–3.7 (as instructed officially). If you do not have it or need to upgrade it, install it using the following command in the terminal:

Step 2: Get Pip

Next, you need to check if you have Python’s pip package manager.

If you do not have it installed, you can install it by typing this:

However, you may not have the latest version onboard.

Note:TensorFlow requires pip version 19.0 or above. Fret not, you can upgrade pip once you set up the virtual environment in the next set of steps.

Step 3: Set up Python virtual environment

Now, that you’re done with setting up Python and pip, you need to set up a virtual environment for Python development. This way, you won’t affect the host system with whatever you are doing with Python setup.

To get started, install virtualenv:

The -H flag sets the HOME environment variable to the home directory.

You would want to create the Python virtual environment by specifying a directory and choosing a Python interpreter. Here’s what you have to type in order to do that:

With that completed, you just need to activate the virtual environment, for that, use the source command in following fashion:

While your virtual environment is active, you will observe that your shell prompt will be prefixed with (venv) as shown in the image below.

Next, you need to upgrade the pip version in the virtual environment without affecting the host setup (if its already up-to-date you will be notified of that):

If you are curious, you can also check out the list of packages installed in the virtual environment by typing this:

Step 4: Install TensorFlow

Finally you are about to install TensorFlow.

Make sure that you are using the virtual environment. Type in the following command to install TensorFlow:

You can also choose to verify the installation by typing in the following command in the virtual environment:

Python3

At last, you have installed TensorFlow successfully on Ubuntu!

Installing TensorFlow on Pop!_OS

Unlike Ubuntu, if you have Pop!_OS, you do not need to follow all these steps but a single command to utilize your base system python.

You just need to enter the following command in the terminal:

For more info on how to use it, you can refer to the official Pop!_OS resources.

Wrapping Up

Keep in mind that whenever you want to use TensorFlow on Ubuntu, you have to enter the specified Python virtual environment first.

If you’re new to TensorFlow, you might want to check out the official resources available to learn.

I hope this helps you out. It is also worth noting that I performed the steps to install TensorFlow on a fresh Ubuntu installation – so if you have modified something on your installation, you might need troubleshoot a bit while installing TensorFlow on Ubuntu.

Feel free to let me know your thoughts in the comments below.

Become a Member for FREE
Become a member to get the regular Linux newsletter (2-4 times a month) and access member-only contents.

Docker Python 3 6 Ubuntu Tutorial

Join the conversation.