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

ImportError: No module named _dsss_swig #2

Open
caluml opened this issue Mar 1, 2021 · 3 comments
Open

ImportError: No module named _dsss_swig #2

caluml opened this issue Mar 1, 2021 · 3 comments

Comments

@caluml
Copy link

caluml commented Mar 1, 2021

Are the build instructions correct?

I appreciate this isn't a support channel, but I've followed the build instructions, and when I run parameterized_DSSS_encode_decode.grc, I end up with:
ImportError: No module named _dsss_swig

Here is the full output of my build.

[user@gnuradio ~]$ git clone https://github.com/kantooon/gr-dsss
Cloning into 'gr-dsss'...
remote: Enumerating objects: 146, done.
remote: Total 146 (delta 0), reused 0 (delta 0), pack-reused 146
Receiving objects: 100% (146/146), 235.72 KiB | 1.59 MiB/s, done.
Resolving deltas: 100% (67/67), done.
[user@gnuradio ~]$ cd gr-dsss/
[user@gnuradio gr-dsss]$ mkdir build
[user@gnuradio gr-dsss]$ cd build/
[user@gnuradio build]$ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ..
-- The CXX compiler identification is GNU 9.3.1
-- The C compiler identification is GNU 9.3.1
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Build type not specified: defaulting to release.
-- Found Boost: /usr/include (found suitable version "1.69.0", minimum required is "1.35") found components: filesystem system
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
The package name passed to find_package_handle_standard_args (PkgConfig)
does not match the name of the calling package (CppUnit). This can lead to
problems in calling code that expects find_package result variables
(e.g., _FOUND) to follow a certain pattern.
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPkgConfig.cmake:45 (find_package_handle_standard_args)
cmake/Modules/FindCppUnit.cmake:12 (INCLUDE)
CMakeLists.txt:86 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Found PkgConfig: /usr/bin/pkg-config (found version "1.6.1")
-- Checking for module 'cppunit'
-- Found cppunit, version 1.14.0
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
The package name passed to find_package_handle_standard_args (CPPUNIT)
does not match the name of the calling package (CppUnit). This can lead to
problems in calling code that expects find_package result variables
(e.g., _FOUND) to follow a certain pattern.
Call Stack (most recent call first):
cmake/Modules/FindCppUnit.cmake:35 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:86 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Found CPPUNIT: /usr/lib64/libcppunit.so;dl
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
The package name passed to find_package_handle_standard_args (PkgConfig)
does not match the name of the calling package (Gnuradio). This can lead
to problems in calling code that expects find_package result variables
(e.g., _FOUND) to follow a certain pattern.
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPkgConfig.cmake:45 (find_package_handle_standard_args)
/usr/lib64/cmake/gnuradio/GnuradioConfig.cmake:20 (INCLUDE)
CMakeLists.txt:93 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

Checking for GNU Radio Module: RUNTIME
-- Checking for module 'gnuradio-runtime'
-- Found gnuradio-runtime, version 3.7.13.5

  • INCLUDES=/usr/include
  • LIBS=/lib64/libgnuradio-runtime.so;/lib64/libgnuradio-pmt.so
    CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
    The package name passed to find_package_handle_standard_args
    (GNURADIO_RUNTIME) does not match the name of the calling package
    (Gnuradio). This can lead to problems in calling code that expects
    find_package result variables (e.g., _FOUND) to follow a certain
    pattern.
    Call Stack (most recent call first):
    /usr/lib64/cmake/gnuradio/GnuradioConfig.cmake:108 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
    /usr/lib64/cmake/gnuradio/GnuradioConfig.cmake:121 (GR_MODULE)
    CMakeLists.txt:93 (find_package)
    This warning is for project developers. Use -Wno-dev to suppress it.

-- Found GNURADIO_RUNTIME: /lib64/libgnuradio-runtime.so;/lib64/libgnuradio-pmt.so
GNURADIO_RUNTIME_FOUND = TRUE
CMake Warning (dev) at /usr/lib64/cmake/gnuradio/GrTest.cmake:45 (get_target_property):
Policy CMP0026 is not set: Disallow use of the LOCATION target property.
Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.

The LOCATION property should not be read from target "test-dsss". Use the
target name directly with add_custom_command, or use the generator
expression $<TARGET_FILE>, as appropriate.

Call Stack (most recent call first):
lib/CMakeLists.txt:81 (GR_ADD_TEST)
This warning is for project developers. Use -Wno-dev to suppress it.

--
-- Checking for module SWIG
-- Found SWIG version 3.0.12.
-- Found SWIG: /usr/bin/swig
-- Found PythonLibs: /usr/lib64/libpython2.7.so (found suitable version "2.7.18", minimum required is "2")
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.18", minimum required is "2")
-- Performing Test HAVE_WNO_UNUSED_BUT_SET_VARIABLE
-- Performing Test HAVE_WNO_UNUSED_BUT_SET_VARIABLE - Success
CMake Warning (dev) at /usr/lib64/cmake/gnuradio/GrTest.cmake:45 (get_target_property):
Policy CMP0026 is not set: Disallow use of the LOCATION target property.
Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.

