Hi Glen - Yes, all of this can be fixed in the "cmake .." step. That's what
we do in MacPorts to get all of the files installed in the correct
locations (using CMAKE_INSTALL_PREFIX=/opt/local by default; but also using
other cmake variables to set other install locations to be not the default
too, since MacPorts has expectations for where certain files types are
installed). This issue has nothing directly to do with the link provided
about site-packages and dist-packages. It's all about putting PYTHON files
where the version of Python used by GNU Radio will find the GR OOT scripts.
We provide the cmake variable `GR_PYTHON_DIR` for the top-level directory
to install PYTHON files. Generally, GR-proper PYTHON files will be
installed into "`GR_PYTHON_DIR`/gnuradio" ... most GR OOTs install into
"`GR_PYTHON_DIR`/OOT" though I believe gr-osmosdr installs into
"`GR_PYTHON_DIR`/gnuradio/osmosdr" by default (which, to be honest, I
prefer). If you install a GR OOT elsewhere, you can use the PYTHONPATH
environment variable to tell Python where to look for those scripts; this
is what "make test" does, at least nominally, so that we can "test" without
having to "install" first. Hope this is useful! - MLD

On Fri, Nov 15, 2019 at 9:51 AM Glen I Langston <glen.i.langs...@gmail.com>
wrote:

