ptrkrysik / gr-gsm

Gnuradio blocks and tools for receiving GSM transmissions
Other
1.34k stars 430 forks source link

gnuradio error #480

Open nocomp opened 5 years ago

nocomp commented 5 years ago

hi folks, first of all thxx for this great tool i used to have working, but no idea what i ve did, almost spend a day to get it back on rails with no luck. you are my last chance here is the situation: i ve installed on last kali version (used to work) using apt-get and now when i launch it i get:

nocomp@8uR34ud3sL1c0rn35:~/tools/sdr/gr-gsm$ grgsm_scanner Traceback (most recent call last): File "/usr/bin/grgsm_scanner", line 24, in from gnuradio import blocks ImportError: No module named gnuradio

so i ve pulled the git and when i try to build it i get for cmake ..

CMake Warning at CMakeLists.txt:135 (find_package): Found package configuration file:

/usr/lib/x86_64-linux-gnu/cmake/gnuradio/GnuradioConfig.cmake

but it set Gnuradio_FOUND to FALSE so package "Gnuradio" is considered to be NOT FOUND. Reason given by package:

Gnuradio could not be found because dependency Volk could not be found.

CMake Error at CMakeLists.txt:150 (message): GnuRadio Runtime required to compile gr-gsm

i ve uninstall and reinstall gnuradio gr-gsm many times still same error :'(

grc is in /usr/lib/python3/dist-packages/gnuradio/grc

and here are my paths:

sh -c 'set | grep -i path' DBUS_SESSION_BUS_ADDRESS='unix:path=/run/user/1000/bus' PATH='/home/nocomp/.local/bin:/home/nocomp/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin' WINDOWPATH='2'

all kind of helps are welcome, receiving my limesdr in 2 days and my whole world is broken... #HELPPPPPPPPPPPPPPPPPP

thxx for your time

kiransgk1si18lvs04 commented 4 years ago

Hi@velichkov I have added python path permanently by using your instruction.

I am running the scripts on python 3.7.6

still doesn't work.

kiransgk1si18lvs04 commented 4 years ago

Hi@velichkov I am using python 3.7.6. pythonpath added still program is not working.

#!/usr/bin/python3
import tkinter as tk
import subprocess
import shlex
def BCCH():
    while True:
        try:
                cmd=["grgsm_scanner","--args=rtl","-b","GSM900"]
                output= subprocess.getoutput(cmd)
                result=print('>', output)
                # put result in label
                if not output is None:
                    result['text'] = output.decode('utf-8')
        except subprocess.CalledProcessError as exc:
           print(exc.returncode)

my_gui = tk.Tk()

my_gui.geometry('600x600')
my_gui.title("Get output inside GUI") 
tk.Button(my_gui,text="GET BCCH", command=BCCH).pack() 
result = tk.Label(my_gui,font=50)
result.pack()

my_gui.mainloop()
velichkov commented 4 years ago

Hi @kiransgk1si18lvs04,

pythonpath added still program is not working.

What do you mean by "not working"?

Double check that the environment variable is exported correctly and that grgsm module is installed in /usr/local/lib/python3/dist-packages/

echo $PYTHONPATH
ls /usr/local/lib/python3/dist-packages/grgsm/
kiransgk1si18lvs04 commented 4 years ago

