Tuesday, May 9, 2017

Re: [Discuss-gnuradio] ImportError: No module named _osmosdr_swig

On 05/09/2017 12:23 AM, Fernando wrote:
>
>
>
> On 09/05/17 07:02, Cinaed Simson wrote:
>> On 05/08/2017 03:44 PM, Fernando wrote:
>>> My GRC crashes when I place a osmocom source and osmocon sink.
>>>
>>> Doing some research I have found that is a python problem with _osmosdr_swig
>>>
>>> fernando@andromeda:~> python -c 'import osmosdr' Traceback (most recent
>>> call last): File "<string>", line 1, in <module> File
>>> "/usr/lib64/python2.7/site-packages/osmosdr/__init__.py", line 26, in
>>> <module> from osmosdr_swig import * File
>>> "/usr/lib64/python2.7/site-packages/osmosdr/osmosdr_swig.py", line 21,
>>> in <module> _osmosdr_swig = swig_import_helper() File
>>> "/usr/lib64/python2.7/site-packages/osmosdr/osmosdr_swig.py", line 20,
>>> in swig_import_helper return
>>> importlib.import_module('_osmosdr_swig') File
>>> "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
>>> __import__(name) ImportError: No module named _osmosdr_swig
>>> fernando@andromeda:~>
>>>
>>> I am using Opensuse 42.2, and it have been reported taht it works fine
>>> for other people with the same OS.
>>>
>>> there is a package called python-gr-osmosdr wich contains
>>> /usr/lib64/python2.7/site-packages/osmosdr/osmosdr_swig.py
>> Remove the directory
>>
>> /home/fernando/.grc_gnuradio
>>
>> Check to ensure there's a shared library
>>
>> _osmosdr_swig.so
>>
>> in the same directory.
>>
>> Check to ensure the installation of gnuradio was added to your python path
>>
>> python -c "import os; print(os.environ.get('PYTHONPATH', ''))"
>>
>> Check to ensure there's only one installation of gnuradio.
>>
>> -- Cinaed
>>
>
> _osmosdr_swig.so is here
>
> andromeda:/home/fernando # find / |grep _osmosdr_swig.so
> /usr/lib64/python2.7/site-packages/osmosdr/_osmosdr_swig.so
>
>
>
> fernando@andromeda:~> python -c "import os;
> print(os.environ.get('PYTHONPATH', ''))"
> it reports no error

Actually, not reporting a PYTHONPATH is an error.

In order for the gnuradio-companion to find osmosdr/_osmosdr_swig.so it
needs a PYTHONPATH defined - there's more than version of python
installed on most Linux systems.

Try it again but type

python2.7 -c "import os; print(os.environ.get('PYTHONPATH', ''))"

It's possible that python is linked to a different version of python2.7
on your system.

If it's empty again, make sure python2.7 is the version of python you're
using in your shell by typing

python --version

If the version is not python2.7 (or a minor version of 2.7) then add

alias python="/usr/bin/python2.7"

to your $HOME/.bashrc file.

And add then

export PYTHONPATH="/usr/lib64/python2.7/site-packages"

to your $HOME/.bashrc

Then finally, type

. $HOME/.bashrc

There's a "period" in front of $HOME/.bashrc - it may be hard to see -
it means source the file $HOME/.bashrc - which will set your PYTHONPATH
environment variable.

Then try to to startup up gnuradio-companion again.

-- Cinaed


>
>
> I have deleted /home/fernando/.grc_gnuradio
>
> and....
>
> fernando@andromeda:~> gnuradio-companion
> /usr/lib64/python2.7/site-packages/gnuradio/grc/gui/BlockTreeWindow.py:102:
> GtkWarning: Theme directory base/ of theme oxygen has no size field
>
> self.search_entry.set_icon_from_stock(gtk.ENTRY_ICON_PRIMARY,
> gtk.STOCK_FIND)
> <<< Welcome to GNU Radio Companion 3.7.11 >>>
>
> Block paths:
> /usr/share/gnuradio/grc/blocks
> Warning: restarting the docstring loader (crashed while loading
> 'osmosdr_sink')
> Warning: restarting the docstring loader (crashed while loading
> 'osmosdr_source')
> Warning: restarting the docstring loader (crashed while loading
> 'uhd_amsg_source')
> Warning: restarting the docstring loader (crashed while loading
> 'uhd_usrp_sink')
> Warning: restarting the docstring loader (crashed while loading
> 'uhd_usrp_source')
> Warning: docstring loader crashed too often
> Segmentation fault (core dumped)
> fernando@andromeda:~> ^C
> fernando@andromeda:~>
>
> and it crashes again
>
>
> I have tried as another user just in case it was something of my
> personal profile, but it also crashes.
>
> I have only one installation of gnuradio.
>
> Can i try something more?
>
>
> thanks
>
>
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> .
>


_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

No comments:

Post a Comment