discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] ImportError: cannot import name usrp


From: CEL
Subject: Re: [Discuss-gnuradio] ImportError: cannot import name usrp
Date: Tue, 15 Oct 2019 10:19:56 +0000

To expand on that: Libusrp isn't compatible to any modern USRP, and if
you've got code from that era: Reimplement it in modern GNU Radio,
mostly. You can't hope to copy much of that, because the last version
of GNU Radio to contain libusrp was I think 3.4.2, and that's been
obsolete since the release of GNU Radio 3.5.0, and that was 8 years
ago.

Laura, a lot of your problems seem to stem from the fact that you might
be having a hard time investigating Python errors yourself. Since you
seem to be in need of writing Python, the time-rational thing to do is
learning and practicing Python with a book or tutorial. Starting with
something as large and complex as a GNU Radio transceiver application
incorporating non-deterministic signals and even worse hardware is
really not a promising approach in terms of investing your learning
time wisely.

Best regards,
Marcus

On Tue, 2019-10-15 at 02:35 +0000, Kyeong Su Shin wrote:
> Hello Laura (and to whom it may concern),
> 
> I believe that what you have there are legacy codes which use libusrp, 
> instead of libuhd. libusrp has been replaced by libuhd a few years ago. 
> 
> As Nate suggested, please replace all blocks with on libusrp to libuhd. It 
> shouldn't be too hard. (see: 
> https://www.gnuradio.org/doc/sphinx-v3.7.9.2/uhd_blocks.html#gnuradio.uhd.usrp_sink
>  , 
> https://www.gnuradio.org/doc/sphinx-v3.7.9.2/uhd_blocks.html#gnuradio.uhd.usrp_source
>  )
> 
> For the interpolation rate, I think you can replace that with set_samp_rate 
> (not too sure, though) as I am not particularly familiar with libusrp). 
> 
> Regards,
> Kyeong Su Shin
> 보낸 사람: Laura Arjona <address@hidden> 대신 Discuss-gnuradio 
> <discuss-gnuradio-bounces+ksshin=address@hidden>
> 보낸 날짜: 2019년 10월 15일 화요일 오전 4:58
> 받는 사람: Nate Temple <address@hidden>
> 참조: GNURadio Discussion List <address@hidden>
> 제목: Re: [Discuss-gnuradio] ImportError: cannot import name usrp
>  
> of course, thank you.
> 
> This is the code (old) I am trying to adapt to use it.
> 
>        tx = usrp.sink_c(fusb_block_size = 1024, fusb_nblocks=8)
>         tx.set_interp_rate(interp_rate)
>         tx_subdev = (0,0)
>         tx.set_mux(usrp.determine_tx_mux_value(tx, tx_subdev))
>         subdev = usrp.selected_subdev(tx, tx_subdev)
>         subdev.set_enable(True)
>         subdev.set_gain(subdev.gain_range()[2])
>         t = tx.tune(subdev.which(), subdev, freq)
> 
> On Fri, Oct 11, 2019 at 1:39 PM Nate Temple <address@hidden> wrote:
> > Can you post the code in question?
> > 
> > On Fri, Oct 11, 2019 at 1:32 PM Laura Arjona <address@hidden> wrote:
> > > Thank you Nate.
> > > 
> > > Yes, that is the configuration I had before. But I using someone else's 
> > > code for a different USRP, and getting errors with the usrp_sink_c to set 
> > > the fusb block size
> > > 
> > > On Fri, Oct 11, 2019 at 1:28 PM Nate Temple <address@hidden> wrote:
> > > > You should pass in the cpu_format as an arg such as below:
> > > > 
> > > > sink = uhd.usrp_sink(
> > > >         ",".join(("", "")),
> > > >         uhd.stream_args(
> > > >         cpu_format="fc32",
> > > >         channels=range(1),
> > > >         ),
> > > >         )
> > > > 
> > > > On Fri, Oct 11, 2019 at 1:16 PM Laura Arjona <address@hidden> wrote:
> > > > > Got it, thank you!
> > > > > 
> > > > > However, usrp_sink_c is not supported anymore? Get an error there too.
> > > > > 
> > > > > tx = usrp_sink_c(fusb_block_size = 1024, fusb_nblocks=8)
> > > > > 
> > > > > On Fri, Oct 11, 2019 at 1:11 PM Nate Temple <address@hidden> wrote:
> > > > > > Hi Laura,
> > > > > > 
> > > > > > It should be:
> > > > > > 
> > > > > > from gnuradio import uhd
> > > > > > 
> > > > > > source = uhd.usrp_source(...)
> > > > > > ...
> > > > > > 
> > > > > > I would suggest to try building out a basic flowgraph in GRC and 
> > > > > > then use the generate button and checkout the source made from it.
> > > > > > 
> > > > > > 
> > > > > > Regards,
> > > > > > Nate Temple
> > > > > > 
> > > > > > 
> > > > > > On Fri, Oct 11, 2019 at 1:06 PM Laura Arjona <address@hidden> wrote:
> > > > > > > Hello,
> > > > > > > 
> > > > > > > I am using a usrp b200-mini, and I am trying to define the sink 
> > > > > > > as follows:
> > > > > > > tx = usrp_sink_c(fusb_block_size = 1024, fusb_nblocks=8)
> > > > > > > 
> > > > > > > However, I get the error
> > > > > > >  from gnuradio import usrp
> > > > > > > ImportError: cannot import name usrp
> > > > > > > 
> > > > > > > I believe my GNU-radio installation is correct.
> > > > > > > Any clue of how to fix this?
> > > > > > > 
> > > > > > > Thank you.
> > > > > > > 
> > > > > > > -- 
> > > > > > > Laura Arjona 
> > > > > > > _______________________________________________
> > > > > > > Discuss-gnuradio mailing list
> > > > > > > address@hidden
> > > > > > > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> > > > > 
> > > > > 
> > > > > -- 
> > > > > Laura Arjona 
> > > > > Washington Research Foundation Innovation Postdoctoral Fellow in 
> > > > > Neuroengineering
> > > > > 
> > > > > Paul G. Allen School of Computer Science & Engineering
> > > > > 185 E Stevens Way NE
> > > > > University of Washington
> > > > > Seattle, WA 98195-2350
> > > 
> > > 
> > > -- 
> > > Laura Arjona 
> > > Washington Research Foundation Innovation Postdoctoral Fellow in 
> > > Neuroengineering
> > > 
> > > Paul G. Allen School of Computer Science & Engineering
> > > 185 E Stevens Way NE
> > > University of Washington
> > > Seattle, WA 98195-2350
> 
> 
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]