sorry I am noob in this case @velichkov
grgsm is inside the folder of `/usr/local/lib/python3/dist-packages/' grgsm_scanner works on command terminal in kali linux, but not works on above program.

The error details are,

Traceback (most recent call last):
  File "/usr/local/bin/grgsm_scanner", line 33, in <module>
    import grgsm
ModuleNotFoundError: No module named 'grgsm'

This is bash_profile

 GNU nano 4.5                                                                                      .bash_profile                                                                                       Modified  
export PYTHONPATH=/usr/local/lib/python3/dist-packages/:$PYTHONPATH

If i type "echo $PYTHONPATH" terminal, this shows up on terminal

echo $PYTHONPATH
/usr/local/lib/python3/dist-packages/:
velichkov commented 4 years ago

Hi @kiransgk1si18lvs04,

grgsm_scanner works on command terminal in kali linux, but not works on above program.

How do you start the above program? In your program somewhere at the top add the following and give me the output

import sys
print(sys.path)

and also give me the full output of ls /usr/local/lib/python3/dist-packages/grgsm

kiransgk1si18lvs04 commented 4 years ago

How do you start the above program? In your program somewhere at the top add the following and give me the output

By using .py file

['/home/kali', '/usr/bin', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.7/dist-packages']
Traceback (most recent call last):
  File "/usr/local/bin/grgsm_scanner", line 33, in <module>
    import grgsm
ModuleNotFoundError: No module named 'grgsm'
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.7/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/home/kali/bcch.py", line 15, in BCCH
    result['text'] = output.decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'

and also give me the full output of ls /usr/local/lib/python3/dist-packages/grgsm


kali@kali:~$ ls /usr/local/lib/python3/dist-packages/grgsm
arfcn.py                           clock_offset_corrector_tagged.pyo  fcch_detector.pyc  _grgsm_swig.so                     gsm_gmsk_mod.pyc         __init__.py              txtime_bursts_tagger.pyc
arfcn.pyc                          device.py                          fcch_detector.pyo  gsm_bcch_ccch_demapper.py          gsm_gmsk_mod.pyo         __init__.pyc             txtime_bursts_tagger.pyo
arfcn.pyo                          device.pyc                         fn_time.py         gsm_bcch_ccch_demapper.pyc         gsm_input.py             __init__.pyo
chirpz.py                          device.pyo                         fn_time.pyc        gsm_bcch_ccch_demapper.pyo         gsm_input.pyc            sch_detector.py
chirpz.pyc                         fcch_burst_tagger.py               fn_time.pyo        gsm_bcch_ccch_sdcch4_demapper.py   gsm_input.pyo            sch_detector.pyc
chirpz.pyo                         fcch_burst_tagger.pyc              grgsm_swig.py      gsm_bcch_ccch_sdcch4_demapper.pyc  gsm_sdcch8_demapper.py   sch_detector.pyo
clock_offset_corrector_tagged.py   fcch_burst_tagger.pyo              grgsm_swig.pyc     gsm_bcch_ccch_sdcch4_demapper.pyo  gsm_sdcch8_demapper.pyc  trx
clock_offset_corrector_tagged.pyc  fcch_detector.py                   grgsm_swig.pyo     gsm_gmsk_mod.py                    gsm_sdcch8_demapper.pyo  txtime_bursts_tagger.py
velichkov commented 4 years ago

By using .py file

How exactly? Do you run it from some IDE or from the command line?

['/home/kali', '/usr/bin', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.7/dist-packages']

The /usr/local/lib/python3/dist-packages/grgsm is not in sys.path and this explains why it can't find the grgsm module.

This is bash_profile

export PYTHONPATH=/usr/local/lib/python3/dist-packages/:$PYTHONPATH

Try adding the export line to your ~/.profile and logout and login again. See also https://help.ubuntu.com/community/EnvironmentVariables#A.2BAH4-.2F.profile

kiransgk1si18lvs04 commented 4 years ago

How exactly? Do you run it from some IDE or from the command line? I will run through python idle, and make a new file of .py and the version of python is 3.7.6 mail

Try adding the export line to your ~/.profile and logout and login again. See also https://help.ubuntu.com/community/EnvironmentVariables#A.2BAH4-.2F.profile

I studied it, and added path to .profile , I am getting same error output

sorry for attaching screen shot, to make convenient I have attached.

velichkov commented 4 years ago

I will run through python idle, and make a new file of .py and the version of python is 3.7.6

Try running your program from the command line - python3 ./bcch.py.

I studied it, and added path to .profile , I am getting same error output

Did you logout or reboot after adding it?

If yes then most probably the python idle reset the PYTHONPATH environment variable. I'm not familiar with this IDE and I don't know how to correctly set the PYTHONPATH in it.

kiransgk1si18lvs04 commented 4 years ago

Thanks for your time and help velichkov

kiransgk1si18lvs04 commented 4 years ago

Hi @velichkov I got solution for that, I just copied grgsm module to system located python dist packages.

sudo cp -r /usr/local/lib/python3/dist-packages/grgsm/ /usr/lib/python3/dist-packages/

Thanks for support, I have a last question when I type kal -s GSM900 it shows power 79296 that in terms of thousands, but when type grgsm_scanner in terminal its showing in terms of 10's ie 47 or 50 like that, Is that a signal strength

kal -s GSM900
Found 1 device(s):
  0:  Generic RTL2832U OEM

Using device 0: Generic RTL2832U OEM
Found Elonics E4000 tuner
Exact sample rate is: 270833.002142 Hz
kal: Scanning for GSM-900 base stations.
GSM-900:
        chan: 56 (946.2MHz + 11.560kHz) power: 79626.29
grgsm_scanner --args=rtl -b GSM900

ARFCN:   56, Freq:  946.2M, CID:   241, LAC: 21853, MCC: 404, MNC:  45, Pwr: -34
velichkov commented 4 years ago

Hi @kiransgk1si18lvs04,

I got solution for that, I just copied grgsm module to system located python dist packages.

sudo cp -r /usr/local/lib/python3/dist-packages/grgsm/ /usr/lib/python3/dist-packages/

I do not recommend doing this. If you can't find how to modify the PYTHONPATH in your IDE then in my opinion the next best thing is to create a symlink in /usr/local/lib/python3.7/dist-packages that points to /usr/local/lib/python3/dist-packages/grgsm/

sudo ln -sf /usr/local/lib/python3/dist-packages/grgsm/ /usr/local/lib/python3.7/dist-packages/grgsm

when I type kal -s GSM900 it shows power 79296 that in terms of thousands, but when type grgsm_scanner in terminal its showing in terms of 10's ie 47 or 50 like that, Is that a signal strength

My understanding is that these numbers are all relative and you can't compare them directly.

wisecrow86 commented 4 years ago

Greetings, Dear friends pls advise me how to settle my issue,

After i call: gnuradio-companion grgsm_livemon.grc it opens fine and have few blocks in red (gsm_input etc.)

System infos: Operating System: Kali GNU/Linux Rolling Kernel: Linux 5.5.0-kali2-amd64 Architecture: x86-64

grgsm call: root@a2v:~/Desktop/radio/gr-gsm/apps# gnuradio-companion grgsm_livemon.grc Welcome to GNU Radio Companion 3.8.1.0 Block paths: /root/.grc_gnuradio /usr/share/gnuradio/grc/blocks Loading: "/root/Desktop/radio/gr-gsm/apps/grgsm_livemon.grc"

i join a myscreen: grgsm

kubopiy commented 3 years ago

好人一生平安