How to install tensorflow on a raspberry pi 4 running Manjaro - python

I am trying to get tensorflow installed on a raspberry pi 4 which is running manjaro. It is to use the open source BNN library Larq, which recommended manjaro as an OS because it was 64bit as opposed to Raspbian. I have tried to install using yay from Archlinux user repository but got a couple different errors, like: "tensorflow/workspace.bzl: patch does not apply" and a failure to download. Any suggestions, I am very new to manjaro.
As a side note, I am not particularly stuck to Manjaro is anyone has experience using Larq and the larq compute engine on a RPi4 with a different OS any insight there would be helpful as well.
Thank you!

I cannot help you with Manjaro. However, I used Ubuntu 20.04 (64 bits) on my RPI4. I suppose you need the RPI4 to deploy and run your BNNs. If I am correct, I give you the following advice.
Please, note that the RPI4 is needed only to run LCE models (*.tflite). To this end, you don't need to install Tensorflow on your RPI4.
For everything else (see below) you can use a regular Linux box.
To check if everything is fine with your runtime environment (i.e. the RPI4), You can use your main Larq+LCE installation to convert one of your models into an LCE model and test it with the benchmark tool available here. For the RPI4+Ubuntu you should use lce_benchmark_model_aarch64.
If you need to compile your own BNN-based applications for your RPI4, you can follow the build guide on the LCE website. I did it once a long time ago. I used the LCE Docker to have a working environment. Then, from the inside of the docker, I followed the ARM guide: "Cross-compiling with Make" version.
I hope this helps.

Related

Python (PyCharm) and Fenics - Installation Problems

I’ve tried to install fenics and use the repository of the paper “Hybrid FEM-NN models: Combining artificial neural networks with the finite element method]” to calculate a linear Physics-Informed Neural Network for a linear problem (https://github.com/sebastkm/hybrid-fem-nn-examples/tree/main/examples/pinn_linear).
I’m using Windows 11 and Python 3.10.4.
To run the script main.py I need to use the fenics package. As usual working in python I did
pip install fenics
which worked without any problems. Trying to run the script prompted the error
from fenics import *
ModuleNotFoundError: No module named 'fenics'
After reading a couple of posts on this issue I made sure there are no other virtual environments anymore and that the path sys.path :
C:\Users\neuma\AppData\Local\Programs\Python\Python310\Lib\site-packages
contains the folder which contains the installed fenics packages:
fenics_dijitso-2019.1.0.dist-info
fenics_ffc-2019.1.0.post0.dist-info
fenics_fiat-2019.1.0.dist-info
fenics_ufl-2019.1.0.dist-info
fenics-2019.1.0.dist-info
I’ve noted that there is no folder named just fenics.
After this attempt did not work I tried to follow the instruction for DOLFINx (https://docs.fenicsproject.org/dolfinx/main/python/installation.html#dependencies) since some posts mentioned dolfinx and fenics are the same.
After installing the docker I followed the instructions on running fenics within the docker (https://fenics.readthedocs.io/projects/containers/en/latest/introduction.html#installing-docker). This at least seemed to work using the Terminal:
C:\Users\neuma>docker run -ti quay.io/fenicsproject/stable:latest
# FEniCS stable version image
Welcome to FEniCS/stable!
This image provides a full-featured and optimized build of the stable
release of FEniCS.
To help you get started this image contains a number of demo
programs. Explore the demos by entering the 'demo' directory, for
example:
cd ~/demo/python/documented/poisson
python3 demo_poisson.py
fenics#9548d966c2fc:~$ cd ~/demo/python/documented/poisson
fenics#9548d966c2fc:~/demo/python/documented/poisson$ python3 demo_poisson.py
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Solving linear variational problem.
To view figure, visit http://0.0.0.0:8000
Press Ctrl+C to stop WebAgg server
Visiting the url prompt the following message:
This page is not working
0.0.0.0 has not sent any data.
ERR_EMPTY_RESPONSE
Since I seem to have tried all possible versions of installation of fenics (and/or Dolfinx) and nothing worked I want to ask here if anyone could help me with the installtion.
I’m pretty confused about how to understand the difference betweend fenics and dolfinx and why I need Ubuntu or Linux and a Docker to run a package which already seems to be installed in python . Maybe this screenshot will make it a little clearer:
If you need any more information just let me know. Would be great if someone could help me out.
Oskar
In case anyone else struggles with this or similiar problems, the solution was given here: https://fenicsproject.discourse.group/t/installation-problems/9041/43

install opencv from source windows

I am trying to install OpenCV following this link https://docs.opencv.org/master/d5/de5/tutorial_py_setup_in_windows.html
opencv-4.5.1 is the version I am building from source. I have no errors in my entire process( up to Step 16)
Step 17 which INSTALL also has no errors, but Step 18 'import cv2 as cv' will not import this module.
I have python 3.9.1. I followed all the steps with CMAKE and was able to generate with no errors.
Is there something that I am missing here?
I would recommend to use another IDE like Pycharm to create your projects. It is extremely easy to setup an OpenCV work environment :).
IDLE is great for smaller projects but I`ve seen a lot of people having issues with it.

pytorch - package importing error...i have no idea

Image of code and pytorch and my error
I have no idea why this perfect baseline code is not running on my pc.
I fail to install "processes" package.
I fail to use modules of "tools".
Please help me...
The Perfect baseline is below.
https://github.com/audio-captioning/dcase-2020-baseline
Pls. make sure that you are using the same virtual environment in Pycharm(or the IDE) in which you have installed this.
You can run which python to check the python interpreter. Ensure that it is same in where you have installed. Also, check with pip list if proper installation is there and then go for the same import statement in a python terminal.

How to install Python on Windows 10

I have uninstalled Python and now I cant install it anymore (error 0x800705b4). Has anybody encountered this error ? I have tried different versions but nothing works.
You can try Anaconda for Windows which has seperate environments.
The solution I would recommend though is to use WinPython, which after install is just a folder with everything you need, doesn't change a thing in your windows environment and still works great! There is also a version that comes with the most used packages already installed, give it a try!
No need to mess with environments, just use a different WinPython folder for your projects!
Got the same error after a little digging I found the below thing...It works like a charm...
First...Make sure to check the setup package for your system which is X86 or x64, download packages based on the system before you proceed, otherwise, the hack won't work. The below is explained for x64 bit windows 8.1 system with a 64 bit Python setup package use the below-mentioned setup name(.exe file) in Step1: and search in google for downloading the Python setup
Start CMD as Admin, after that
Step1: ~YourFilePath/python-3.5.0-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0
Step2:
~YourFilePath/python-3.5.0-amd64.exe
~YourFilePath stands for the location of the python-3.5.0-amd64.exe file on your PC Example: E:\Softwares\python-3.5.0-amd64.exe
now after executing Step2: the setup will run without any errors..... Cool...
The above-mentioned steps should work or else If you find any difficulties please visit here which explains the process in detail. Good Luck...
Credits to this answer
Eventually what did the trick for me was to roll back the previous microsoft update (KB4512575)

One last issue getting DeepChem running with TensorFlow

I'm trying to install the DeepChem multi objective deep learning code on a MacBook Pro with a Python 2.7 environment. I did a manual install of DeepChem and its required components and all seemed to go well, no errors. When I tried to run the test data I got an error "Failed to load the native TensorFlow runtime". I then installed TensorFlow again in the VirtualEnv Python environment and this again went well. The Tensorflow validation worked OK. I tried the DeepChem test examples again and got the same error "Failed to load the native TensorFlow runtime". Can anyone please suggest a solution? Should I provide a complete error path?
Your question is really general and this is not really a tensorflow problem so much as a virtualenv/dependency question.
That said here are some possible fixes:
are you sure you have activated the virtualenv (should show
environment in parentheses before the bash prompt)? If not use:
source activate ENV_NAME
if you are running from an IDE (like pycharm) are you sure you are
using the virtualenv as your interpreter? If not follow this
guide.
Again, more information about your use case would be very helpful.

Categories

Resources