uPyCraft on the Raspberry Pi (Ubuntu Buster)

Because I’m used to uPyCraft on my mac machines, to do some python coding on my ESP board (Lilygo ttgo T8 for example), I wanted uPyCraft also on my Raspberry Pi 4.
As I suspected, it was not available, but that didn’t hold me back 🙂
I compiled it from source, this was easier than expected !
(Don’t follow the guide that comes with the uPyCraft sourcecode, you will not get the expected results)

If you also would like to run uPyCraft, follow these steps:
(all commands in red are done on a command-line in a terminal):

Install Python3 and pip:
sudo apt-get install python3 python3-pip

Make a PyQt folder in the home-folder, and set the necessary access-rights:
sudo mkdir /home/PyQt
sudo chmod 777 /home/PyQt

Download file (at the bottom of this page) and store it in your /home/pi/Downloads folder !

Goto your Downloads folder, and unzip it, and untar it:
cd /home/pi/Downloads
unzip workfiles.zip
tar zxvf sip-4.19.24.tar.gz -C /home/PyQt
tar zxvf PyQt4_gpl_x11-4.12.tar.gz -C /home/PyQt
tar zxvf QScintilla-gpl-2.9.1.tar.gz -C /home/PyQt

Install needed files:
sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos qt4-designer
sudo apt-get install libqwt5-qt4 libqwt5-qt4-dev
sudo apt-get install libqscintilla2-qt4-13 libqscintilla2-qt4-l10n libqscintilla2-qt5-13 libqscintilla2-qt5-l10n

sudo apt-get install python-qt4 python-qt4-dev python3-pyqt4 python3-pyqt4.qsci
sudo apt-get install python3-pyqt5 python3-pyqt5.qsci

Time for some compilations (this may take some time !)
cd /home/PyQt/sip-4.19.24
sudo python3 configure.py
sudo make install

cd /home/PyQt/PyQt4_gpl_x11-4.12
sudo python3 configure.py
sudo make
sudo make install

cd /home/PyQt/QScintilla-gpl-2.9.1
cd Qt4Qt5
qmake
sudo make
sudo make install
cd ../Python
sudo python3 configure.py
sudo make
sudo make install
cd ../designer-Qt4Qt5
qmake designer.pro
sudo make
sudo make install


Finally, time to install uPyCraft:
cd /home/pi/Downloads
unzip uPyCraft_src-master.zip
cd uPyCraft_scr-master
sudo pip3 install pyinstaller
pyinstaller -F uPyCraft.py


uPyCraft is installed on your system, in /home/pi/Downloads/uPyCraft_src-master/dist !
try to run it:
cd dist
./uPyCraft


As a bonus, we do a bit of cleanup !
Close uPyCraft and remove the build-folders:
sudo rm -r -f /home/PyQt
cd /home/pi
mkdir uPyCraft
mv /home/pi/Downloads/uPyCraft_src-master/dist/uPyCraft /home/pi/uPyCraft/
rm -r -f /home/pi/Downloads/uPyCraft_src-master

rm /home/pi/Downloads/sip-4.19.24.tar.gz
rm /home/pi/Downloads/PyQt4_gpl_x11-4.12.tar.gz
rm /home/pi/Downloads/QScintilla-gpl-2.9.1.tar.gz


Everything is cleaned up, and uPyCraft can now be started by the following command:
/home/pi/uPyCraft/uPyCraft

Creating a desktop shortcut:
Look on the internet for a logo that you like to use for the shortcut.
The logo needs to be in PNG format, with a resolution of 128×128 px.
Store it in /home/pi/uPyCraft , and name it logo.png
Continue with the following commands:
cd /home/pi/desktop
nano upycraft.desktop


Put the following text into the nano editor:
[Desktop Entry]
Type=Application
Name=uPyCraft
Exec=/home/pi/uPyCraft/uPyCraft
Icon=/home/pi/uPyCraft/logo.png


Next, press <ctrl> and <x> , next you get a question to safe the buffer, answer with Y …
The shortcuts appears on your desktop, rename if necesary.
next, type pcmanfm in the terminal window.
Go to Edit => Preferences => General in pcman.
put a checkmark at “Dont’t ask options on launch executable file”

Close everything …
This should be it, you will have a new shortcut on your desktop, doubleclick it to start uPyCraft …

Enjoy 🙂













This entry was posted in Blog, Tutorials. Bookmark the permalink.

3 Responses to uPyCraft on the Raspberry Pi (Ubuntu Buster)

  1. bucheron says:

    Bonjour, je viens d’acheter le livre d’Elektor : makepython ESP32 Developpement kit – Programming & projects. Ils ne traitent que la version WINDOWS…. Alors votre page me semble très intéressante ! (hope you speak french…). Cordialement.

    • Kris says:

      Hello Bucheron,

      I understand French, but I can hardly write it, so my answer is in English.
      I don’t know the Elektor book, but it should not be that hard to use MicroPython in Linux. (In fact, it’s much easier)
      If you want, I can send you some PDF files to your email. (they are all in English, I hope that is OK ?)

      Best regards,
      Kris

Leave a Reply

Your email address will not be published. Required fields are marked *