Skip to content
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

AttributeError when running examples/txrx_sim.grc #11

Closed
pgorczak opened this issue Mar 14, 2017 · 14 comments
Closed

AttributeError when running examples/txrx_sim.grc #11

pgorczak opened this issue Mar 14, 2017 · 14 comments

Comments

@pgorczak
Copy link

When running examples/txrx_sim.grc, I get

File "/gr-lora/examples/top_block.py", line 89, in main
    tb = top_block_cls()
  File "/gr-lora/examples/top_block.py", line 35, in __init__
    self.lora_mod_0 = lora.mod(spreading_factor, 0x12)
AttributeError: 'module' object has no attribute 'mod'

Seems like unlike in #7, the module is found but it does not contain the mod function. Could this be an issue with swig? I'm running on Debian Stretch.

@matt-knight
Copy link
Contributor

Hi @pgorczak,

I'm not sure what the issue is, but I suspect it's related to #12. Can you post your system and GNU Radio configuration so I can attempt to reproduce on my end? OS distro and version, GNU Radio version/git hash, etc.

@pgorczak
Copy link
Author

pgorczak commented Mar 15, 2017

Hi @matt-knight, thanks for your quick response!

I'm running a dockerized Debian GNU/Linux 9.0 (stretch) with GNU Radio 3.7.10.1 from the most recent version of master (0be096f).

You could try my Docker image if you want to reproduce it exactly. I put a Dockerfile up on Gist.

@matt-knight
Copy link
Contributor

@pgorczak Awesome, thanks for the detailed reply! I'll try to reproduce over the next few days. It's possible that with the GNURadio or Debian version bump some things got moved around.

@pierreduf
Copy link

pierreduf commented Jul 19, 2017

Hi,

I've got the exact same issue on Ubuntu 16.04 and GNU Radio v.3.7.9 installed from the official repos.

