#RaspberryPi – Install Virtual Environments

Buy Me A Coffee


Virtual Environments are a great way to isolate our dev tests, and after been using this in Windows also, work with them in the Raspberry Pi makes a lot of sense.

I’ll leave here the necessary steps to do this, however the full credit is based on some posts from Adrian Rosebrock and his amazing blog (see references).

Once we have everything updated in our Raspbian, let’s run the following command:

sudo pip install virtualenv virtualenvwrapper
sudo rm -rf ~/get-pip.py ~/.cache/pip

Now we need to update the ~/.bashrc file using nano (not a big fan of VI )

nano ~/.bashrc

And then add the following lines

# virtualenv and virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source /usr/local/bin/virtualenvwrapper.sh

Now everytime we open a new terminal session, this commands will be applied and we will have our virtual environments up and running.

Next, source the bashrc file

source ~/.bashrc

And we can create a new virtual environment. Let’s create one named devOpenCV using python 3.

mkvirtualenv devOpenCV -p python3

We can enable and access the virtual environment with the workon command, and we will see the virtual environment as a prefix in our terminal

workon devOpenCV

As we can see in the following screenshot, the virtual environment uses the latest Python 3 version, and just a few packages installed.

Happy coding!


El Bruno


My posts on Raspberry Pi ⚡🐲⚡

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device

#RaspberryPi – How to install #DotNetCore in a #RaspberryPi4 and test with #HelloWorld (of course!)


During the next couple of months, I’ll be sharing some amazing experiences around AI. Some of these experiences includes IoT devices like a Raspberry Pi, and of course some Machine Learning.Net (ML.Net). Because ML.Net is built with .Net Core, it makes sense to share the 5 simple steps you need to do to install .Net Core in a Raspberry Pi.

Of course, my 1st try was to navigate to the official .Net page (see references), which automatically detect my Linux distro and proposes a set of x64 SDKs.

raspberry pi 4 .net tutorial page with linux distribution options

I’m completely sure that I’m working in a 32 bits environment, however I’ll double check this with the following commands

sudo apt-get install lshw

After installing lshw I confirm that I’m in a 32 bit environment

raspberry pi 4 lshw information on 32 bit environment

Bonus: lshw is a small tool to extract detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86 or IA-64 systems and on some PowerPC machines (PowerMac G4 is known to work).

Now I need to navigate to the download page to download the specific Linux 32-bit version (see references).

Once I got the image downloaded its time to extract the file on a specific folder. I’ve created a folder named “dotnet” with the following command

sudo mkdir -p dotnet

And to extract the image from the Downloads folder

sudo tar zxf dotnet-sdk-2.2.401-linux-arm.tar.gz -C

Let’s create a symbolic link to the extracted binaries

sudo ln -s /home/pi/dotnet/dotnet /usr/local/bin

And it’s done! Let’s invoke the .DotNet help command to test it

raspberry pi 4 .net core 2.2 installed and test dotnet help

Now we can follow the steps of [.NET Core on Raspberry Pi, see references] to create a Console Application and to test the device.

To create a new console App

dotnet new console
raspberry pi 4 .net core 2.2 create new console app

And test the app

sudo dotnet run
raspberry pi 4 .net core 2.2 console app run

We can publish the app for linux / raspberry pi

sudo dotnet publish -r linux-arm

And copy the generated folder to be used in another device

raspberry pi 4 .net core 2.2 console app build and publish folder to reuse

So next steps will be some other tests with Raspberry Pi and .Net Core. And the following image is a big teaser of this

raspberry pi 4 .net core 2.2 console app edit in Visual Studio Code

Happy coding!

Greetings @ Toronto

El Bruno


My posts on Raspberry Pi ⚡🐲⚡

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device

#RaspberryPi – How To enable auto start with #HDMI safe mode


A couple of days ago I wrote (a personal reminder post) about how to add automatic connect to Wi-Fi and SSH enabled in a bootable Raspbian image in a SD card (see references). I also explained that this was required for me because, by default Raspberry Pi 4 video ports were not starting with a 1920 x 1080p resolution.

Important: Remember that now, the 2 video ports supports 4K !

I was digging and reading about this, and I found another quick fix to solve this problem. Once you had a Raspbian image in a SD card, you can edit the file [config.txt] for some amazing cool tweaks! (Also, see references)

For me, my main change was in the [hdmi_safe] parameter. Setting hdmi_safe to 1 will lead to “safe mode” settings being used to try to boot with maximum HDMI compatibility.

# uncomment if you get no picture on HDMI for a default "safe" mode 

With this, the device will start automatically in a safe and standard mode. And, yes, it will work with my old and crappy test monitor!

Happy coding!

Greetings @ Toronto

El Bruno


My posts on Raspberry Pi ⚡🐲⚡

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device

#RPi – Some #RaspberryPi screen options and how to quickly find your device IP with #RaspberryPi Finder from @Adafruit

Hi !

Today’s post is about my experience doing presentations and demos with a Raspberry Pi.

Doing demos with a Raspberry Pi is amazing. I really enjoy share some of the amazing stuff we can do with the device, and usually there is one or two people in the audience who can share other even better Raspberry Pi experiences.

The only issue that you find in this scenarios is an easy way to connect your device to an internet connection. Sometimes, using a standard network cable between your laptop and the device is good enough, however there are other scenarios where connecting to a network is more complicated. In example: the Raspberry Pi connects automatically to a WiFi network, and you need to find the IP address to interact with the device.

These days, I ordered a Raspberry Pi 3 case with includes a 3.5 inches TFT screen, also with touch capabilities. I hope that, using this and a Bluetooth keyboard should make my life easier. (see references)

Sometimes you can’t connect your device to a HDMI screen, so a good option is to bring your own 7 inches screen for the device. For me, this is not optimal, because I need to handle a lot of cables, but it works every-time!

The following image show my typical hotel bedroom when I’m speaking and using a Raspberry Pi. Laptop, Raspberry Pi, Bluetooth keyboard, a mouse, the 7 inches screen, and more.

Finally, if your device is connected to the same wireless network but you don’t know the IP address, you may want to use a tool like Adafruit Raspberry Pi Finder. It only requires 2 clicks to find one or more devices in your network.

I’ll leave this here, and maybe in the near future I’ll update this posts with my experiences using the small case with TFT screen.

Happy coding!

Greetings @ Burlington

El Bruno