-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can't import RtlSdr #7
Comments
Seems like it might be an OSX or Python 2.6 ctypes issue (I haven't tested on either). Have you tried with Python 2.7? |
I get the same error in 2.7: from rtlsdr import * |
Strange, seems like their might be an issue with your librtlsdr library. What happens if you type |
It doesn't respect LD_LIBRARY_PATH, and is really just saying that it can't find the library. I had to do..
in load_librtlsdr() to make it work... Also, just straight up ctypes.cll.LoadLibrary("librtlsdr.so.0" works better for me than the util.find_library stuff... |
I can't get this to load either. Trying to manually walk through the steps that load_librtlsdr() goes through, and using karlp's suggestions help nail it down a little closer:
|
@emf: can you verify that any of the programs included with librtlsdr work? Sounds like you may have a libusb issue too. |
Hello, I'm getting the very same problem, i'm on slackware 14.1 with 32bit libraries installed. I can see the file in the python dir as follows /usr/lib64/python2.7/site-packages/ | grep rtl shows pyrtlsdr-0.1.1-py2.7.egg is that the correct file and location ? Sorry I'm not very Python aware :-) Stuart |
By the way if I run "rtl_test" I get the following. bash-4.2# rtl_test Using device 0: Generic RTL2832U OEM Info: This tool will continuously read from the device, and report if Reading samples in async mode... User cancel, exiting... |
Are your Python and librtlsdr installations both 32 bit? That might be the issue. BTW the latest version is 0.2.0. Try running |
Thanks for the quick reply, All my base packages are 64 bit as 14.1 has dropped 32bit from the install, I had to install the 32bit multilib stuff for MPLABX . I dont think pip is on my system , is it totaly awsome and worth having ? :-) I used http://slackbuilds.org/ for some of the required packages, I've noticed some arn't the latest version so I have been uninstalling and updating them with a fresh build from source. I re downloaded the 0.2.0 hears the install output, all looks ok (I think)bash-4.2$ sudo python setup.py install Installed /usr/lib64/python2.7/site-packages/pyrtlsdr-0.2.0-py2.7.egg When I start the program :bash-4.2$ ./rtlsdr_scan.py File "build/bdist.linux-x86_64/egg/rtlsdr/librtlsdr.py", line 52, in AttributeError: python: undefined symbol: rtlsdr_get_device_countHears the $PATH output incase thats helpful bash-4.2$ echo $PATH :/usr/lib64/qt/bin:/usr/share/texmf/binI tried bash-4.2$ export PATH=$PATH:/usr/lib64/python2.7/site-packages in case this was a problem, didn't make a difference. I saw the post above by KARLP , but didn't quite understand what he was saying. Thanks, Stuart |
Hmm... Can you run Also you can try deleting these lines from librtlsdr.py (wherever it's installed): f = librtlsdr.rtlsdr_get_device_count
f.restype, f.argtypes = c_uint, [] Then try again. |
Ok I found the librtlsdr.so (I had to read man find as always) /usr/local/lib/librtlsdr.so I ran nm -D /usr/local/lib/librtlsdr.so 0000000000004420 T rtlsdr_get_device_count
000000000020d920 B bss_start |
With regard to this bit , it dosn't seem to have installed that file corectly , I just did a find and it's only showing in the src directories not any library dir. or did you meen to change that file and run the install again ? Sorry for being a bit slow, Stuart Also you can try deleting these lines from librtlsdr.py (wherever it's installed): f = librtlsdr.rtlsdr_get_device_count |
Odd that librtlsdr.so seems fine. Can you run this in a Python shell and give me the output: from ctypes import *
from ctypes.util import find_library
print find_library('rtlsdr'), find_library('librtlsdr')
dll = CDLL("/usr/local/lib/librtlsdr.so")
print dll
print dll.rtlsdr_get_device_count The file librtlsdr.py should definitely be somewhere on your computer if you have pyrtlsdr installed. You could try modifying the source file from the installation package and re-installing. |
ok Python shell , thats new to me :-) I ran it hears the copy and paste
to my inexperianced python eye it looks like it couldn't find an .so lib but found it as a .dll now i'm totaly confused :-) Stuart |
I've also re ran the python install for the rtlsdr with python instal.py install_lib now I have /usr/lib64/python2.7/site-packages/rtlsdr/librtlsdr.py |
How about this: from ctypes import *
from ctypes.util import find_library
file_name = find_library('rtlsdr')
dll = CDLL(file_name)
print dll
print dll.rtlsdr_get_device_count |
Hello, Just did that hears the copy and paste
Thanks for the help by the way, Stuart |
I found the lines in the .py file in the python librarys and commented out the lines you suggested , it didn't seem to change the error so I put them back. Stuart |
Ok, I believe I know what's wrong. Try this: import ctypes
from ctypes.util import find_library
file_name = find_library('rtlsdr')
dll = ctypes.cdll.LoadLibrary(file_name)
print dll
print dll.rtlsdr_get_device_count |
ok done that hears the copy and paste bash-4.2# python
|
Maybe you don't have Try running |
Indeed , I feel a little silly and can only hope this helps someone else also :-) Many many Thanks, Interestingly my $LD_LIBRARY_PATH was totally empty , I will read up on weather this is normal for my distro (slackware 14.1 x64) Stuart. |
No problem, glad you got it working and I can close this issue :) I'll add the stuff about Cheers, |
Roger: Thanks for any advice, |
I see no reason why it would be any different in Ubuntu, have you tried |
Roger: Thanks, |
See here, for example, to see how to do it permanently. rtlsdr_scan.py isn't a part of pyrtlsdr, so you probably didn't install RTLSDR-Scanner correctly (that's completely separate from this project). If demo_waterfall.py or test.py work, then it sounds like you've installed pyrtlsdr correctly. |
Roger: Freddie |
No prob, hope you get it working. |
Hopefully roger- is still monitoring.. I'm trying to get TinyPython|Panadapter going, eventually on a Raspberry Pi2, but to start with on my desktop (ubuntu-mate 15.10). When I run pyrtlsdr's setup.py I get a compile error (see below regarding the caret location): running install_egg_info ` I'm no python expert - one idea of this is to learn more about it - so I'm puzzled by this message. My books and searching around haven't helped. I had to change the permissions on /usr/local/lib/python2.7/dist-packages/pyrtlsdr-0.1.1.egg-info so the setup could change it. I've done the export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib as it wasn't on the path Ideas welcome, TIA Chris |
Oh it looks like that's a Python 2.7 issue that I need to fix. In the mean time just remove * and see if that works. |
@roger- Yup, those unpacking generalizations introduced in py3.5 are difficult to make backwards compatible.
Since the arguments are all named it would seem that the additional |
Thanks for the quick reply, much appreciated. If I remove * and the , I get another error further down: `byte-compiling /usr/local/lib/python2.7/dist-packages/rtlsdr/rtlsdraio.py to rtlsdraio.pyc SyntaxError: invalid syntax ` If I remove just the * I see:
Chris |
Ok, so the solution that I came up with here to avoid importing An alternative may need to be found, perhaps modifying |
@roger- I may have time later on today to play around with setuptools on my fork (and maybe even build some tests with TravisCI across different versions). |
@nocarryr - thanks for your replies. The file init.py (with underscores) is present in the rtlsdr directory below setup.py along with rtlsdraio et al. I didn't (knowingly) use pip, I got the source via a git clone from the roger- repository |
Yeah the * isn't really necessary, it just forces the async Thanks for your help with this, will merge your fix. |
👍 @roger- I started some work on automated tests with travis-ci btw: Running the tests themselves would be a bit difficult though without the device present in the build environment, but I'm hoping to find ways of at least having it test for issues like this one... eventually even have tests run with a 'dummy' device |
I don't have any travis experience, but looks like a good thing to have! |
I didn't either until recently. I just decided I wanted to figure it out one day to fix stuff on another project. I'm not an expert by any means, but it's fun to learn |
I'm not sure if this is the place for this... I had an issue: "undefined symbol: rtlsdr_set_bias_tee" Solved it with export LD_LIBRARY_PATH="/path_to_libs/" Many thanks! |
In my case, I don't have the librtlsdr.so. |
Dear Roger, I tried in Anaconda Prompt: (base) D:\pyrtlsdr-master> or tried our own small myrtldsr.py with content: with this result in pyrtlsdr-master directory: and in the other directory: or trying your python files: (base) D:\pyrtlsdr-master\build\lib\rtlsdr>python librtlsdr.py (base) D:\pyrtlsdr-master\build\lib\rtlsdr> Could you please help? |
@ET313 The first error you had:
Is most likely an issue with device drivers and the librtldsr installation. I would recommend running the The second one is just an import issue: import rtlsdr
sdr = RtlSdr() Should be: import rtlsdr
sdr = rtldsr.RtlSdr() |
many thanks for helping at import issue! Using device 0: Terratec T Stick PLUS could you help? |
Hmmm. The description of the error code is "LIBUSB_ERROR_NOT_FOUND" (which isn't very helpful) As well as issues on librtldsr: |
i think i found solution, you have to add Path in environmental variables to lib from this link |
Thanks - I'll give that a try
…On 18/06/2023 15:01, RenatZvezdkin wrote:
i think i found solution, you have to add Path in environmental
variables to lib from this link
it worked for me
https://ftp.osmocom.org/binaries/windows/rtl-sdr/
<https://ftp.osmocom.org/binaries/windows/rtl-sdr/>
—
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEC5UMY3TXXOORAZUC5FMMDXL4C5NANCNFSM4ACT7S4Q>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Sorry, it is may be my local issue?
The text was updated successfully, but these errors were encountered: