Python build failed when trying to install Cayenne

Thank you for taking the time to submit your bug/issue! Please use the points below as a guide when submitting.

Device: Rasberrypi zero w
Dashboard: Web, Putty for ssh
./myDevices-1.0/
./myDevices-1.0/._.DS_Store
./myDevices-1.0/.DS_Store
./myDevices-1.0/3rd_party/
./myDevices-1.0/addCron.sh
./myDevices-1.0/ca.crt
./myDevices-1.0/crontab.sh
./myDevices-1.0/deb/
./myDevices-1.0/dev_network.ini
./myDevices-1.0/libs/
./myDevices-1.0/live_network.ini
./myDevices-1.0/package
./myDevices-1.0/preprod_network.ini
./myDevices-1.0/python/
./myDevices-1.0/qa1_network.ini
./myDevices-1.0/qa2_network.ini
./myDevices-1.0/reboot_install.sh
./myDevices-1.0/scripts/
./myDevices-1.0/setup.sh
./myDevices-1.0/stg_network.ini
./myDevices-1.0/uninstall.sh
./myDevices-1.0/scripts/config.sh
./myDevices-1.0/scripts/tightvncsetup.sh
./myDevices-1.0/scripts/webiopisetup.sh
./myDevices-1.0/python/myDevices/
./myDevices-1.0/python/myDevices.init.sh
./myDevices-1.0/python/myDevices.service
./myDevices-1.0/python/myDevices.sh
./myDevices-1.0/python/setup.py
./myDevices-1.0/python/myDevices/init.py
./myDevices-1.0/python/myDevices/main.py
./myDevices-1.0/python/myDevices/cloud/
./myDevices-1.0/python/myDevices/ipgetter/
./myDevices-1.0/python/myDevices/os/
./myDevices-1.0/python/myDevices/remoteaccess/
./myDevices-1.0/python/myDevices/requests_futures/
./myDevices-1.0/python/myDevices/schedule/
./myDevices-1.0/python/myDevices/sensors/
./myDevices-1.0/python/myDevices/test/
./myDevices-1.0/python/myDevices/utils/
./myDevices-1.0/python/myDevices/wifi/
./myDevices-1.0/python/myDevices/wifi/init.py
./myDevices-1.0/python/myDevices/wifi/WifiManager.py
./myDevices-1.0/python/myDevices/wifi/wifisetup.py
./myDevices-1.0/python/myDevices/wifi/WirelessLib.py
./myDevices-1.0/python/myDevices/utils/init.py
./myDevices-1.0/python/myDevices/utils/config.py
./myDevices-1.0/python/myDevices/utils/crypto.py
./myDevices-1.0/python/myDevices/utils/history.py
./myDevices-1.0/python/myDevices/utils/logger.py
./myDevices-1.0/python/myDevices/utils/mutex.py
./myDevices-1.0/python/myDevices/utils/singleton.py
./myDevices-1.0/python/myDevices/test/all_tests.py
./myDevices-1.0/python/myDevices/test/cloud_test.py
./myDevices-1.0/python/myDevices/test/config_test.py
./myDevices-1.0/python/myDevices/test/history_test.py
./myDevices-1.0/python/myDevices/test/remoteaccess_test.py
./myDevices-1.0/python/myDevices/test/scheduler_test.py
./myDevices-1.0/python/myDevices/test/sensors_test.py
./myDevices-1.0/python/myDevices/test/updater_test.py
./myDevices-1.0/python/myDevices/sensors/init.py
./myDevices-1.0/python/myDevices/sensors/client.py
./myDevices-1.0/python/myDevices/sensors/sensors.py
./myDevices-1.0/python/myDevices/schedule/init.py
./myDevices-1.0/python/myDevices/requests_futures/init.py
./myDevices-1.0/python/myDevices/requests_futures/sessions.py
./myDevices-1.0/python/myDevices/remoteaccess/init.py
./myDevices-1.0/python/myDevices/os/init.py
./myDevices-1.0/python/myDevices/os/cpu.py
./myDevices-1.0/python/myDevices/os/daemon.py
./myDevices-1.0/python/myDevices/os/getsysteminfo.py
./myDevices-1.0/python/myDevices/os/raspiconfig.py
./myDevices-1.0/python/myDevices/os/services.py
./myDevices-1.0/python/myDevices/os/systeminfo.py
./myDevices-1.0/python/myDevices/os/threadpool.py
./myDevices-1.0/python/myDevices/ipgetter/init.py
./myDevices-1.0/python/myDevices/cloud/init.py
./myDevices-1.0/python/myDevices/cloud/actions.py
./myDevices-1.0/python/myDevices/cloud/cayenneclient.py
./myDevices-1.0/python/myDevices/cloud/client.py
./myDevices-1.0/python/myDevices/cloud/dbmanager.py
./myDevices-1.0/python/myDevices/cloud/download_speed.py
./myDevices-1.0/python/myDevices/cloud/installer.py
./myDevices-1.0/python/myDevices/cloud/scheduler.py
./myDevices-1.0/python/myDevices/cloud/trigger.py
./myDevices-1.0/python/myDevices/cloud/updater.py
./myDevices-1.0/python/myDevices/cloud/vcom_id.py
./myDevices-1.0/libs/libSystemInformation.so
./myDevices-1.0/deb/debian_dependencies.txt
./myDevices-1.0/deb/download.sh
./myDevices-1.0/deb/install
./myDevices-1.0/deb/install_packages.sh
./myDevices-1.0/deb/libiw-dev/
./myDevices-1.0/deb/package
./myDevices-1.0/deb/python3-setuptools/
./myDevices-1.0/deb/tightvncserver/
./myDevices-1.0/deb/tightvncserver/expect_5.45-2_armhf.deb
./myDevices-1.0/deb/tightvncserver/install
./myDevices-1.0/deb/tightvncserver/libjpeg62-turbo_1.4.1-2_armhf.deb
./myDevices-1.0/deb/tightvncserver/tightvncserver_1.3.9-6.6_armhf.deb
./myDevices-1.0/deb/tightvncserver/xfonts-base_1.0.4+nmu1_all.deb
./myDevices-1.0/deb/python3-setuptools/install
./myDevices-1.0/deb/python3-setuptools/python3-pkg-resources_0.6.24-1_all.deb
./myDevices-1.0/deb/python3-setuptools/python3-setuptools_0.6.24-1_all.deb
./myDevices-1.0/deb/libiw-dev/install
./myDevices-1.0/deb/libiw-dev/libiw-dev_30~pre9-8_armhf.deb
./myDevices-1.0/3rd_party/enum34-1.0.4.tar.gz
./myDevices-1.0/3rd_party/install
./myDevices-1.0/3rd_party/install_packages.sh
./myDevices-1.0/3rd_party/iwlib-1.5.tar.gz
./myDevices-1.0/3rd_party/jsonpickle-0.9.2.tar.gz
./myDevices-1.0/3rd_party/netifaces-0.10.4.tar.gz
./myDevices-1.0/3rd_party/package
./myDevices-1.0/3rd_party/psutil-0.6.0.tar.gz
./myDevices-1.0/3rd_party/requests.tar.gz
./myDevices-1.0/3rd_party/suds-jurko-0.6.tar.gz

  • set -x
  • exec
    (0%)
    Sat 1 Jul 17:43:13 UTC 2017 Installing myDevices agent
    0
    Sat 1 Jul 17:43:43 UTC 2017 Found Python 3.4.2…
    (50%)
    Sat 1 Jul 17:43:43 UTC 2017 Copying agent libraries
    (55%)
    Sat 1 Jul 17:44:30 UTC 2017 Installing python utils
    (60%)
    Sat 1 Jul 17:44:39 UTC 2017 Installing software components
    Sat 1 Jul 17:44:40 UTC 2017 Trying to install myDevices for python3 version: Python 3.4.2
    Sat 1 Jul 17:44:41 UTC 2017 Build for Python 3.4.2 failed\n

