Check the PYTHONPATH to make sure it holds the correct install directory for UHD Python. I'm guessing it does not. I'm pretty sure UHD by default installs its Python library and files into "/usr/local/lib/python3/site-packages" ... or "dist-packages" ... note the "/python3/" rather than some specific 3.X version as was the case for earlier UHD (and many other projects). - MLD
On Mon, Nov 9, 2020 at 1:36 AM Brendan Horsfield via USRP-users < usrp-users@lists.ettus.com> wrote: > Hi Folks, > > I would like to write my own Python 3 script to stream Rx samples off my > Ettus B210 USRP. I have installed the Python API on my Ubuntu laptop, but > I can't seem to get it to work, despite trying numerous ideas I found on > the Ettus Knowledge Base. > > For example, check out the following Python interpreter log. I can call > "import uhd" OK, but the call to uhd.usrp.MultiUSRP() causes an error: > > Python 3.7.7 (default, Mar 26 2020, 15:48:22) > [GCC 7.3.0] :: Anaconda, Inc. on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> import uhd > >>> my_usrp = uhd.usrp.MultiUSRP("type=b200") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > AttributeError: module 'uhd' has no attribute 'usrp' > >>> > > Another example: If I try to run the example script > "uhd/host/examples/python/rx_to_file.py", I get the following error: > "ModuleNotFoundError: No module named 'uhd'" > > The API installation procedure I have followed to this point is as follows: > 1. python3 -m pip install python-dev-tools --user --upgrade > 2. git clone https://github.com/EttusResearch/uhd.git > 3. pybombs install uhd > 4. cmake $HOME/uhd/host > > ###################################################### > -- # UHD enabled components > -- ###################################################### > -- * LibUHD > -- * LibUHD - C API > -- * LibUHD - Python API > -- * Examples > -- * Utils > -- * Tests > -- * USB > -- * B100 > -- * B200 > -- * USRP1 > -- * USRP2 > -- * X300 > -- * MPMD > -- * N300 > -- * N320 > -- * E320 > -- * E300 > -- * OctoClock > -- * Manual > -- * API/Doxygen > -- * Man Pages > -- > -- ###################################################### > -- # UHD disabled components > -- ###################################################### > -- * DPDK > -- > -- ****************************************************** > -- * You are building the UHD development master branch. > -- * For production code, we recommend our stable, > -- * releases or using the release branch (maint). > -- ****************************************************** > -- Building version: 4.0.0.0-46-g57ca4235 > -- Using install prefix: /usr/local > -- Configuring done > -- Generating done > -- Build files have been written to: /home/anyone/uhd/host > > 5. Set up Ubuntu dependencies: sudo apt-get install libboost-all-dev > libusb-1.0-0-dev doxygen python3-docutils python3-mako python3-numpy > python3-requests python3-ruamel.yaml python3-setuptools cmake > build-essential > 6. Add the following line to .bashrc: export > LD_LIBRARY_PATH=/usr/local/lib > > FYI -- I am running Ubuntu 18.04 on an HP Omen laptop with an Intel > i7-8750H CPU and 32 GB of RAM. > > Can anyone tell me what the source of this problem could be? Any advice > or suggestions would be greatly appreciated! > > Thanks & Regards, > Brendan. > > > _______________________________________________ > USRP-users mailing list > USRP-users@lists.ettus.com > http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com >
_______________________________________________ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com