When I go into my /usr/local/lib/python2.7/ my gr-lora files are in dist-package/lora (not in site-packages like mentionned in issue #12)

When I import the "lora" package in Python prompt, it's working but indeed it has not "mod" attributed (thus the initial error).

What did I missed ? I know the thread is a bit old but have you finally managed to get it work ?

@pierreduf
Copy link

I tried the "usrlocal.pth" trick in the #7 but without any success. My build manifest for the gr-lora module is as follows :

I have a lot of less file that in #7 . What could have happen ?

/usr/local/lib/cmake/lora/loraConfig.cmake /usr/local/include/lora/api.h /usr/local/include/lora/demod.h /usr/local/include/lora/decode.h /usr/local/include/lora/mod.h /usr/local/include/lora/encode.h /usr/local/lib/libgnuradio-lora.so /usr/local/lib/python2.7/dist-packages/lora/__init__.py /usr/local/lib/python2.7/dist-packages/lora/__init__.pyc /usr/local/lib/python2.7/dist-packages/lora/__init__.pyo /usr/local/share/gnuradio/grc/blocks/lora_demod.xml /usr/local/share/gnuradio/grc/blocks/lora_decode.xml /usr/local/share/gnuradio/grc/blocks/lora_mod.xml /usr/local/share/gnuradio/grc/blocks/lora_encode.xml

@pgorczak
Copy link
Author

Hey @pierreduf, I'm sorry but I didn't get around to do more troubleshooting on this yet.

@Flamewires
Copy link

Flamewires commented Jul 21, 2017

try running sudo ldconfig after running make install. I was getting the exact same error:

Traceback (most recent call last):
  File "/home/USER/git/gr-lora/build/top_block.py", line 131, in 
    main()
  File "/home/USER/git/gr-lora/build/top_block.py", line 119, in main
    tb = top_block_cls()
  File "/home/USER/git/gr-lora/build/top_block.py", line 87, in __init__
    self.lora_mod_0 = lora.mod(8, 0x12)
AttributeError: 'module' object has no attribute 'mod'

Assume its just a symptom of the python code not finding the compiled library. Probably stores a reference to it in mod?

@matt-knight
Copy link
Contributor

All,

I'm checking in to note that I haven't been able to reproduce this issue. I just stood up the following in a VM without issues.

Ubuntu 16.04.1
GNU Radio 3.7.11
gr-lora d587169

For starters, please run python -c "import sys; print '\n'.join(sys.path)" and print the result here so we can verify your python path includes the install directories. Share echo $LD_LIBRARY_PATH while you're at it too. I always install to /opt and manually export paths so I'm curious if there's a discrepancy here.

If that's not fruitful, I'll ask you to share your system configuration and versions so I can attempt to reproduce.

Best,
Matt

@matt-knight
Copy link
Contributor

Given that several have had installation issues, I added some build and configuration guidelines to the Wiki: https://github.com/BastilleResearch/gr-lora/wiki/Installation

There are several viable ways to install GNU Radio and related modules, but this is the process I use. If your method isn't working, document it here and I'll see if I can troubleshoot.

@pgorczak
Copy link
Author

pgorczak commented Jul 24, 2017

I got around to trying again. When checking the CMake output, I discovered some suspicious lines:

[...]
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Could NOT find PkgConfig (missing:  PKG_CONFIG_EXECUTABLE) 
[...]
-- Checking for module SWIG
-- Disabling SWIG because version check failed.
[...]

I guess no Doxygen is OK but I'll look further into the PkgConfig and SWIG issues.

FWIW, install still works with output

Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/cmake/lora/loraConfig.cmake
-- Installing: /usr/local/include/lora/api.h
-- Installing: /usr/local/include/lora/demod.h
-- Installing: /usr/local/include/lora/decode.h
-- Installing: /usr/local/include/lora/mod.h
-- Installing: /usr/local/include/lora/encode.h
-- Installing: /usr/local/lib/libgnuradio-lora.so
-- Installing: /usr/local/lib/python2.7/dist-packages/lora/__init__.py
-- Installing: /usr/local/lib/python2.7/dist-packages/lora/__init__.pyc
-- Installing: /usr/local/lib/python2.7/dist-packages/lora/__init__.pyo
-- Installing: /usr/local/share/gnuradio/grc/blocks/lora_demod.xml
-- Installing: /usr/local/share/gnuradio/grc/blocks/lora_decode.xml
-- Installing: /usr/local/share/gnuradio/grc/blocks/lora_mod.xml
-- Installing: /usr/local/share/gnuradio/grc/blocks/lora_encode.xml

@pierreduf
Copy link

pierreduf commented Jul 24, 2017

@Flamewires : I've made the ldconfig but made it again after your comment, unfortunately it doesn't change anything.

@matt-knight : this is the output of the command :

/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0
/usr/lib/python2.7/dist-packages/wx-3.0-gtk2

My LD_LIBRARY_PATH variable is empty.

I think I'm gonna follow your updated installation guide : I guess something concerning the paths is messed up. I installed nothing in /opt.

I'll keep you updated.

@pierreduf
Copy link

My bad ! After installing SWIG and making a clean install (following the new guide with the correct way to set path environment variables) everything is OK.

I think that missing SWIG was the problem, thanks @pgorczak for the hint !

No more errors now, the flowgraph is compiling and running ! I can't decode LoRa signals yet but that's another story.

Thank you again all for your support.

@pgorczak
Copy link
Author

pgorczak commented Jul 24, 2017

Good news - I could get it to work on Ubuntu and Debian 😄

It was definitely SWIG (apt-get install swig) which was missing but required for the Python build to work. Here is the new install output:

These are the lines that were previously missing from the install output

-- Installing: /usr/local/lib/python2.7/dist-packages/lora/_lora_swig.so
-- Set runtime path of "/usr/local/lib/python2.7/dist-packages/lora/_lora_swig.so" to ""
-- Installing: /usr/local/lib/python2.7/dist-packages/lora/lora_swig.py
-- Installing: /usr/local/lib/python2.7/dist-packages/lora/lora_swig.pyc
-- Installing: /usr/local/lib/python2.7/dist-packages/lora/lora_swig.pyo
-- Installing: /usr/local/include/lora/lora/swig/lora_swig.i
-- Installing: /usr/local/include/lora/lora/swig/lora_swig_doc.i

@matt-knight
Copy link
Contributor

Thanks @pgorczak and @pierreduf for working through this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants