#VSCode – Installing Visual Studio Code in a #RaspberryPi, a couple of lessons learned – @code

Hi!

Now that I have my amazing Raspberry Pi 4 with 4GB RAM, it’s time to see how serious the device is. So, I decided to install and use some developers’ tools in the RPi. My dev list will be something like this

  • Python
  • Some ML and AI Python packages
  • GIT
  • Arduino
  • Visual Studio Code

It’s been a while since I installed VSCode in the device. The last time I did this, I needed to download the code from GitHub and compile the tool in the Raspberry Pi. As far as I remember this was a +25 min process.

Lucky for us the process can now be much simpler, thanks to Headmelted (see references). Now, we only need a single command to install VSCode:

. <( wget -O -
https://code.headmelted.com/installers/apt.sh )

Install process started! Or Maybe not because I found this amazing GPG error

python error installing visual studio code in raspberry pi
pi@rpidev3:~ $ curl -L https://code.headmelted.com/installers/apt.sh | sudo bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2349 0 2349 0 0 19739 0 --:--:-- --:--:-- --:--:-- 19906
Detecting architecture…
Ensuring curl is installed
Reading package lists… Done
Building dependency tree
Reading state information… Done
curl is already the newest version (7.64.0-4).
The following packages were automatically installed and are no longer required:
python3-pyperclip python3-thonny rpi.gpio-common
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Architecture detected as armv7l…
Retrieving GPG key headmelted
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
gpg: no valid OpenPGP data found.
Removing any previous entry to headmelted repository
Installing [headmelted] repository…
Updating APT cache…
Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:2 http://archive.raspberrypi.org/debian buster InRelease
Get:3 https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease [23.4 kB]
Err:3 https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0CC3FD642696BFC8
Reading package lists…
W: GPG error: https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0CC3FD642696BFC8
E: The repository 'https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease' is not signed.
Done!
Repository install complete.
Installing Visual Studio Code from [stretch]…
Reading package lists… Done
E: The value 'stretch' is invalid for APT::Default-Release as such a release is not available in the sources
Visual Studio Code install failed.

There a public GPG key used to verify the package and the SH script somehow does not download it (I think the ARM RPI version is still not defined). So, before the previous command, I need to run this command

wget https://packagecloud.io/headmelted/codebuilds/gpgkey -O
- | sudo apt-key add –

Now we have Visual Studio Code installed!

raspberry pi visual studio code installed

But, yes another but, you may note that the tool open and display a black window. Again, I need to go deeper on the details, but the latest version does not work well. There is some context information on GitHub (see references), and the proposed solution is to rollback to a previous version

sudo apt-get install code-oss=1.29.0-1539702286

And we also need to disable the automatic updates on this tool

sudo apt-mark hold code-oss

And now, yes, we got a fully functional Visual Studio Code in our Raspberry Pi!

Happy Coding!

Greetings @ Toronto

El Bruno

References

Advertisements

#VSCode- Add #AzureIoT source files to your C++ settings in #VisualStudioCode

Hi!

Context: You may call me picky, but I like to read source code. And if I know that I have the source code, but I can reach it, I can’t code in happy mode.

So, I’m back to Azure IoT and while I was browsing the Project Catalog for my DevKit device. I hold myself in the [Get Started – Connect IoT DevKit AZ3166 to Azure IoT Hub] section thanks to this warning.

visual studio code mxchip get started cant find include errors

Don’t get me wrong, once you installed Visual Studio Code, Arduino and the complete set of dependencies; you can build and deploy everything. However, I need my peek definition and the following error is a stopper for me

visual studio code include file not found in browse.path
Error: Visual studio code include file not found in browse.path 

The main problem is that the C++ extension can’t found any of the Azure IoT files. So, we need to add the path to VSCode settings. Lucky for us, the tip bulb will directly guide us to this option

visual studio code edit browse path setting

We only need to add this path to the C++ settings. Of course, check your Arduino version and your username

C:\Users\{user name}\AppData\Local\Arduino15\packages\AZ3166\**

And that’s it! Peek definition and more is available now

visual studio code c++ peek definition

Happy coding!

Greetings @ Burlington

El Bruno

Resources

#VSCode – Let’s do some #FaceRecognition with 20 lines in #Python (6/N)

Hi !

I’ll start with my posts

  1. Detecting Faces with 20 lines in Python
  2. Face Recognition with 20 lines in Python
  3. Detecting Facial Features with 20 lines in Python
  4. Facial Features and Face Recognition with 20 lines in Python
  5. Performance improvements with code

In my last post I share some lines of code which allowed me to run some of the face recognition demos 6 times faster. I added a Frames per Second (FPS) feature in my samples. Later, thinking about performance, I realize that I don’t need to work with a full HD picture (1920 x 1080), so I added some code to resize the photo before the face detection process.

However, while I was coding arond this solution I also realized that I may want to initialize my camera to start in a lower resolution. So, I searched online on how to do this with OpenCV and I found 3 beautiful lines of code.

open camera with opencv with lower resolution

So, I manage to improve my processing code from 20FPS to +30FPS … which is very good ! Later on this posts I’ll try to do some similar FPS tests on a smaller device and I’ll see and share how this works.

Happy Coding!

Greetings @ Burlington

El Bruno

Resources

#Python – The best way to explain how jupyter notebooks works with Visual Studio Code @Code

Hi !

So, after my yesterday post [Edit and work with Jupyter notebooks in Visual Studio Code], today some people asked me how the Jupyter Notebooks and Python integration works.

The best way to explain this is with a simple animated video with the following actions

  • Create a cell using the prefix # %%
  • Run the cell and display the output in Python Interactive
  • Create a new cell
  • Run the new cell and the previous one
  • Analyze output in Python Interactive

I think this 15 seconds are good enough to understand the benefits of Jupyter Notebooks and Visual Studio Code.

Happy Coding!

Greetings @ NY

El Bruno

References

#VSCode – Edit and work with #jupyter notebooks in Visual Studio Code

Hi !

I’ve been using Python and Jupyter notebooks more and more. And somehow, during this learning path I also realize that I can use Visual Studio Code to code amazing Python apps, and also to edit and work with Jupyter notebooks.

If you are VSCode python developer, you may know some of the features available in the tool. I won’t describe them, because you may find the official documentation very useful (see below links or references).

The Python extension provides many features for editing Python source code in Visual Studio Code:

However, during the part months I’ve also working a lot using Jupyter notebooks, and I was very happy when I realize that VSCode also have some cool features to work with notebooks. The core of the notebooks are cells, and we can use them with the prefix #%%.

This is how it looks inside the IDE, running a cell in the code

Another interesting feature is to run notebooks in a remote Jupyter server, maybe using Azure Notebooks. I haven’t tried this one, and it’s on my ToDo list for the near future.

On top of adding cells features into standard python [.py] files, we can also edit standard Jupyter files. I’ve installed jupyter into one of my anaconda local environments, and now I can edit files inside VSCode.

First, I’ll be prompted to import the file as a standard python file

And, done! Now I got my Jupiter notebook inside VSCode

The final step will be to export my file or debug session, and for this we have the command [Python: Export …]

Super useful!

Happy coding!

Greetings @ NY

El Bruno

References

#VSCode – Visual Studio Code Tools for #AI available at Visual Studio Marketplace @code

Hi!

Happy Thanksgiving! Today is one of those new holidays that I need to learn, now that we are all living in the North. Just as I have to get used to spending more and more time in Visual Studio Code. It’s just because for simple tasks in Python, the experience with this IDE is great.

Well, a few days ago I realized that we also have [Visual Studio Tools for AI] in a specific version for VSCode.

Visual Studio MarketPlace: Visual Studio Code Tools for AI

As always, installation is a very simple process

01 vscode tools for ai install02 vscode tools for ai installed

Once the extension is installed, you may want to spend some time to review that all requirements of the development environment are correctly installed. Mostly focus on drivers and Paths, IMHO they can give you some very not happy times.

This is why it’s worthwhile to spend some time following this links

From here I think I will encourage my first real steps with Deep Learning!

Happy coding!

Greetings @ Burlington

El Bruno

References

Quickstarts

 

#VSCode – Visual Studio Code Tools for #AI disponible en el Visual Studio Marketplace @code

Buenas!

Feliz día de acción de gracias! Hoy es uno de esos festivos nuevos a los que tengo que acostumbrarme en el Norte. Así como tengo que acostumbrarme a pasar bastante tiempo en VSCode. Es solo porque para tareas simples en Python, la experiencia con este IDE es genial.

Pues bien, hoy me he enterado de que [Visual Studio Tools for AI] también tiene su version para VSCode.

Visual Studio MarketPlace: Visual Studio Code Tools for AI

Como siempre la instalación es un proceso muy simple

01 vscode tools for ai install02 vscode tools for ai installed

Una vez instalada la extensión, es conveniente repasar que todos los requerimientos del entorno de desarrollo estén instalados y bien configurados (drivers y paths pueden darte mas de un dolor de cabeza). Es por esto que dedicar un par de minutos a los siguientes links vale la pena

A partir de aquí creo que me animare con mis primeros pasos reales en Deep Learning!

Happy coding!

Saludos @ Burlington

El Bruno

References

Quickstarts

 

#Quantum – The key for Mac and Linux is on Visual Studio Code #VSCode

Hi!

Yesterday I wrote that one of the most important news of the last Update of the Microsoft Quantum Development Kit was the support for Mac and Linux. Well, this is achieved because the basis of Q# is the interaction of a host in .Net Core 2.0 and the connection to the Quantum Simulator.
This allows us to work with Microsoft Quantum DevKit using any language that supports .Net. Where C # and F # may be the most popular. And it is on this basis that we can also use Microsoft Quantum DevKit in other platforms, using Visual Studio Code as a development tool

.

I1

From Visual Studio Marketplace we can download an extension for VSCode that allows us to create projects in Microsoft Quantum DevKit. As expected we can also debug, write our Q # code and more with VSCode.

The installation is very simple. We start installing the extension for VSCode

I2

A couple of PowerShell commands

I3

And that’s it! now it’s time to program some Qubits 😀

Happy QCoding!

Saludos @ Toronto

El Bruno

References

My Posts

 

#Quantum – La clave está en Visual Studio Code #VSCode

Buenas!

Ayer comente que una de las novedades más importantes del ultimo Update de Microsoft Quantum Development Kit era el soporte para Mac y Linux. Pues bien, esto se logra ya que la base de Q# es la interacción de un host en .Net Core 2.0 y la conexión con el Quantum Simulator. Esto nos permite trabajar con Microsoft Quantum DevKit utilizando cualquier lenguaje que soporte .Net. Donde C# y F# tal vez sean los más populares.

Y es sobre esta base que también podremos utilizar Microsoft Quantum DevKit en otras plataformas, utilizando Visual Studio Code como herramienta de desarrollo.

I1

Desde Visual Studio Marketplace podemos descargar una extensión para VSCode que nos permite crear proyectos en Microsoft Quantum DevKit. Como es de esperar también podemos depurar, escribir nuestro código Q# y más con VSCode.

La instalación es muy simple. Comenzamos instalando la extensión para VSCode

I2

Y luego un par de comandos en PowerShell

I3

Listo, ya es momento de comenzar a programar nuestros qubits!

Happy QCoding!

Saludos @ Toronto

El Bruno

References

My Posts

 

#VisualStudio – Visual Studio for Mac, a new family member (Bonus: Linux Foundation!)

Hello!

Do you remember when Visual Studio was all you needed to create applications? It still the single tool you need. However now, you have several flavors to choose to depend on the application type, and your development style. Today at Microsoft Connect they confirmed the launch of Visual Studio for Mac.

However, it seems that behind this Visual Studio there is an old friend: Xamarin Studio (remember that Microsoft acquired Xamarin some time ago, link, this step was the natural one). IMHO, I I shall refuse to name it as “Visual Studio for…” until has support TFS integration.

And now, you can read the current status of the Visual Studio family and also a short description of each product in the notes below. But before, I think is good to share a couple of clarifications, because I have already read some posts where you begin to talk about issues without having clear some concepts:

  • It is true that now on Mac there are 2 options: Visual Studio and Visual Studio Code for Mac. However one is an IDE and the other one is a code editor.
  • Visual Studio Code as a code editor, and is he has matured much since the V1. However, I think that still can be clearly the distinction between IDE and Code Editor.
  • The same imitation of Mac could be done on Windows, where we have Visual Studio Code and Visual Studio 2017 RC (or release Visual Studio 2015)

Visual Studio Family

Clipboard04.png

 

Visual Studio 2017 RC focuses on improved productivity, refined fundamentals (performance improvements across all areas in VS 2017), streamlined cloud development, and great mobile development. To learn more, read the details in John Montgomery’s post announcing Visual Studio 2017 RC. The download is available here.

Visual Studio for Mac is a new Visual Studio IDE. It’s built from the ground up for the Mac and focuses on full-stack, client-to-cloud native mobile development, using Xamarin for Visual Studio, ASP.Net Core, and Azure. To learn more, read Miguel de Icaza’s blog post introducing Visual Studio for Mac. The download is available from here.

Visual Studio Mobile Center is “mission control for mobile apps.” It brings together multiple services commonly used by mobile developers into a single, integrated service that allows you to build, test, deploy, and monitor cloud attached apps in one place. To learn more, please read Nat Friedman’s blog post elaborating on Visual Studio Mobile Center.

Team Foundation Server 2017 RTM and Visual Studio Team Services is bringing general availability to Application Insights, Package Management service, Code Search, and 3rd party commerce to on-premises extensions. To learn more, please read Brian Harry’s blog post. Get started here.

Bonus and shock :

Microsoft joins the Linux Foundation

Greetings @ Toronto

El Bruno

References