> Thanks
> I’ll try that in the future.
> However I’m not sure why this is an issue in the first place.  It should
> be fixable at the cmake step.
>
> Looking at the link provided in an earlier email, it seems
> like part of the problem is the different uses of
> site-packages and
> dist-packages.
>
> Can that be fixed at the cmake step?
>
> Thanks again,
> Glen
>
> > On Nov 15, 2019, at 9:37 AM, Michael Dickens <michael.dick...@ettus.com>
> wrote:
> >
> > You need to set
> > {{{
> > PYTHONPATH=/usr/local/lib/python2.7/site-packages/:$PYTHONPATH
> > }}}
> > to get access to gr-iio.
> >
> >
> > On Fri, Nov 15, 2019 at 8:17 AM Kevin Wheatley <kevin.m0...@gmail.com>
> wrote:
> > New here and new to gnuRadio...
> >
> > I'm attempting to get plutoSDR up and running on a Mac, I've installed
> gunradio and dependencies, I've also downloaded and built libiio,
> ibad9361-iio and gr-iio. Following this I've moved the block files across
> to the working directory. Running gnuradio-companion
> > I can see the plutoSDR source & sink blocks, but when using them I get
> the following error:
> >
> > Traceback (most recent call last):
> >   File "/Users/m0khz/Desktop/top_block.py", line 22, in <module>
> >     from gnuradio import iio
> > ImportError: cannot import name iio
> >
> > any help in where I'm going wrong much appreciated ....
> >
> > Cheers Kevin
> >
> > Full build details below:
> > Install GNU Radio
> >
> > Kevins-MacBook-Pro:~ m0khz$ sudo port install gnuradio
> > --->  Computing dependencies for gnuradio
> > --->  Cleaning gnuradio
> > --->  Scanning binaries for linking errors
> > --->  No broken files found.
> > --->  No broken ports found.
> > Kevins-MacBook-Pro:~ m0khz$
> > Kevins-MacBook-Pro:~ m0khz$ gnuradio-config-info --version
> > 3.7.13.5
> >
> > Download and build libiio
> >
> > Kevins-MacBook-Pro:~ m0khz$ cd libiio
> > Kevins-MacBook-Pro:libiio m0khz$ cmake .
> > -- Looking for libusb-1.0 : Found
> > -- Check for case-sensitive file systems
> > -- File system is not case-sensitive
> > -- Configuring done
> > -- Generating done
> > -- Build files have been written to: /Users/m0khz/libiio
> > Kevins-MacBook-Pro:libiio m0khz$ make
> > [ 48%] Built target iio
> > [ 55%] Built target iio_genxml
> > [ 62%] Built target iio_adi_xflow_check
> > [ 68%] Built target iio_reg
> > [ 75%] Built target iio_readdev
> > [ 82%] Built target iio_writedev
> > [ 89%] Built target iio_attr
> > [ 96%] Built target iio_info
> > [100%] Built target libiio-pkg
> > [100%] Built target libiio-py
> > Kevins-MacBook-Pro:libiio m0khz$ sudo make install
> > [ 48%] Built target iio
> > [ 55%] Built target iio_genxml
> > [ 62%] Built target iio_adi_xflow_check
> > [ 68%] Built target iio_reg
> > [ 75%] Built target iio_readdev
> > [ 82%] Built target iio_writedev
> > [ 89%] Built target iio_attr
> > [ 96%] Built target iio_info
> > [100%] Built target libiio-pkg
> > [100%] Built target libiio-py
> > Install the project...
> > -- Install configuration: "RelWithDebInfo"
> > installer: Package name is Libiio
> > installer: Upgrading at base path /
> > installer: The upgrade was successful.
> > Kevins-MacBook-Pro:libiio m0khz$ cd ..
> > Kevins-MacBook-Pro:~ m0khz$
> >
> > Download and build libad9361-iio
> >
> > Kevins-MacBook-Pro:~ m0khz$ cd libad9361-iio
> > Kevins-MacBook-Pro:libad9361-iio m0khz$ cmake .
> > -- Configuring done
> > -- Generating done
> > -- Build files have been written to: /Users/m0khz/libad9361-iio
> > Kevins-MacBook-Pro:libad9361-iio m0khz$ make
> > [ 50%] Built target ad9361
> > [ 54%] Built target libad9361-pkg
> > [ 63%] Built target AutoRateTest
> > [ 72%] Built target FilterDesignerTest
> > [ 81%] Built target FMComms5SyncTest
> > [ 90%] Built target FilterDesignerHardwareTest
> > [100%] Built target GenerateRatesTest
> > Kevins-MacBook-Pro:libad9361-iio m0khz$ sudo make install
> > [ 50%] Built target ad9361
> > [ 54%] Built target libad9361-pkg
> > [ 63%] Built target AutoRateTest
> > [ 72%] Built target FilterDesignerTest
> > [ 81%] Built target FMComms5SyncTest
> > [ 90%] Built target FilterDesignerHardwareTest
> > [100%] Built target GenerateRatesTest
> > Install the project...
> > -- Install configuration: ""
> > -- Up-to-date: /usr/local/lib/pkgconfig/libad9361.pc
> > installer: Package name is Libad9361
> > installer: Upgrading at base path /
> > installer: The upgrade was successful.
> > -- Up-to-date: /usr/local/include/ad9361-wrapper.h
> > Kevins-MacBook-Pro:libad9361-iio m0khz$ cd ..
> > Kevins-MacBook-Pro:~ m0khz$
> >
> > Download and build gr-iio
> >
> > Kevins-MacBook-Pro:~ m0khz$ cd gr-iio
> > Kevins-MacBook-Pro:gr-iio m0khz$ cmake .
> > -- Build type not specified: defaulting to release.
> > Checking for GNU Radio Module: RUNTIME
> >  * INCLUDES=/opt/local/include
> >  *
> LIBS=/opt/local/lib/libgnuradio-runtime.dylib;/opt/local/lib/libgnuradio-pmt.dylib;/opt/local/lib/liblog4cpp.dylib
> > GNURADIO_RUNTIME_FOUND = TRUE
> > Checking for GNU Radio Module: ANALOG
> >  * INCLUDES=/opt/local/include
> >  *
> LIBS=/opt/local/lib/libgnuradio-analog.dylib;/opt/local/lib/libgnuradio-runtime.dylib;/opt/local/lib/libgnuradio-pmt.dylib;/opt/local/lib/liblog4cpp.dylib;/opt/local/lib/libvolk.dylib
> > GNURADIO_ANALOG_FOUND = TRUE
> > Checking for GNU Radio Module: BLOCKS
> >  * INCLUDES=/opt/local/include
> >  *
> LIBS=/opt/local/lib/libgnuradio-blocks.dylib;/opt/local/lib/libgnuradio-runtime.dylib;/opt/local/lib/libgnuradio-pmt.dylib;/opt/local/lib/liblog4cpp.dylib
> > GNURADIO_BLOCKS_FOUND = TRUE
> > Checking for GNU Radio Module: PMT
> >  * INCLUDES=/opt/local/include
> >  *
> LIBS=/opt/local/lib/libgnuradio-runtime.dylib;/opt/local/lib/libgnuradio-pmt.dylib;/opt/local/lib/liblog4cpp.dylib
> > GNURADIO_PMT_FOUND = TRUE
> > Checking for GNU Radio Module: VOLK
> >  * INCLUDES=/opt/local/include
> >  * LIBS=/opt/local/lib/libvolk.dylib
> > GNURADIO_VOLK_FOUND = TRUE
> > --
> > -- Checking for module SWIG
> > -- Found SWIG version 3.0.12.
> > -- Configuring done
> > CMake Warning (dev):
> >   Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run
> "cmake
> >   --help-policy CMP0042" for policy details.  Use the cmake_policy
> command to
> >   set the policy and suppress this warning.
> >
> >   MACOSX_RPATH is not specified for the following targets:
> >
> >    gnuradio-iio
> >
> > This warning is for project developers.  Use -Wno-dev to suppress it.
> >
> > -- Generating done
> > -- Build files have been written to: /Users/m0khz/gr-iio
> > Kevins-MacBook-Pro:gr-iio m0khz$ make
> > [ 35%] Built target gnuradio-iio
> > [ 38%] Built target _iio_swig_swig_tag
> > [ 44%] Built target iio_swig_swig_2d0df
> > [ 49%] Built target pygen_swig_727e2
> > [ 52%] Built target _iio_pluto_sink_swig_swig_tag
> > [ 57%] Built target iio_pluto_sink_swig_swig_2d0df
> > [ 62%] Built target pygen_swig_3c5ee
> > [ 69%] Built target _iio_pluto_sink_swig
> > [ 72%] Built target _iio_pluto_source_swig_swig_tag
> > [ 77%] Built target iio_pluto_source_swig_swig_2d0df
> > [ 84%] Built target _iio_pluto_source_swig
> > [ 89%] Built target pygen_swig_5fedc
> > [ 96%] Built target _iio_swig
> > [100%] Built target pygen_python_iio_22088
> > Kevins-MacBook-Pro:gr-iio m0khz$ sudo make install
> > [ 35%] Built target gnuradio-iio
> > [ 38%] Built target _iio_swig_swig_tag
> > [ 44%] Built target iio_swig_swig_2d0df
> > [ 49%] Built target pygen_swig_727e2
> > [ 52%] Built target _iio_pluto_sink_swig_swig_tag
> > [ 57%] Built target iio_pluto_sink_swig_swig_2d0df
> > [ 62%] Built target pygen_swig_3c5ee
> > [ 69%] Built target _iio_pluto_sink_swig
> > [ 72%] Built target _iio_pluto_source_swig_swig_tag
> > [ 77%] Built target iio_pluto_source_swig_swig_2d0df
> > [ 84%] Built target _iio_pluto_source_swig
> > [ 89%] Built target pygen_swig_5fedc
> > [ 96%] Built target _iio_swig
> > [100%] Built target pygen_python_iio_22088
> > Install the project...
> > -- Install configuration: "Release"
> > -- Up-to-date: /usr/local/lib/pkgconfig/gnuradio-iio.pc
> > -- Up-to-date: /usr/local/lib/cmake/iio/iioConfig.cmake
> > -- Up-to-date: /usr/local/include/gnuradio/iio/api.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/device_source.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/device_sink.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/fmcomms2_source.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/fmcomms2_sink.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/fmcomms5_source.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/fmcomms5_sink.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/pluto_source.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/pluto_sink.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/converter_ss.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/math.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/power_ff.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/attr_sink.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/attr_source.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/modulo_ff.h
> > -- Up-to-date: /usr/local/include/gnuradio/iio/modulo_const_ff.h
> > -- Installing: /usr/local/lib/libgnuradio-iio.0.3.dylib
> > -- Up-to-date: /usr/local/lib/libgnuradio-iio.0.dylib
> > -- Up-to-date: /usr/local/lib/libgnuradio-iio.dylib
> > -- Installing:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/_iio_swig.so
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/iio_swig.py
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/iio_swig.pyc
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/iio_swig.pyo
> > -- Installing:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/_iio_pluto_source_swig.so
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/iio_pluto_source_swig.py
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/iio_pluto_source_swig.pyc
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/iio_pluto_source_swig.pyo
> > -- Installing:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/_iio_pluto_sink_swig.so
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/iio_pluto_sink_swig.py
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/iio_pluto_sink_swig.pyc
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/iio_pluto_sink_swig.pyo
> > -- Up-to-date: /usr/local/include/swig/iio_swig.i
> > -- Up-to-date: /usr/local/include/swig/iio_pluto_source_swig.i
> > -- Up-to-date: /usr/local/include/swig/iio_pluto_sink_swig.i
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/__init__.py
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/attr_updater.py
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/__init__.pyc
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/attr_updater.pyc
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/__init__.pyo
> > -- Up-to-date:
> /usr/local/lib/python2.7/site-packages/gnuradio/iio/attr_updater.pyo
> > -- Up-to-date: /usr/local/share/gnuradio/grc/blocks/iio_device_source.xml
> > -- Up-to-date: /usr/local/share/gnuradio/grc/blocks/iio_device_sink.xml
> > -- Up-to-date:
> /usr/local/share/gnuradio/grc/blocks/iio_fmcomms2_source.xml
> > -- Up-to-date: /usr/local/share/gnuradio/grc/blocks/iio_fmcomms2_sink.xml
> > -- Up-to-date:
> /usr/local/share/gnuradio/grc/blocks/iio_fmcomms5_source.xml
> > -- Up-to-date: /usr/local/share/gnuradio/grc/blocks/iio_fmcomms5_sink.xml
> > -- Up-to-date: /usr/local/share/gnuradio/grc/blocks/iio_pluto_source.xml
> > -- Up-to-date: /usr/local/share/gnuradio/grc/blocks/iio_pluto_sink.xml
> > -- Up-to-date: /usr/local/share/gnuradio/grc/blocks/iio_math.xml
> > -- Up-to-date: /usr/local/share/gnuradio/grc/blocks/iio_math_gen.xml
> > -- Up-to-date: /usr/local/share/gnuradio/grc/blocks/iio_power_ff.xml
> > -- Up-to-date: /usr/local/share/gnuradio/grc/blocks/iio_modulo_ff.xml
> > -- Up-to-date:
> /usr/local/share/gnuradio/grc/blocks/iio_modulo_const_ff.xml
> > -- Up-to-date: /usr/local/share/gnuradio/grc/blocks/iio_attr_sink.xml
> > -- Up-to-date: /usr/local/share/gnuradio/grc/blocks/iio_attr_source.xml
> > -- Up-to-date: /usr/local/share/gnuradio/grc/blocks/iio_attr_updater.xml
> > Kevins-MacBook-Pro:gr-iio m0khz$ cd ..
> > Kevins-MacBook-Pro:~ m0khz$
> >
> > move the blocks between the necessary folders:
> >
> > cp -r /usr/local/lib/python2.7/dist-packages/gnuradio/iio
> /usr/lib/python2.7/dist-packages/gnuradio/
> >
> > This is where gnuRadio Companion is looking
> > /opt/local/share/gnuradio/grc/blocks
> >
> > This is where the block were installed
> > /usr/local/share/gnuradio/grc/blocks/
> >
> > So copied them across
> >
> > Run gnuRadio-companion, IIO blocks are present, plutoSDR source and sink
> etc. are present, but get this error when tying to run the flow graph:
> >
> > <<< Welcome to GNU Radio Companion 3.7.13.5 >>>
> >
> > Block paths:
> > /opt/local/share/gnuradio/grc/blocks
> >
> > Loading: "/Users/m0khz/Desktop/pluto_initial_test.grc"
> > >>> Done
> >
> > Generating: '/Users/m0khz/Desktop/top_block.py'
> >
> > Generating: '/Users/m0khz/Desktop/top_block.py'
> >
> > Executing:
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
> -u /Users/m0khz/Desktop/top_block.py
> >
> > Traceback (most recent call last):
> >   File "/Users/m0khz/Desktop/top_block.py", line 22, in <module>
> >     from gnuradio import iio
> > ImportError: cannot import name iio
> >
> > >>> Done (return code 1)
> >
> >
> > --
> > Michael Dickens
> > Ettus Research Technical Support
> > Email: supp...@ettus.com
> > Web: https://ettus.com/
>
>

-- 
Michael Dickens
Ettus Research Technical Support
Email: supp...@ettus.com
Web: https://ettus.com/

Reply via email to