43

Python 3.6 just came out. I tried following these instructions to build from a tarball, but it got hung up on the make command, so I terminated the process after 20 minutes or so.

I also noticed that while the ./configure command was going, a number of the checks ended with "no's." Do I need to pick back through and install everything that did such?

Justin Palmer
  • 539
  • 1
  • 4
  • 3

6 Answers6

40

How do I update my RPi3 to Python 3.6?

As of today, only the installation from source is available. The instructions you referenced are correct for version 3.6. To repeat:

wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar xzvf Python-3.6.0.tgz
cd Python-3.6.0/
./configure
make -j4
sudo make install

On a fresh Raspbian on Raspberry Pi 3 with a class 10 SD card (YMMV):

  • configure takes over 2 minutes
  • make takes about 15 minutes (it produces 8 warnings to the stderr)
  • sudo make install takes about 2 minutes

Do I need to pick back through and install everything that did such?

Unless configure script reports an error, the answer is: no, of course not.

configure performs a series of checks and uses the results as input to create the Makefile. The results depend on architecture, hardware features, etc. These are not requirements for the successful compilation. One of the first checks is a check for Python 3.6 itself, for which the result will certainly be no.

make -j4 simply uses all 4 rpi cores in the make process (much faster)

JxAxMxIxN
  • 103
  • 4
techraf
  • 4,304
  • 10
  • 29
  • 41
  • I just tried this, but its taking forever. configure took 134min and make has been running for more than an hour now. Model RPi3, latest raspbian. Any idea why this is taking so long? – Mystery Feb 19 '17 at 01:09
  • @Mystery your SD card is probably too slow. Get something from a good brand (Sandisk, Samsung etc.) and make sure it's class 10 at least (Sandisk calls it "Ultra"). – Tarun Mar 02 '17 at 15:26
  • 2
    Thought I would comment on this saying, you need to remember to install the required packages BEFORE compiling and installing, otherwise pip3 won't work because of SSL errors (yes, I had to wait for like 2 hours on an install on my Zero W). The required packages are here: https://tecadmin.net/install-python-3-6-ubuntu-linuxmint/ – MortenMoulder May 31 '17 at 19:45
  • 1
    Got error with Python 3.7.2 in rb pi 3, solved by executeing `sudo apt-get install libffi-dev` as suggested in this answer https://stackoverflow.com/a/48045929/2343488 – juliocesar Feb 25 '19 at 16:18
28

I highly recommend you check out the Berryconda package manager by jjhelmus. It is basically a more up-to-date version of the armv7l version of Miniconda, and has the Python 3.6 package available without needing to compile it from source.

Alternatively, if you already have conda installed, you can try just simply adding Berryconda's default rpi channel and installing Python 3.6:

conda config --add channels rpi
conda install python=3.6
tlhIngan
  • 3,362
  • 5
  • 19
  • 33
Gustavo Bezerra
  • 381
  • 3
  • 4
12

For fast build in Raspberry Pi 3 use the -j4 param in the make command:

make -j4
Peter Hansen
  • 214
  • 1
  • 9
Hector Oliveros
  • 221
  • 2
  • 3
4

I am using a RPi2, and I successfully managed to follow the suggested procedure to install python3.6. But as pointed out by a commenter, I ran into problems with ssl when I tried to install packages with pip.

I learned from another thread on different subject that I need to install ssl before I compile.

sudo apt-get install libssl-dev
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar xzvf Python-3.6.0.tgz
cd Python-3.6.0/
./configure
make
sudo make install
python3.6 -V
python3.6 -m pip install --upgrade pip
python3.6 -m pip install --user numpy 
sudo apt-get update
sudo apt-get upgrade

sudo apt-get install libatlas-base-dev gfortran

python3.6 -m pip install --user scipy

the installation of scipy with pip takes a very long time (hours) and I am looking for a solution. I'll get back to this. the rest of the installation is now put on hold.

python3.6 -m pip install --user matplotlib

python3.6 -m pip install --user ipython

python3.6 -m pip install --user jupyter

python3.6 -m pip install --user pandas

python3.6 -m pip install --user sympy

python3.6 -m pip install --user nose

The upside of having to compile python3.6 a second time was a much faster compile the second time. On the other hand it takes a long time to install numpy, and that is why i split up the package installation.

vardaasen
  • 39
  • 4
  • Installation of numpy and scipy is a hurdle by itself and should probably be done from source, not from pip, due to external platform-specific dependencies. See my answer to the problem here: https://raspberrypi.stackexchange.com/a/77856/79467. On the other hand installation is not really quicker this way, but runtime speed will be, substantially. – teoguso Apr 23 '19 at 10:10
1

You need to install all dependencies. All those warning messages, error messages, and "no" checks need to be addressed.

tlhIngan
  • 3,362
  • 5
  • 19
  • 33
  • How do you address for example these: `checking Solaris LFS bug... no`, or `checking getaddrinfo bug... no`, or `checking for the Android API level... not Android`? And most importantly: how do you address this `checking for python3.6... no` when installing Python 3.6? – techraf Dec 25 '16 at 11:17
  • @techraf These specific ones are ok. It's checking for things to fix, not dependencies. The last one is only checking if you already have Python 3.6 before trying to install it. – tlhIngan Dec 25 '16 at 17:59
  • So although you suggested '*All those [ ] "no" checks need to be addressed*', those specific ones were ok. How can I know which are ok, then? I got 170 "nos". Are: `checking for conio.h... no`, or `checking for pthread_init... no`, or `checking for libutil.h... no` specific-and-ok, or need-to-be-addressed? – techraf Dec 25 '16 at 23:34
  • Sounds like it's checking for C header files and components that may already be installed. In this case, I think you can ignore the "checks", it's just helping the compiler put together the makefile, as explained in another answer. Errors and warning need to be addressed for sure, but these checks are fine. – tlhIngan Dec 25 '16 at 23:37
0

To install Python 3.6 on a Raspberry as additional/alternative Python version (without changing the standard Python version) I succeeded with the following commands

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

cd /usr/bin
sudo wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
sudo tar xzf Python-3.6.0.tgz

su root
<Enter password for root>
cd Python-3.6.0
./configure
make -j4
make altinstall
exit

To get the actually installed versions just use the following commands:

enter image description here

See also the this website: https://itler.net/raspberry-pi-python-3-6-x-installation-anleitung/

Michael Hutter
  • 149
  • 1
  • 8