How to install Python Packages

I need to install a python package that is not currently available:

AHRS · PyPI

Yesterday I was able to do a pip3 install ahrs and it seemed to work but it is not recognized in they Python sketch when I do

from ahrs.filters import Madgwick

Tried reinstalling this morning after the recent update and seems things broke so does not seem to work anymore.

Thanks in advance

I don't know anything about Python, but I bet for you to get some help, you will need at a minimum the OS you are using, which board you are using, and I suspect more.

Well since this is a Arduino Q forum I would have thought it was obvious that I am using a Arduino Q. And since I am asking about Python I must be on linux side with the qualcomm chip. Didn’t think I need to specify:
Arduino Q

using .\adb shell

and trying

pip3 install ahrs.

Thought it would be obvious - guess not!

Durn, I need to remember to look at the top of the page.

2 Likes

For documentation I did find in another post that

To add Python packages to your application, select the main.py file and click on the “Add file“ icon. Create a requirements.txt file and list the Python packages you need. See Requirements File Format - pip documentation v25.2 for more information.

Sorry forgot where I found this but think it was written by @manchuino in Arduino Q info Tkinter - UNO Family / UNO Q - Arduino Forum

Now question is once it installs the package do I still need to keep requirements.txt. Also, can I use pip3 if in activate venv at

Activating python virtual environment Using Python 3.13.9 environment at: .cache/.venv

1 Like

Hi @Merlin513. Note that the Python script of the App is running in an isolated environment inside a Docker container:

Conversely, the shell you reach via adb shell is in the global environment of the Linux machine.

Morning @ptillisch . Thanks for the explanation. I did finally manage to get my test app working late last night where I am sending accel/gyro/mag data from the arduino to linux and then sending roll/pitch/yaw back to the arduino. Quite a learning experience.

Any plans for a Bridge for dummies tutorial :slight_smile:

1 Like

Hello everyone, I'm in the same situation as @Merlin513 so earlier I opened a new thread

@Merlin513 how were you able to install successfully that package?

Think you found your answer in the other thread about adding a requirements.txt file under python and then adding your python package to the file.