Skip to content

Instantly share code, notes, and snippets.

@simoncos
Last active October 7, 2024 11:50
Show Gist options
  • Save simoncos/a7ce35babeaf73f512be24135c0fbafb to your computer and use it in GitHub Desktop.
Save simoncos/a7ce35babeaf73f512be24135c0fbafb to your computer and use it in GitHub Desktop.
Install Miniconda 3 on Raspberry Pi

refer to: https://stackoverflow.com/questions/39371772/how-to-install-anaconda-on-raspberry-pi-3-model-b

{USER}: pi

Install Miniconda 3:

wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-armv7l.sh
sudo md5sum Miniconda3-latest-Linux-armv7l.sh # (optional) check md5
sudo /bin/bash Miniconda3-latest-Linux-armv7l.sh # -> change default directory to /home/pi/miniconda3
sudo nano /home/pi/.bashrc # -> add: export PATH="/home/pi/miniconda3/bin:$PATH"
sudo reboot -h now

Test:

conda
python --version

If Conda update miss permission of the directory:

sudo chown -R pi miniconda3
@frank-besson
Copy link

What do you mean when you say "Check md5"?

@luisgus
Copy link

luisgus commented Jul 11, 2018

@logancyang
Copy link

Hi, I installed Miniconda 3 on my RPi 3 but can't seem to install any packages.
For example, I ran conda install numpy and got

Fetching package metadata: ....
Solving package specifications: 
Error: Could not find some dependencies for numpy: blas * openblas

You can search for this package on anaconda.org with

    anaconda search -t conda blas * openblas

@moble
Copy link

moble commented Nov 13, 2018

@loganyc1934 I had the same experience with an older installation of conda, tried updating and had the same experience again. I think the problem is basically that conda packages need to be built specifically for the ARM architecture that RPi uses, and there just aren't many people building them on this architecture. A year or two ago, the situation was better. But nowadays, most of those old builds have disappeared, which means that conda just isn't a good solution for RPi beyond the basic installation of python and pip.

But the upside is that pip has really improved drastically in recent years. Since I think most of us are using some *nix OS on the RPi, we probably have compilers, and pip is pretty good at compiling things for you automatically. If you need the nice environment management that conda brought, you can now use pipenv. So that's probably the better solution now.

@moble
Copy link

moble commented Nov 13, 2018

@loganyc1934 I had the same experience with an older installation of conda, tried updating and had the same experience again. I think the problem is basically that conda packages need to be built specifically for the ARM architecture that RPi uses, and there just aren't many people building them on this architecture. A year or two ago, the situation was better. But nowadays, most of those old builds have disappeared, which means that conda just isn't a good solution for RPi beyond the basic installation of python and pip. In fact, even the most recent installer only installs python 3.4, which is almost 4.5 years old (ancient in conda), and older than the default python3 installed with raspbian.

But the upside is that pip has really improved drastically in recent years. Since I think most of us are using some *nix OS on the RPi, we probably have compilers, and pip is pretty good at compiling things for you automatically. If you need the nice environment management that conda brought, you can now use pipenv. So that's probably the better solution now.

@kratzercanby
Copy link

Hi, I installed Miniconda 3 on my RPi 3 but can't seem to install any packages.
For example, I ran conda install numpy and got

Fetching package metadata: ....
Solving package specifications: 
Error: Could not find some dependencies for numpy: blas * openblas

You can search for this package on anaconda.org with

    anaconda search -t conda blas * openblas

@loganyc1934, I got the same issue, and I followed it down the rabbit hole. I have since unistalled conda from my R Pi for other latex-related reasons, but I'm going to try to sum up what I did to get it going. Since the default conda repositories did not have blas and openblas, I had to first install the Anaconda client to be able to search the general Anaconda repositories:
conda install anaconda-client

Then I searched the extended conda respositories with:
anaconda search -t conda blas
anaconda search -t conda openblas
I'm not sure why the error code suggests searching for "blas * openblas", I couldn't get that to work with the anaconda client. It might just be an accidental type where the "blas * openblas" came from the dependencies error, and was fed directly into the "anaconda search" line.

Once I found a channel with both openblas and blas, I added that to my conda manager. the rpi channel seems like a good channel to add anyway as they have many Raspberry Pi-specific packages. But you could add different channels if you come across this issue with other packages.
conda config --add channels rpi

After the rpi channel is added, you should be able to download both openblas and blas.
conda install openblas blas

Can you install packages other than numpy?

@simulationcoder
Copy link

Hi, I installed Miniconda 3 on my RPi 3 but can't seem to install any packages.
For example, I ran conda install numpy and got

Fetching package metadata: ....
Solving package specifications: 
Error: Could not find some dependencies for numpy: blas * openblas

You can search for this package on anaconda.org with

    anaconda search -t conda blas * openblas

@loganyc1934, I got the same issue, and I followed it down the rabbit hole. I have since unistalled conda from my R Pi for other latex-related reasons, but I'm going to try to sum up what I did to get it going. Since the default conda repositories did not have blas and openblas, I had to first install the Anaconda client to be able to search the general Anaconda repositories:
conda install anaconda-client

Then I searched the extended conda respositories with:
anaconda search -t conda blas
anaconda search -t conda openblas
I'm not sure why the error code suggests searching for "blas * openblas", I couldn't get that to work with the anaconda client. It might just be an accidental type where the "blas * openblas" came from the dependencies error, and was fed directly into the "anaconda search" line.

Once I found a channel with both openblas and blas, I added that to my conda manager. the rpi channel seems like a good channel to add anyway as they have many Raspberry Pi-specific packages. But you could add different channels if you come across this issue with other packages.
conda config --add channels rpi

