Sunday, June 8, 2025

Re: Integrating GRC-Generated Python Code into Python Virtual Environment

Hi Hamza,

it's great that you ask the mailing list! Because I've already replied to you in chat, I
think it's a good idea to echo what I wrote there here, so that people will find an answer
when they look for answers in the future:

If you want the system-installed GNU Radio to be available in your virtual environment,

python3 -m venv --system-site-packages

sets up your virtual environment in a way that allows access to the system-wide python
modules.

This is necessary, because numpy, pyqt, … as used by GNU Radio during built must be
ABI-compatible. You must not install a different version of these libraries in the virtual
environment!

Best regards,
Marcus

On 6/8/25 8:01 AM, Hamza Mohammed wrote:
> Hello all,
>
> I'm currently working on a standalone FM receiver Python application and would like to
> integrate a GNU Radio Companion (GRC) flow graph—specifically, FM receiver that I've
> already built and verified to work correctly.
>
> However, I'm unsure about the best approach to use the Python code generated by GRC within
> a Python virtual environment. My goal is to cleanly integrate the flow graph functionality
> into my application's codebase, ideally without relying on a system-wide GNU Radio
> installation.
>
> So far, I've considered a couple of possible options:
>
> 1.
>
> *Creating symbolic links* from my virtual environment to the system-installed GNU
> Radio libraries and Python modules.
>
> 2.
>
> *Using Conda* to install GNU Radio directly within a self-contained environment,
> avoiding the need for system-wide dependencies.
>
> Before I go too far down either path, I wanted to ask you guys.
>

No comments:

Post a Comment