Custom Block Unable to Be Found - gnuradio

I have an Ubuntu LTS20.04 vm with with GNU Radio installed via PPA. Following the Guided Tutorial GNU Radio in C++, I've created, built, and installed a project identical to the sample presented within.
I went to set up the objective flow graph presented at the beginning of the tutorial in GNURadio companion, but when I attempt to execute the it, I get the following error:
Warning: failed to XInitThreads()
Traceback (most recent call last):
File "/home/user/Documents/GNURadio Flowgraphs/testqpsk.py", line 38, in <module>
import tutorial
ModuleNotFoundError: No module named 'tutorial'
What steps do I need to take to resolve this? I should note that the PPA install does not seem to configure paths correctly, as I had to EXPORT GR_PREFIX=/usr to get gr_modtool to function.

The problem was that cmake's default install prefix (/usr/local) does not correspond with default Python search paths. My resolution was the following:
export PYTHONPATH=/usr/local/lib/python3/dist-packages:/usr/lib/python3/dist-packages:$PYTHONPATH
Both this export statement and the GR_PREFIX export were added to my ~/.profile.

Related

Run Python, Anaconda, Pandas, Numpy offline on a Server getting dependency error

After installing Anaconda on a Virtual Machine I run a script which is working on my local machine but not on my Virtual Machine.
I'm getting the error Message:
C:\Users\...\python>"C:\ProgramData\Anaconda3\python.exe" "C:\Users\...\reporting.py"
C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "C:\Users\...\reporting.py", line 1, in <module>
import pandas as pd
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "C:\ProgramData\Anaconda3\python.exe"
* The NumPy version is: "1.18.5"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.
The VM has no Internet. Is there any way to install all the required libs and frameworks?
You can package your script and used libraries using something like Pyinstaller. When you use an virtualenv keep in mind that all the packages that you use during pyinstaller execution are stored and may lead to an huge .exe

Import does not function as bat file; but works in spyder

I am still not the most sophisticated python user; but I cannot overcome this probably simple problem. I have a code that works perfectly with the spyder interface. I would like to make it a recurring task via creating a bat file. The bat file which in turn triggers a cmd interface does not import pandas_data reader and the code gets stuck and aborts.
import pandas_datareader.data as web
this line above creates the error below. It's a lengthy text.
File "C:\Users\myself\anaconda3\lib\site-packages\pandas_datareader\__init__.py", line 2, in <module>
from .data import ( File "C:\Users\myself\anaconda3\lib\site-packages\pandas_datareader\data.py", line 9, in <module>
from pandas.util._decorators import deprecate_kwarg File "C:\Users\myself\anaconda3\lib\site-packages\pandas\__init__.py", line 17, in <module>
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies) ImportError: Unable to import required dependencies: numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "C:\Users\myself\anaconda3\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.17.0" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.

Anaconda install of Tensorflow missing 'audio_ops' from contrib framework

