Setting up developm...
 
Notifications
Clear all

Setting up development system  

  RSS
Dangerdad137
(@dangerdad137)
Active Member

Hey all.  I posted my Introduction over in the forums, and wanted to stimulate getting steps to put together whatever is needed for development.

I have a laptop with a fresh Ubuntu 20.04 install, and a VM on my desktop with 20.04 as well (the desktop has lots of RAM & CPU so a VM might actually perform better).  I've installed PyCharm as an IDE.

If I can get "next steps" then we can put together the bullet points of what's needed for a dev machine.  Or I can wait for a complete list, whichever is more convenient.

Quote
Posted : 04/05/2020 6:08 pm
Dangerdad137
(@dangerdad137)
Active Member

I see that there's a dev task to migrate from Python 2 to 3.  Is that complete?  Which version of Python should I install?

ReplyQuote
Posted : 04/05/2020 7:53 pm
mario
(@mario)
Member Admin

@Dangerdad137 welcome on board! 

Posted by: @dangerdad137

I see that there's a dev task to migrate from Python 2 to 3.  Is that complete?  Which version of Python should I install?

Yes that is correct. And this will be the upcoming release which will be 0.9.0. The python port is almost done. I am using python 3.7 but i think all version > 3.5 will work.

Just some notes about the project structure:

As you already discovered, the current working code is located at: https://github.com/mariolukas/FabScanPi-Server/tree/feature/python3

The new frontend code is located in this fork: https://github.com/KaZZacH/FabScanPi-Frontend

We need to get rid of the old frontend code. The old frontend code (FabScanPi-Frontend) is ugly and it's still written in coffee script and uses a grunt task to compile it to javascript. The code base is over 5 years old and didn't change since the first bottom up quick and dirty version. The backend code (FabScanPi-Server) much better.

The FabScanPi-Server acts as a webserver using Pythons tornado lib. A built version of the Frontend is located in the www folder of the FabScanPi-Server repository.

There is also a Firmware repository which holds the Arduino Firmware for the FabScanPi. The latest hex file is also located in the FabScanPi-Server firmware folder. https://github.com/mariolukas/FabScanPi-Firmware

A last repository keeps the build script for the Raspbian image. https://github.com/mariolukas/FabScanPi-Build-Raspbian

The last repository keeps all the files for the FabScan Pi case. https://github.com/mariolukas/FabScan-Case

As i mentioned in your welcome thread, i will try to do some documentation on how to setup the dev tool chain. 

ReplyQuote
Posted : 04/05/2020 9:02 pm
mario
(@mario)
Member Admin

I started to write some documentation on how you can setup pycharm for remote developing.

https://fabscanpi-server.readthedocs.io/en/develop/development_backend.html

It is not complete. Maybe some points are missing. But i think you will get an idea.

ReplyQuote
Posted : 07/05/2020 7:17 am
Dangerdad137
(@dangerdad137)
Active Member

So far I've run into the following:

missing module 'cv2' -- I installed it with:

pip3 install opencv-python

Now I get the following when running from PyCharm:

  File "/home/mping/dev/FabScanPi-Server/src/fabscan/server/services/api/FSStreamHandler.py", line 44, in FSStreamHandler
@tornado.web.asynchronous
AttributeError: module 'tornado.web' has no attribute 'asynchronous'
ReplyQuote
Posted : 08/05/2020 3:57 am
Dangerdad137
(@dangerdad137)
Active Member

Removing the decorator resolves the error leaving the @tornado.gen.coroutine in place -- not sure if that's the correct solution.

 

Also, I'm wondering if I fubar'd the current installation for development should I have the standard installation image SD or something different on the pi?

This post was modified 3 weeks ago 2 times by Dangerdad137
ReplyQuote
Posted : 08/05/2020 4:30 am
Dangerdad137
(@dangerdad137)
Active Member

I should add, I'm running on Ubuntu 20.04.
Python version is 3.8.2

tornado version is 6.0.4

ReplyQuote
Posted : 08/05/2020 4:47 am
mario
(@mario)
Member Admin

First of all, thank you again for joining the project!

Have you seen the guide. It describes how you can setup pycharm for remote development on the pi. Where you are developing and writing your code on your ubuntu machine, but the code runs on the pi when you execute it. That is the best way to go until we have the dummy driver stuff. 

https://fabscanpi-server.readthedocs.io/en/develop/development_backend.html

Posted by: @dangerdad137

I should add, I'm running on Ubuntu 20.04.
Python version is 3.8.2

tornado version is 6.0.4

I think that doesn't matter. But whenever i decided to add dependencies i tried to use those which are available over apt-get /aptidude. I know that pip is the python package manager and normally i use it when i do some python development. But due the fact that we build debian packages later it is easier to fit the package dependencies when we use only debian packages. 

Most packages can be installed by using 

sudo apt-get install python3-<package-name>

e.g. python3-opencv, python3-tornado ... etc.

If you are able to run it with pip packages you are good to go. 

By the way i've never tried to run the code on another system than the raspberry. I expect no problems. There is only one dependency which might be a problem, and that is the picamera library. It is only run able on the pi because it was written to drive the raspberry pi camera module and is more or less an abstraction layer for the low level camera driver. I think when we replace it by dummy drivers it shouldn't be a problem anymore.

One more thing, it is important to have a OpenCV installation with built-in multicore support. Most Linux distributions on desktop systems have opencv packages where multicore is compiled with multicore support. However the pre-compiled pi packages are not. 

That is the reason why the fabscan repository brings own opencv packages: 

https://archive.fabscan.org/pool/main/o/opencv/

I recompiled them with other flags. I don't know why the guys behind the raspbian disto don't do that. There are only a few very old raspberries not able to handle more than one core. 

The newest opencv version for python3 is still not in my archive. But i will add it this weekend. 

This post was modified 3 weeks ago by mario
ReplyQuote
Posted : 08/05/2020 6:49 am
Dangerdad137
(@dangerdad137)
Active Member

Yep, I followed the guide, and set it up for remote run. The errors I'm getting come when go through the steps.  It appears a version of tornado removed the 'asynchronous' decorator.  What are the versions on your dev machine?

In particular, the easiest thing to do is match my setup to yours -- if that means installing a different Linux, that's no problem.

Also, I'm concerned the rpi image will start the server by default, making it impossible for me to run the server via PyCharm because the server will already be bound to the web port.  Should I just put default raspian on the dev pi?

This post was modified 3 weeks ago by Dangerdad137
ReplyQuote
Posted : 08/05/2020 6:06 pm
mario
(@mario)
Member Admin

Any progess here ?

Byt the ways, there was a bug in the last image ( from 2020-01-01). I just released a new image wich should work now. 

https://github.com/mariolukas/FabScanPi-Build-Raspbian/releases/tag/v.2020-05-27-00-08

The FabScan Software Version is the same, but i fixed a couple of related operating system stuff which caused some problems with the fabscan server. 

In Detail: 

FabScan needs a opencv version compiled with tbb (multiprocessing flag). Raspbian released a newer version of opencv than my latest, so my compiled opencv was overwritten by the official ones. I added package pinning to this images, it so that this will not happen again.

This post was modified 3 days ago by mario
ReplyQuote
Posted : 28/05/2020 5:39 am
Share: