Skip to content

Commit

Permalink
Fix python 3.9 install on 32 bit RPI
Browse files Browse the repository at this point in the history
  • Loading branch information
Sispheor committed Mar 6, 2022
1 parent 3f74560 commit 4e570dc
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 37 deletions.
17 changes: 10 additions & 7 deletions docker/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,43 +69,46 @@ docker-compose -f compose_compile_snowboy_all.yml up
## Compile Snowboy for a Raspberry from amd64 system

Check current platform
```
```bash
docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS PLATFORMS
default * docker
default default running linux/amd64, linux/386
```

Activate arm platforms
```
```bash
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
```

Check
```
```bash
docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS PLATFORMS
default * docker
default default running linux/amd64, linux/386
```

Create a builder
```
```bash
docker buildx create --name rpibuilder --driver docker-container --use
```

Bootstrap the builder
```
```bash
docker buildx inspect --bootstrap
```

Build the image
```
```bash
# 32 bit
docker buildx build --platform linux/arm/v7 --load --force-rm=true -t compile_snowboy_python39_rpi -f compile_snowboy_python39.dockerfile .
# 64 bit
docker buildx build --platform linux/arm64 --load --force-rm=true -t compile_snowboy_python39_rpi -f compile_snowboy_python39.dockerfile .
```

Get the built Snowboy binary
```
```bash
docker run -it --rm -v /tmp/snowboy:/data compile_snowboy_python39_rpi
```

4 changes: 2 additions & 2 deletions docs/installation/manual_installation_common.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cd kalliope

Install the project:
```bash
sudo python3 setup.py install
sudo python3 -m pip install .
```

### Method 3 - Developer install using Virtualenv
Expand Down Expand Up @@ -45,7 +45,7 @@ source venv/bin/activate

Install Kalliope
```bash
python3 setup.py install
python3 -m pip install .
```

### Method 4 - Developer, dependencies install only
Expand Down
2 changes: 1 addition & 1 deletion docs/installation/raspbian.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Kalliope can be installed:

## Install via script

Just run the following bash command to install Kalliope on a freshly installed Raspberry Pi:
Just run the following bash command to install Kalliope on a freshly installed Raspberry Pi (32bit):
```
bash -c "$(curl -sL https://raw.githubusercontent.com/kalliope-project/kalliope/master/install/rpi_install_kalliope.sh)"
```
Expand Down
3 changes: 2 additions & 1 deletion install/files/deb-packages_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ python-pycparser
python-paramiko
python-markupsafe
libttspico-utils
pulseaudio
pulseaudio
cargo
30 changes: 16 additions & 14 deletions install/rpi_install_kalliope.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#------------------------------------------
# name of the branch to install
branch="master"
python_version="3.7.6"
python_version="3.9.9"
pulseaudio_service_path="/etc/systemd/system/pulseaudio.service"
#------------------------------------------
# Functions
Expand All @@ -30,7 +30,7 @@ install_default_packages(){
flac libffi-dev libffi-dev libssl-dev portaudio19-dev build-essential \
libssl-dev libffi-dev libatlas3-base mplayer libyaml-dev libpython3-dev libjpeg-dev
sudo apt-get install -y libportaudio0 libportaudio2 libportaudiocpp0 \
apt-transport-https pulseaudio
apt-transport-https pulseaudio cargo
echo_green "Installing system packages...[OK]"

}
Expand All @@ -57,20 +57,19 @@ install_pip3(){
}

install_pico2wave(){
debian_version=`cat /etc/os-release |grep buster`
retVal=$?
if [[ ${retVal} -ne 0 ]]; then
debian_version=`grep "^VERSION_ID=" /etc/os-release | cut -d'=' -f2 | tr -d '"'`
if (( ${debian_version} <= 10 )); then # less than
echo "Debian < 10"
sudo apt-get install ffmpeg libttspico-utils
sudo apt-get install -y ffmpeg libttspico-utils
else
echo "Debian 10 Buster detected. Installing pico2wave manually"
echo "Debian > 10. Installing pico2wave manually"
sudo apt-get install -y ffmpeg
wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-utils_1.0+git20130326-9_armhf.deb
wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico0_1.0+git20130326-9_armhf.deb
wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-data_1.0+git20130326-9_all.deb
sudo dpkg -i libttspico-data_1.0+git20130326-9_all.deb
sudo dpkg -i libttspico-utils_1.0+git20130326-9_armhf.deb
sudo dpkg -i libttspico0_1.0+git20130326-9_armhf.deb
sudo dpkg -i libttspico-utils_1.0+git20130326-9_armhf.deb
fi
}

Expand All @@ -84,12 +83,12 @@ install_kalliope(){
echo_green "Cloning the project...[OK]"
fi
# Install the project
echo_yellow "Installing Kalliope..."
echo_yellow "Installing Kalliope... This can take up to 60 minutes..."
# fix for last ansible
sudo pip3 install "ansible==2.9.5"
# sudo pip3 install "ansible==2.9.5"
cd kalliope
git checkout ${branch}
sudo python3 setup.py install
sudo python3 -m pip -v install .
cd ..
echo_green "Installing Kalliope...[OK]"
}
Expand Down Expand Up @@ -145,7 +144,7 @@ setup_pulseaudio(){

# We comment out load-module module-suspend-on-idle in /etc/pulse/system.pa to avoid a delay if the module is suspend
sudo sed -e '/load-module module-suspend-on-idle/ s/^#*/#/' -i /etc/pulse/system.pa

if [[ -f "/etc/systemd/system/pulseaudio.service" ]]; then
# If the service already exists, we can skip this step
echo_green "Pulseaudio service already existing"
Expand All @@ -155,11 +154,14 @@ setup_pulseaudio(){
sudo cp $(pwd)/kalliope/install/files/pulseaudio.service /etc/systemd/system/
echo_green "Creating pulseaudio service..[OK]"
sudo systemctl daemon-reload
sudo systemctl start pulseaudio
sudo systemctl enable pulseaudio
echo_green "Enable and starting pulseaudio.service..[OK]"
fi
# Restart pulseaudio anyway
sudo systemctl restart pulseaudio
echo_green "Installing pulseaudio service..[OK]"
echo_green "Remember to setup speaker and microphone properly."
echo_green "https://kalliope-project.github.io/kalliope/installation/raspbian/#microphone-and-speaker-configuration"
}


Expand Down Expand Up @@ -203,4 +205,4 @@ install_kalliope
setup_pulseaudio

# fix https://github.com/kalliope-project/kalliope/issues/487
sudo chmod -R o+r /usr/local/lib/python3.7/dist-packages/
#sudo chmod -R o+r /usr/local/lib/python3.7/dist-packages/
47 changes: 35 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@ def package_files(directory):
extra_files.append('brain.yml')
extra_files.append('settings.yml')


def required():
with open(os.path.join(basedir, "install/files/python_requirements.txt"), 'r') as f:
return f.read().splitlines()


# required libs
required_packages = required()
for package in required_packages:
pip.main(["install", package])

setup(
name='kalliope',
version=version,
Expand All @@ -73,6 +62,8 @@ def required():
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Home Automation',
'Topic :: Multimedia :: Sound/Audio :: Speech',
'Topic :: Multimedia :: Sound/Audio :: Sound Synthesis',
Expand All @@ -83,7 +74,39 @@ def required():
# included packages
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
python_requires=">=3.6",

# required libs
install_requires=[
'Werkzeug>=2.0',
'pyyaml>=5.4.1',
'six>=1.12.0',
'SpeechRecognition>=3.8.1',
'markupsafe>=1.1.1',
'pyaudio>=0.2.11',
'pyasn1>=0.4.5',
'ansible>=4.5',
'jinja2>=2.10.1',
'cffi>=1.12.3',
'ipaddress>=1.0.17',
'flask>=2.0.1',
'Flask-Restful>=0.3.7',
'flask_cors>=3.0.8',
'requests>=2.22.0',
'httpretty>=0.8.14',
'mock>=3.0.5',
'Flask-Testing>=0.8.1',
'apscheduler>=3.6.0',
'GitPython>=2.1.11',
'packaging>=19.0',
'transitions>=0.6.9',
'sounddevice>=0.3.13',
'SoundFile>=0.10.2',
'pyalsaaudio>=0.8.4',
'paho-mqtt>=1.4.0',
'voicerss_tts>=1.0.6',
'gTTS>=2.2.3',
'urllib3>=1.25.3',
'gevent>=20.9.0'
],
# additional files
package_data={
'kalliope': extra_files,
Expand Down

0 comments on commit 4e570dc

Please sign in to comment.