The LOCATION property should not be read from target "gnuradio-dsss". Use
the target name directly with add_custom_command, or use the generator
expression $<TARGET_FILE>, as appropriate.

Call Stack (most recent call first):
python/CMakeLists.txt:44 (GR_ADD_TEST)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/lib64/cmake/gnuradio/GrTest.cmake:45 (get_target_property):
Policy CMP0045 is not set: Error on non-existent target in
get_target_property. Run "cmake --help-policy CMP0045" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

get_target_property() called with non-existent target "/usr/bin/python2".
Call Stack (most recent call first):
python/CMakeLists.txt:44 (GR_ADD_TEST)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/lib64/cmake/gnuradio/GrTest.cmake:45 (get_target_property):
Policy CMP0045 is not set: Error on non-existent target in
get_target_property. Run "cmake --help-policy CMP0045" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

get_target_property() called with non-existent target
"/home/user/gr-dsss/python/qa_dsss_encoder_bb.py".
Call Stack (most recent call first):
python/CMakeLists.txt:44 (GR_ADD_TEST)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/lib64/cmake/gnuradio/GrTest.cmake:45 (get_target_property):
Policy CMP0026 is not set: Disallow use of the LOCATION target property.
Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.

The LOCATION property should not be read from target "gnuradio-dsss". Use
the target name directly with add_custom_command, or use the generator
expression $<TARGET_FILE>, as appropriate.

Call Stack (most recent call first):
python/CMakeLists.txt:45 (GR_ADD_TEST)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/lib64/cmake/gnuradio/GrTest.cmake:45 (get_target_property):
Policy CMP0045 is not set: Error on non-existent target in
get_target_property. Run "cmake --help-policy CMP0045" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

get_target_property() called with non-existent target "/usr/bin/python2".
Call Stack (most recent call first):
python/CMakeLists.txt:45 (GR_ADD_TEST)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/lib64/cmake/gnuradio/GrTest.cmake:45 (get_target_property):
Policy CMP0045 is not set: Error on non-existent target in
get_target_property. Run "cmake --help-policy CMP0045" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.

get_target_property() called with non-existent target
"/home/user/gr-dsss/python/qa_dsss_decoder_cc.py".
Call Stack (most recent call first):
python/CMakeLists.txt:45 (GR_ADD_TEST)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Found Doxygen: /usr/bin/doxygen (found version "1.8.15") found components: doxygen dot
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/gr-dsss/build
[user@gnuradio build]$ make
Scanning dependencies of target gnuradio-dsss
[ 5%] Building CXX object lib/CMakeFiles/gnuradio-dsss.dir/dsss_encoder_bb_impl.cc.o
[ 10%] Building CXX object lib/CMakeFiles/gnuradio-dsss.dir/dsss_decoder_cc_impl.cc.o
[ 15%] Linking CXX shared library libgnuradio-dsss.so
[ 15%] Built target gnuradio-dsss
Scanning dependencies of target test-dsss
[ 20%] Building CXX object lib/CMakeFiles/test-dsss.dir/test_dsss.cc.o
[ 25%] Building CXX object lib/CMakeFiles/test-dsss.dir/qa_dsss.cc.o
[ 30%] Linking CXX executable test-dsss
[ 30%] Built target test-dsss
Scanning dependencies of target dsss_swig_swig_doc
[ 30%] Built target dsss_swig_swig_doc
Scanning dependencies of target _dsss_swig_swig_tag
[ 35%] Building CXX object swig/CMakeFiles/_dsss_swig_swig_tag.dir/_dsss_swig_swig_tag.cpp.o
[ 40%] Linking CXX executable _dsss_swig_swig_tag
[ 40%] Built target _dsss_swig_swig_tag
[ 45%] Generating dsss_swig.tag
Scanning dependencies of target dsss_swig_swig_2d0df
[ 50%] Building CXX object swig/CMakeFiles/dsss_swig_swig_2d0df.dir/dsss_swig_swig_2d0df.cpp.o
[ 55%] Linking CXX executable dsss_swig_swig_2d0df
Swig source
[ 55%] Built target dsss_swig_swig_2d0df
Scanning dependencies of target _dsss_swig
[ 60%] Building CXX object swig/CMakeFiles/_dsss_swig.dir/dsss_swigPYTHON_wrap.cxx.o
[ 65%] Linking CXX shared module _dsss_swig.so
[ 75%] Built target _dsss_swig
Scanning dependencies of target pygen_swig_f588f
[ 80%] Generating dsss_swig.pyc
[ 85%] Generating dsss_swig.pyo
[ 90%] Built target pygen_swig_f588f
Scanning dependencies of target pygen_python_8b794
[ 95%] Generating init.pyc
[100%] Generating init.pyo
[100%] Built target pygen_python_8b794
Scanning dependencies of target pygen_apps_9a6dd
[100%] Built target pygen_apps_9a6dd
[user@gnuradio build]$ sudo make install
[ 15%] Built target gnuradio-dsss
[ 30%] Built target test-dsss
[ 30%] Built target dsss_swig_swig_doc
[ 40%] Built target _dsss_swig_swig_tag
[ 55%] Built target dsss_swig_swig_2d0df
[ 75%] Built target _dsss_swig
[ 90%] Built target pygen_swig_f588f
[100%] Built target pygen_python_8b794
[100%] Built target pygen_apps_9a6dd
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/cmake/dsss/dsssConfig.cmake
-- Installing: /usr/local/include/dsss/api.h
-- Installing: /usr/local/include/dsss/dsss_encoder_bb.h
-- Installing: /usr/local/include/dsss/dsss_decoder_cc.h
-- Installing: /usr/local/lib64/libgnuradio-dsss.so
-- Installing: /usr/local/lib64/python2.7/site-packages/dsss/_dsss_swig.so
-- Set runtime path of "/usr/local/lib64/python2.7/site-packages/dsss/_dsss_swig.so" to ""
-- Installing: /usr/local/lib64/python2.7/site-packages/dsss/dsss_swig.py
-- Installing: /usr/local/lib64/python2.7/site-packages/dsss/dsss_swig.pyc
-- Installing: /usr/local/lib64/python2.7/site-packages/dsss/dsss_swig.pyo
-- Installing: /usr/local/include/dsss/dsss/swig/dsss_swig.i
-- Installing: /usr/local/include/dsss/dsss/swig/dsss_swig_doc.i
-- Installing: /usr/local/lib64/python2.7/site-packages/dsss/init.py
-- Installing: /usr/local/lib64/python2.7/site-packages/dsss/init.pyc
-- Installing: /usr/local/lib64/python2.7/site-packages/dsss/init.pyo
-- Installing: /usr/local/share/gnuradio/grc/blocks/dsss_dsss_encoder_bb.xml
-- Installing: /usr/local/share/gnuradio/grc/blocks/dsss_dsss_decoder_cc.xml
[user@gnuradio build]$

