astrochart / CHART

Completely Hackable Amateur Radio Telescope
https://astrochart.github.io
105 stars 7 forks source link

CHART_GUI in python virtual environment (VENV) #204

Closed EphemeralDisco closed 1 week ago

EphemeralDisco commented 1 month ago

Unable to get CHART_GUI working in python virtual environment.

per adafruit: Starting with the October 10, 2023 Bookworm release of the Raspberry Pi OS, the use of Python Virtual Environments (venv) when pip installing packages is required. No more sudo pip. This will break things and require learning new things. Yeah.

lmberkhout commented 1 month ago

Hello! Could you please provide a little more detail on this issue so we can help solve it? What is the error you are running into trying to get CHART_GUI working in the venv?

adampbeardsley commented 1 month ago

I believe the issue is that our gnu radio install is global (via the sudo apt install commands), so the virtual environment doesn't see them. Here's the workaround that seems to work for me:

First install gnuradio etc. (note if you're using the rtl-sdr blog v4 dongle, you'll need to install that driver according to https://www.rtl-sdr.com/v4/ (issue #203 )) $ sudo apt install gnuradio-dev gr-osmosdr librtlsdr-dev build-essential git cmake

Next, create a virtual environment that can see the global installs: $ python -m venv --system-site-packages ~/myenv Activate the venv: $ source myenv/bin/activate

Now continue on with the python installs:

(myenv) $ pip install ipython
(myenv) $ pip install numpy
(myenv) $ git clone https://github.com/astrochart/CHART.git
(myenv) $ cd CHART
(myenv) $ pip install .

At this point, it appears everything is properly installed. The only issue is that the setup script quietly failed to create the GUI link on the desktop... not sure why. But that's ok, you can simply run it from the terminal (with your venv activated): (myenv) $ gui.py That should launch the data collection GUI.

I'll make a PR with these instructions in the README. @EphemeralDisco Let us know if this fixes your issue.

EphemeralDisco commented 1 month ago

This seems to do the trick! Thank you for helping us figure this out!

Just FYI - The default RPi Bookworm image does not include xterm which is required by GNU radio, so I'm adding this to our instructions: sudo apt-get install xterm

Also, for activating the venv, this command from above did not work: $ source activate myenv/bin/activate but it did work without "activate" before the path: $ source myenv/bin/activate

chris

Chris Huebner (he/they) Design and Innovation Specialist St. Paul Academy and Summit School https://www.spa.edu/

On Tue, May 21, 2024 at 9:07 AM Adam Beardsley @.***> wrote:

I believe the issue is that our gnu radio install is global (via the sudo apt install commands), so the virtual environment doesn't see them. Here's the workaround that seems to work for me:

First install gnuradio etc. (note if you're using the rtl-sdr blog v4 dongle, you'll need to install that driver according to https://www.rtl-sdr.com/v4/ (issue #203 https://github.com/astrochart/CHART/issues/203 )) $ sudo apt install gnuradio-dev gr-osmosdr librtlsdr-dev build-essential git cmake

Next, create a virtual environment that can see the global installs: $ python -m venv --system-site-packages ~/myenv Activate the venv: $ source activate myenv/bin/activate

Now continue on with the python installs:

(myenv) $ pip install ipython (myenv) $ pip install numpy (myenv) $ git clone https://github.com/astrochart/CHART.git (myenv) $ cd CHART (myenv) $ pip install .

At this point, it appears everything is properly installed. The only issue is that the setup script quietly failed to create the GUI link on the desktop... not sure why. But that's ok, you can simply run it from the terminal (with your venv activated): (myenv) $ gui.py That should launch the data collection GUI.

I'll make a PR with these instructions in the README. @EphemeralDisco https://github.com/EphemeralDisco Let us know if this fixes your issue.

— Reply to this email directly, view it on GitHub https://github.com/astrochart/CHART/issues/204#issuecomment-2122723780, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCBUQWKBLWKVKUD4ZKJFC6DZDNILFAVCNFSM6AAAAABH75U4LKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRSG4ZDGNZYGA . You are receiving this because you were mentioned.Message ID: @.***>

adampbeardsley commented 1 month ago

Sorry about the typo! Glad this worked... let us know how the observing goes!