39

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?

34

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)

  • 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 1: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 2 '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: tecadmin.net/install-python-3-6-ubuntu-linuxmint – MortenMoulder May 31 '17 at 19:45
  • 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 stackoverflow.com/a/48045929/2343488 – juliocesar Feb 25 at 16:18
24

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
  • Well, that's far simpler than compiling from source. Thanks! – Ekevoo Jun 4 '17 at 3:45
  • 1
    For completeness, follow that up with conda create -n py36 python=3.6 – brittohalloran Nov 6 '17 at 12:39
  • Berryconda, what an excellent solution! – DJK Dec 16 '18 at 1:35
  • @brittohaloran As of this comment this installs Python 3.6.6 in the conda base environment, so you probably want to name your created env something descriptive of what you plan to put in that env (something other than py36). – hobs Jan 7 at 16:24
  • Works like a charm, best and simplest solution – Grant Sep 5 at 14:35
12

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

make -j4
  • 3
    Seemed pretty fast! A minute or two vs 15+ minutes without -j4!!! – JxAxMxIxN Jun 28 '17 at 3:04
  • 1
    What does that param do? – timbram Apr 15 '18 at 17:09
  • 2
    The param -j4 tells make to start 4 parallel jobs, so it can use all 4 CPU cores at the same time. – hdiogenes Apr 24 '18 at 15:06
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.

  • 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: 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 at 10:10
1

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

  • 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

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.