When I use the commands suggested to try and fix the issue, none of them have worked and tell me to use “sudo apt-get -f install” to fix it, once I run those it says that it is unable to correct dependencies.

Hello sir,
can you try with:
sudo apt-get -f install
sudo apt-get dist-upgrade

To save the beginners from the trouble of python build failed errors, as a courtesy, I have compiled a bash script to install cayenne essentials (python build fails). This script installs a few things (Python 3, pip3, psutil, paho.mqtt.python, netifaces, jsonpickle, enum34) to make your cayenne installation experience on Raspberry Pi/Zero a litte better. This is no need to install raspbian OS again and again to solve this problem as advised on this forum in many posts. Also no need of dist-upgrade etc.

Instructions:

  1. Download bash script CayenneRaspiEssentials.txt (2.5 KB).
  2. Change the file extension from .txt to .sh using command ( sudo mv CayenneRaspiEssentials.txt CayenneRaspiEssentials.sh )
  3. Make this script executable by using command ( sudo chmod a+x CayenneRaspiEssentials.sh )
  4. Run it to install essentials by using command ( sudo ./CayenneRaspiEssentials.sh )

After that, do cayenne installation on your raspberry pi/0W as usual.

Please Note I did not find a way to download netifaces and enum34 directly from their website through bash script due to some SHA issue/error. These two will be downloaded from my dropbox.

