56

I would like to know how to install the latest Anaconda version from Continuum on my Raspberry Pi 3 model B. Any help would be appreciated...

Marco
  • 2,445
  • 2
  • 25
  • 15
  • 1
    As of today - the support is quite bad, you'll get Python 3.4 at most and the available packages are also limited (e.g.: current jupyter requires at least 3.5). While on a PC Anaconda is a good way to get an 'up-to-date' python with rich repositories, it's not so great for RPi. It's easier to update to `stretch` for Python 3.5 or even `buster` for 3.7. – Tomasz Gandor Nov 15 '19 at 13:02
  • check berryconda – AlvaroP May 14 '20 at 11:21

4 Answers4

90

Installing Miniconda on Raspberry Pi and adding Python 3.5 / 3.6

Skip the first section if you have already installed Miniconda successfully.

Installation of Miniconda on Raspberry Pi

wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-armv7l.sh
sudo md5sum Miniconda3-latest-Linux-armv7l.sh
sudo /bin/bash Miniconda3-latest-Linux-armv7l.sh

Accept the license agreement with yes

When asked, change the install location: /home/pi/miniconda3

Do you wish the installer to prepend the Miniconda3 install location to PATH in your /root/.bashrc ? yes

Now add the install path to the PATH variable:

sudo nano /home/pi/.bashrc

Go to the end of the file .bashrc and add the following line:

export PATH="/home/pi/miniconda3/bin:$PATH"

Save the file and exit.

To test if the installation was successful, open a new terminal and enter

conda

If you see a list with commands you are ready to go.

But how can you use Python versions greater than 3.4 ?


Adding Python 3.5 / 3.6 to Miniconda on Raspberry Pi

After the installation of Miniconda I could not yet install Python versions higher than Python 3.4, but i needed Python 3.5. Here is the solution which worked for me on my Raspberry Pi 4:

First i added the Berryconda package manager by jjhelmus (kind of an up-to-date version of the armv7l version of Miniconda):

conda config --add channels rpi

Only now I was able to install Python 3.5 or 3.6 without the need for compiling it myself:

conda install python=3.5
conda install python=3.6

Afterwards I was able to create environments with the added Python version, e.g. with Python 3.5:

conda create --name py35 python=3.5

The new environment "py35" can now be activated:

source activate py35

Using Python 3.7 on Raspberry Pi

Currently Jonathan Helmus, who is the developer of berryconda, is working on adding Python 3.7 support, if you want to see if there is an update or if you want to support him, have a look at this pull request. (update 20200623) berryconda is now inactive, This project is no longer active, no recipe will be updated and no packages will be added to the rpi channel. If you need to run Python 3.7 on your Pi right now, you can do so without Miniconda. Check if you are running the latest version of Raspbian OS called Buster. Buster ships with Python 3.7 preinstalled (source), so simply run your program with the following command:

Python3.7 app-that-needs-python37.py

I hope this solution will work for you too!