Then I load the example:
[user@gnuradio build]$ gnuradio-companion ../examples/parameterized_DSSS_encode_decode.grc
<<< Welcome to GNU Radio Companion 3.7.13.5 >>>

Block paths:
/usr/share/gnuradio/grc/blocks
/usr/local/share/gnuradio/grc/blocks

Loading: "/home/user/gr-dsss/examples/parameterized_DSSS_encode_decode.grc"

Done

Finally, When I Run, Generate, and then Run, Execute, I get:

Executing: /usr/bin/python2 -u /home/user/gr-dsss/examples/top_block.py

Traceback (most recent call last):
File "/home/user/gr-dsss/examples/top_block.py", line 32, in
import dsss
File "/usr/lib/python2.7/site-packages/dsss/init.py", line 45, in
from dsss_swig import *
File "/usr/lib/python2.7/site-packages/dsss/dsss_swig.py", line 17, in
_dsss_swig = swig_import_helper()
File "/usr/lib/python2.7/site-packages/dsss/dsss_swig.py", line 16, in swig_import_helper
return importlib.import_module('_dsss_swig')
File "/usr/lib64/python2.7/importlib/init.py", line 37, in import_module
import(name)
ImportError: No module named _dsss_swig

Done (return code 1)

@kantooon
Copy link
Owner

kantooon commented Mar 2, 2021

You have a Python import path problem. The example flowgraph is looking to load the block from /usr/lib while the install output clearly shows it has been installed in /usr/local/lib64.
Or you could have two existing and conflicting installs one in each path, with the more recent and correct one being in /usr/local/lib64. Try removing the install from /usr/lib or adjust your PYTHONPATH to looks at /usr/local first.

@mikeazo
Copy link

mikeazo commented Jan 18, 2022

I'm getting the same issue here when I try to run your example. I used docker-gnuradio to build GnuRadio 3.7, then cloned your repo and built it. When I run the example, I get the same error.

Similarly, running python2.7 from the command-line then typing import dsss gets the same error.

[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dsss
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/dsss/__init__.py", line 45, in <module>
    from dsss_swig import *
  File "/usr/local/lib/python2.7/dist-packages/dsss/dsss_swig.py", line 17, in <module>
    _dsss_swig = swig_import_helper()
  File "/usr/local/lib/python2.7/dist-packages/dsss/dsss_swig.py", line 16, in swig_import_helper
    return importlib.import_module('_dsss_swig')
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named _dsss_swig
>>> 

Just for your awareness

$ ls /usr/local/lib/python2.7/dist-packages/dsss/
__init__.py  __init__.pyc  __init__.pyo  _dsss_swig.so  dsss_swig.py  dsss_swig.pyc  dsss_swig.pyo
$ echo $PYTHONPATH
:/usr/local/lib/python2.7/dist-packages:/usr/local/lib/python3/dist-packages

@mikeazo
Copy link

mikeazo commented Jan 18, 2022

I was able to get it to work correctly by setting my LD_LIBRARY_PATH correctly.

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

3 participants