I'm trying to follow along the Audio Recognition Network tutorial.
I've created an Anaconda environment with python 3.6 and followed the install instruction accordingly for installing the GPU whl.
I can run the 'hello world' TF example.
When I go to run 'train.py' in the Audio Recognition Network tutorial/example, I get:
Traceback (most recent call last):
File "train.py", line 79, in <module>
import input_data
File "/home/philglau/speech_commands/input_data.py", line 35, in <module>
from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
ImportError: cannot import name 'audio_ops'
The code in the tutorial that fails is:
from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
I then backed up that chain until I could import some part of it:
import tensorflow.contrib.framework as test ==> works
import tensorflow.contrib.framework.python as test --> fail:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow.contrib.framework' has no attribute 'python'
Not sure where I'm going wrong on my install.
Details:
Ubuntu 16.04
Anaconda env with python 3.6
Followed the 'anaconda' instruction on the TF install page. (GPU version)
I also tried using a python 2.7 env for anaconda but got the same results.
It looks like they're releasing the audio_ops modules in version 1.4 (https://github.com/tensorflow/tensorflow/issues/11339#issuecomment-327879009).
Until v1.4 is released, an easy way around this is to install the nightly tensorflow build
pip install tf-nightly
or with the docker image linked in the issue comment.
The short answer:
The framework is missing the "audio_ops.py" and the example wont work until the file is released. Or you code the wrappers.
More on this:
If you go to the: tensorflow.contrib.framework.python.ops local folder you can find other *_ops.py files but not the "audio_ops.py".
If you get it from the Master at: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/framework/python/ops
You will find the file is almost empty and with import labels wrong: "audio_ops" vs "gen_audio_ops".
With almost empty I mean that: decode_wav, encode_wav, audio_spectrogram , mfcc are not implemented/wrapped.
So, no working example and no fun.
We need to check again when "audio_ops.py" is released.
Here:
https://github.com/tensorflow/tensorflow/issues/11339
You can find a Developer saying: "we don't actually want to make them public / supported yet. I'm sorry this decision wasn't better documented"

Why do I get an ImportError when I import TensorFlow?

I'm trying to install tensorflow and now I'm stuck with the following warning:
ranj#ranj-Aspire-V3-772G:~$ python3 -c 'import tensorflow as tf; print(tf.__version__)' # for Python 3Traceback (most recent call last):
...
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libnvidia-fatbinaryloader.so.375.39: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
...
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libnvidia-fatbinaryloader.so.375.39: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Can someone tell me how I can solve it?
I'm not sure what exactly caused the error you report, but it seems like an issue with CUDA and/or communication with the NVIDIA card in general. Also, I don't know why the installation of the graphics driver failed as you mention in the comments, but if you want to have GPU support, having a working graphics driver is essential obviously. So either the driver you have currently installed works fine already or then you will have to find out why installing a new version of the driver fails.
You could proceed like this:
Make sure your graphics card fulfills the requirements (CUDA compute capability >= 3.0, check the compute capability of your card here).
Make sure your installation of cuDNN and CUDA Toolkit works fine. For this, you could follow the instructions here (point 6.2.2).
If this works fine, it might just be that Tensorflow cannot find the required CUDA libraries. Check this related Stackoverflow post: GPU tensorflow install issue
As a side note: the tutorial you linked in the comments seems to suggest that you have to build Tensorflow from source using bazel, which is in fact not always necessary. I would recommend you take a look at the official installation instructions - those are pretty comprehensive and consider all the details you require for the installation. So if all fails, consider starting from scratch and follow the official tutorial linked above.
I finally fixed it in gnome (ctrl+alt+f3) and logged in with my account and then used:
"sudo init 3"
"sudo -i"
Went to downloads dir and installed the nvidia driver: "sh NVIDIAxxx.run"
"reboot"
In the gnome I can use python3 and import tensorflow
The problem is now that I cannot login to the os in the normal manner. I still can log into the gmome

ImportError: No module named inception

Im using imagenet train script (https://github.com/tensorflow/models/blob/master/inception/inception/imagenet_train.py) to train my own image data set to classify in tensorflow (in Oracle VM Virtual box) and im getting an error as below
shri#shri-VirtualBox:~/Desktop/Test/inception_test/models/inception/inception$ python imagenet_train.py
Traceback (most recent call last):
File "imagenet_train.py", line 25, in
from inception import inception_train
ImportError: No module named inception
Could someone please help understand the problem and how do i fix it?
Regards,
Shri
This sounds like a Python module search path issue. The import statements in the particular script imagenet_train.py and other scripts in that directory assume that they can find the other scripts in a submodule called inception, but when you run the script from the same directory, Python can't find that submodule.
The easiest way to fix this is to change to the parent directory (cd ~/Desktop/Test/inception_test/models/inception) and run the script as follows:
$ python inception/inception_train.py