Paul Strobel
  • 1,151
  • 8
  • 8
  • 7
    Thank you so much! I've been searching so long for this! – Kaito Jul 13 '19 at 09:09
  • 3
    Thank you sir. Really nice explanation – Pablo Ruiz Ruiz Sep 21 '19 at 17:22
  • 2
    I've been trying to get Python 3.6+ installed for two days now on my ARMv7L machine. I couldn't get Python 3.7 installed, but 3.6 is sufficient. :D – Sean McCarthy Oct 16 '19 at 20:31
  • 1
    Thank you for putting this together so much <3. This helkped! – Nate Gadzhibalaev Feb 13 '20 at 21:07
  • @paul-strobel thanks for this well detailed answer. I faced a problem on my rpi and conda wasn't able to install packages for a ownership conflict, you may wish to add this to your answer, this will solve the problem `sudo chown -R pi: miniconda3` source: https://askubuntu.com/a/726196/673947 Also if you wish to add how to install `RPi.GPIO` then it would be the best tutorial on conda for raspberry – aster94 Apr 08 '20 at 17:42
  • 1
    Note: berryconda as of early 2020 is no longer active https://github.com/jjhelmus/berryconda – aster94 Apr 08 '20 at 18:16
  • I tried many times but after the third line and after wrote 'yes' it shows a bunch of 'y' after that nothing. I cannot write anything. – Protima Rani Paul Aug 21 '20 at 19:02
  • @ProtimaRaniPaul can you specify your problem further? Which version of Python are you installing, where exactly do you get stuck etc.? – Paul Strobel Aug 21 '20 at 20:16
  • @PaulStrobel As I said I did exactly given above, After the first three lines of code (before Path Variable Addition.) It asked me to input 'yes' it shows 'y' one after another in a new line then it goes totally blank. I can see nothing in the terminal. I am using Respbian 10. Thank you so much for your comment. – Protima Rani Paul Aug 22 '20 at 00:35
  • anyone else having trouble with this? seem to be in dependency hell where i can't update conda b/c python is too low and i can't update to python 3.5 or 3.6 b/c conda is too low. anytime i try to install the above it just breaks my miniconda :( – steven hurwitt Oct 10 '20 at 18:46
  • Hi, I am tried this on my Raspberry Pi 4 Model B running running the Rasbian OS. After I follow the steps above and type conda, I get "-bash: conda: command not found". Does anybody know how to fix this? – Pink Flying Elephant Sep 20 '21 at 11:51
60

On Raspberry Pi 3 Model B - Installation of Miniconda (bundled with Python 3)

Go and get the latest version of miniconda for Raspberry Pi - made for armv7l processor and bundled with Python 3 (eg.: uname -m)

wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-armv7l.sh
md5sum Miniconda3-latest-Linux-armv7l.sh
bash Miniconda3-latest-Linux-armv7l.sh

After installation, source your updated .bashrc file with source ~/.bashrc. Then enter the command python --version, which should give you:

Python 3.4.3 :: Continuum Analytics, Inc.
Community
  • 1
  • 1
Marco
  • 2,445
  • 2
  • 25
  • 15
  • 7
    As of the time of posting this comment, Python 3.5 isn't available. How unfortunate! – wingedrhino Nov 06 '16 at 12:59
  • @mahtuag If I get a bit of time I'll check it out – Marco Nov 07 '16 at 16:05
  • Hi @mahtuag the newest version It's not available on the repo(https://repo.continuum.io/miniconda/) for the Raspberry Pi Model 3 Processor ARMv7. It's like you said, really unfortunate. – Marco Nov 07 '16 at 16:17
  • 3
    For now, I replaced NOOBS (based on Debian 8 Raspbian) with ArchLinux ARM mostly because of the unparalleled high quality of its documentation. This has also given me access to Python 3.5 along with various other up-to-date packages, as ArchLinux is very prompt in upgrading its repositories when the upstream releases newer package versions. I suggest this as a potential stop-gap solution until Miniconda has a little more love for armv7l systems. – wingedrhino Nov 10 '16 at 20:47
  • 2
    Is there any reason why you use `sudo`? Better practice and more convenient to use not to use `sudo` to install. – user989762 Feb 07 '18 at 20:24
  • I followed this but I missed the step about changing the default installation directory. Is that a big problem? I updated .bashrc with `export PATH="/root/miniconda3/bin:$PATH"` and rebooted but I still get `bash: conda: command not found`. What should I do? – Bill Feb 10 '18 at 20:24
  • Just tried this - followed steps exactly, (on a raspberry pi zero w) and the conda command just returns "Illegal instruction" for anything I attempt to do with conda (even `conda --version` or just plain `conda`). Any advice? – Ethan Keller Mar 16 '18 at 15:24
  • What if I wanted to install it for all users, not just `pi`? – gosuto Apr 27 '18 at 07:41
  • Still works well for me as of June 2018. I recommend not using sudo and it also seems that the installer automatically adds miniconda to your PATH. – clifgray Jun 22 '18 at 18:21
  • Why can't I use conda to install anything, it always has `Fetching package metadata: .... Error: No packages found in current linux-armv7l channels matching: xxxx` – Logan Yang Oct 31 '18 at 18:35
  • 1
    Miniconda-latest-Linux-armv7l.sh 19.8M 2015-08-24 ??? 2015 seriously? Can it get any sadder? –  May 03 '19 at 16:30
  • I tried many times but after the third line and after wrote 'yes' it shows a bunch of 'y' after that nothing. I cannot write anything. – Protima Rani Paul Aug 21 '20 at 19:02
8

If you're interested in generalizing to different architectures, you could also run the command above and substitute uname -m in with backticks like so:

wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-`uname -m`.sh
trincot
  • 317,000
  • 35
  • 244
  • 286
fac
  • 101
  • 1
  • 4
8

I was trying to run this on a pi zero. Turns out the pi zero has an armv6l architecture so the above won't work for pi zero or pi one. Alternatively here I learned that miniconda doesn't have a recent version of miniconda. Instead I used the same instructions posted here to install berryconda3

Conda is now working. Hope this helps those of you interested in running conda on the pi zero!

Ethan Keller
  • 963
  • 3
  • 10
  • 26
  • Yes, you need to always check your machine archtecture. At time of this comment, this page: https://repo.continuum.io/miniconda/ contains only miniconda 3.5.5 with Py2. This makes root environment by Py2, but doesn't preclude installing other versions. – Tomasz Gandor May 05 '18 at 21:16