After the rpi channel is added, you should be able to download both openblas and blas.
conda install openblas blas

Can you install packages other than numpy?

Thanks for the the following line
conda config --add channels rpi

After this I was able to install all the required packages including numpy
conda install numpy
conda install python
pip install --upgrade pip

@Shumakriss
Copy link

Why not make it completely non-interactive?

echo 'export PATH="/home/pi/miniconda3/bin:$PATH"' >> /home/pi/.bashrc

@jsheedy
Copy link

jsheedy commented Apr 6, 2019

Berryconda worked great for me after experiencing trouble installing some scikit packages with pip and regular conda.

@Bonzadog
Copy link

Bonzadog commented Apr 7, 2019

I would like to use Conda - but looking at the problems here I will give a wide berth until is has a more stable and RPi orientated version.

@Shahid7870
Copy link

Why not make it completely non-interactive?

echo 'export PATH="/home/pi/miniconda3/bin:$PATH"' >> /home/pi/.bashrc

sudo nano /home/pi/.bashrc # -> add: export PATH="/home/pi/miniconda3/bin:$PATH"

Add at the End Of the Line

@chrisb13
Copy link

chrisb13 commented Oct 22, 2019

Berryconda worked great for me after experiencing trouble installing some scikit packages with pip and regular conda.

@jjhelmus +1 for Berryconda. My experience is similar (except that it was matplotlib, seaborn, pandas-datareader and pandas).

@cadisman
Copy link

Hi in my stance, i could install "conda numpy conda" after typing "conda update conda"

@franva
Copy link

franva commented Jan 26, 2020

hi guys,

Miniconda3-latest-Linux-armv7l.sh is an almost 5 years old version.
Not seen anyone mention this point.

Could someone suggest where to find the latest version please?

Copy link

ghost commented Jan 26, 2020

hi guys,

Miniconda3-latest-Linux-armv7l.sh is an almost 5 years old version.
Not seen anyone mention this point.

Could someone suggest where to find the latest version please?

This project is more up to date: https://github.com/jjhelmus/berryconda

@franva
Copy link

franva commented Jan 26, 2020

hi guys,

Miniconda3-latest-Linux-armv7l.sh is an almost 5 years old version.
Not seen anyone mention this point.

Could someone suggest where to find the latest version please?

This project is more up to date: https://github.com/jjhelmus/berryconda

thanks @elliptic-porcupine ,

After installed the berryconda, it breaks my PyTorch and installed older Python 3.6
I have to use python3.7 to run my original python 3.7.3

My Raspberry Pi 4 comes with Python 3.7.3 installed.

here is error message.

Could you help please?

>>> import torch
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/numpy/core/__init__.py", line 24, in <module>
    from . import multiarray
  File "/home/pi/.local/lib/python3.7/site-packages/numpy/core/multiarray.py", line 14, in <module>
    from . import overrides
  File "/home/pi/.local/lib/python3.7/site-packages/numpy/core/overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/dist-packages/torch/__init__.py", line 81, in <module>
    from torch._C import *
  File "/home/pi/.local/lib/python3.7/site-packages/numpy/__init__.py", line 142, in <module>
    from . import core
  File "/home/pi/.local/lib/python3.7/site-packages/numpy/core/__init__.py", line 54, in <module>
    raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
  1. Check that you expected to use Python3.7 from "/usr/bin/python3.7",
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.18.1" you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory

@adigeak
Copy link

adigeak commented Feb 25, 2020

conda config --set auto_activate_base false
when i tried to use this it throws an error is there any other way to deactivate miniconda?

@dylanw-oss
Copy link

@loganyc1934 I had the same experience with an older installation of conda, tried updating and had the same experience again. I think the problem is basically that conda packages need to be built specifically for the ARM architecture that RPi uses, and there just aren't many people building them on this architecture. A year or two ago, the situation was better. But nowadays, most of those old builds have disappeared, which means that conda just isn't a good solution for RPi beyond the basic installation of python and pip. In fact, even the most recent installer only installs python 3.4, which is almost 4.5 years old (ancient in conda), and older than the default python3 installed with raspbian.

But the upside is that pip has really improved drastically in recent years. Since I think most of us are using some *nix OS on the RPi, we probably have compilers, and pip is pretty good at compiling things for you automatically. If you need the nice environment management that conda brought, you can now use pipenv. So that's probably the better solution now.

You're right! Miniconda only supports to create env with python 3.4 on Raspi now , I hope I had read your reply before trying it. I have to uninstall Miniconda.

@Maximilian-Pichler
Copy link

Maximilian-Pichler commented Jul 21, 2021

@vinayak19th:

curl -sSL https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh > anaconda.sh \
&& bash anaconda.sh -b -p /opt/anaconda \
&& /opt/anaconda/bin/conda update -y --all \
&& export PATH="${PATH}:/opt/anaconda/bin" \
&& echo ". /opt/anaconda/etc/profile.d/conda.sh" >> ~/.bashrc \
&& . ~/.bashrc

@vinayak19th
Copy link

@vinayak19th:

curl -sSL https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh > anaconda.sh \
&& bash anaconda.sh -b -p /opt/anaconda \
&& /opt/anaconda/bin/conda update -y --all \
&& export PATH="${PATH}:/opt/anaconda/bin" \
&& echo ". /opt/anaconda/etc/profile.d/conda.sh" >> ~/.bashrc \
&& . ~/.bashrc

Thanks. I got it

@naim5am
Copy link

naim5am commented Feb 6, 2022

https://www.raspberrypi.com/news/raspberry-pi-os-64-bit/
Few days ago, Feb 2nd, Raspberry Pi OS is out of beta. I think it's worth trying official Conda install methods again. I will update this comment with results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment