1

I'm having some issues using gnuradio with python programs. I am trying to use gnuradio with gr-satellites' python programs to decode packets from CubeSats. When I try to run the command python filename.py, I receive the following output

Traceback (most recent call last):
  File "taurus1_telemetry_parser.py", line 23, in <module>
    from gnuradio import gr
  File "/usr/local/lib/python3/dist-packages/gnuradio/gr/__init__.py", line 39, in <module>
    from .runtime_swig import *
  File "/usr/local/lib/python3/dist-packages/gnuradio/gr/runtime_swig.py", line 117
    def value(self) -> "PyObject *":
                    ^
SyntaxError: invalid syntax

(BELOW COMMENTS EDITED FROM ORIGINAL POST)

It turns out that my system was set up to run python 2.7.15, when gnuradio runs python3. I adjusted my system so that it ran off of python 3.6.8, based on the instructions posted here. This changed my system to run python3.6.8 correctly, but I think I have installed gnuradio incorrectly, as I am still getting errors.

Now, if I run the command python3 filename.py I get the following output:

Traceback (most recent call last):
  File "taurus1_telemetry_parser.py", line 26, in <module>
    from . import by701_telemetry
ImportError: cannot import name 'by701_telemetry'

I successfully uninstalled the pybombs version of gnuradio using the command pybombs remove gnuradio uhd, as was suggested in the comments below, leaving only the ppa version installed.

Since there were so many issues with the gnuradio config, I tried to see if I could easily uninstall the ppa version and just start fresh with gnuradio. I went into my directory for gnuradio (Desktop/gnuradio/build) and tried a make uninstall. Doing a make uninstall process did not produce any errors, but this did not seem to remove gnuradio from my system entirely.

gnuradio can still be found in /usr/local/lib/python3/dist-packages, and I still get the ImportError when I try to run a python script. However, now when I enter head /usr/local/bin/gnuradio-companion, I get the following message:

head: cannot open '/usr/local/bin/gnuradio-companion' for reading: No such file or directory

The output of which gnuradio-companion is:

 /usr/bin/gnuradio-companion

I'm kind of lost on what to do here now. Any ideas on how gnuradio can either be fixed or uninstalled entirely?

sroger13
  • 11
  • 3

1 Answers1

1

The problem most probably is that you are starting your program with python2 while gnuradio has been compiled with python3.

You need to specify explicitly that a python3 interpreter needs to be used on the first line of your program (this line is called shebang)

#!/usr/bin/python3

or start your program the following way

$ python3 ./my_program.py

I installed gnuradio through ppa, as well as pybombs.

Having two versions could cause a lot of problems. My recommendation is to use the PPA version and remove the one installed with pybombs

$ pybombs remove gnuradio uhd
Vasil Velichkov
  • 1,236
  • 11
  • 17
  • Hi, Vasil - I implemented what you suggested, but I am getting a few new errors now. I adjusted my original post to detail these. Do you have any thoughts on the new issues? – sroger13 Jan 25 '20 at 22:46
  • "could cause a lot of problems": Will **definitely** cause a lot of problem. I do not recommend the usage of PyBOMBS for 99.5% of users. Great answer! – Marcus Müller Jan 26 '20 at 15:05
  • @sroger13 probably some remnants of manual installations mixing with the PPA installation. – Marcus Müller Jan 26 '20 at 15:06
  • @MarcusMüller do you have any thoughts on how I might want to get rid of the manual installations? Are there specific folders that I might want to manually delete or something similar? – sroger13 Jan 27 '20 at 16:15
  • @sroger13 Execute `find /usr/local/ -name "*gnuradio*" -or -name "*uhd*" -or -name "*volk*" -or -name "*pmt*"`, check if the output contains only gnuradio related files and return the same command with `-delete` option in order to delete all of the listed files. – Vasil Velichkov Jan 27 '20 at 16:45