Guys @shramik_salgaonkar @bestes @rsiegel @adam What do you think?

Kind Regards,
Sahar :man_student:

thanks for sharing this @Sahar. i will have a look at it and get back.

Yes, I have a couple suggestions:

run apt-get update first, and no need to run it at the end
install all apt packages with 1 line
use pip to install the python packages
post the script in your post to make it easier for users to see
I’m not a fan of entering a lot of data during scripts. Personally I’d take out the username part but I left it in my suggestions below

Suggestions below (I did not test this):

#!/bin/bash
START=$(date +%s)
bold=$(tput bold)
normal=$(tput sgr0)
clear
read -p "Hello, who am I talking to? " userName
clear
echo It\'s nice to meet you $userName. I am ${bold}Sahar${normal}, the author of this script. This script will install the following few softwares so that your cayenne installation go smooth:
echo
echo "1. Python 3"
echo "2. pip3"
echo "3. psutil"
echo "4. paho.mqtt.python"
echo "5. netifaces"
echo "6. jsonpickle"
echo "7. enum34"
echo
read -p "Do you want to continue (y/n)?" CONT
if [ "$CONT" = "n" ]; then
  clear
  exit 1 || return 1
else
  sudo apt-get update -y
  clear
fi
echo -ne '\007'
now=$(date)
echo -e "\e[31;43m***** Welcome. Automatic Installation Begins *****\e[0m"
echo -e "\e[31;43m*** Current Date and Time : $now ***\e[0m"
echo -e "\e[31;43m***** Installing Required Packages Via apt-get *****\e[0m"
sudo apt-get install git unzip wget python3 python3-pip -y
echo -e "\e[31;43m***** Setting Python3 As default *****\e[0m"
echo "alias python='/usr/bin/python3.5'" >> ~/.bashrc
echo -e "\e[31;43m***** Installing Required Packages Via pip *****\e[0m"
sudo pip install psutil paho-mqtt netifaces jsonpickle enum34
echo -e "\e[31;43m***** All Done! *****\e[0m"
END=$(date +%s)
DIFF=$(( $END - $START ))
echo "It took $DIFF seconds to complete this installation process."
read -p "Do you want to reboot now (y/n)?" CONT
if [ "$CONT" = "y" ]; then
  echo "Rebooting ...";
  sudo reboot now
else
  echo "Please reboot manually.";
fi
2 Likes

@Sahar The dependencies you are installing in that script should already be included in the newer agent installations. Are you installing a new agent by getting a new install script from the dashboard?

I also thought to install it using pip in a single line, but during the installation of the cayenne agent, once python builds failed, subsequent attempts to install these dependencies using pip also get failed dramatically. My poor raspberry pi zero w is behind the firewall of a large corporate network and due to the curse of NAT’d connection, access to pi through a reverse ssh tunnel is the solution for me and this could be a potential cause of pip failing. Nonetheless, the underlying real reason is still unknown to me. Furthermore, I added username and some extra detail to let the people know what is being installed in their computer and given them the right to cancel it if they feel unsatisfied, but you are right, loading script with extra details sometimes lead to spurious results.

I am trying to install Cayenne agent through the dashboard, like this. Add newDevice/WidgetSingle Board ComputersRaspberry Pi Then, Connect your Raspberry PiOption 2
Terminal / SSH
To download and install myDevices Cayenne on your Pi, use the Terminal on your Pi or SSH. Run the following commands:
wget https://cayenne.mydevices.com/dl/rpi_ha1ynwoz3l.sh
sudo bash rpi_ha1ynwoz3l.sh -v

Having said that, I can assume, I am installing the latest version of the Cayenne agent. Yes, I’m aware of the fact that all these dependencies are already included in your bash script, but due to unknown reason, the installation is ending at the error that occurs when the script finishes the downloading of the psutil. After that, installing these dependencies through pip/pip3 do not help too.

That sounds similar to this issue where a user’s network was blocking access to pypi.org: Failed to install Python 3.5.3 - #48 by sergio.agostinho

You might try some of the tests in that thread to see if that is the case. If so, then you are correct and pip3 won’t work for installing the dependencies while on the network. So your solution, or moving the Pi outside the network to install, then adding it back to the network are probably the only solutions for now. If a lot of users are seeing this issue we might try to come up with a workaround in the agent install.

3 Likes