No module named "tensorflow" - tensorflow

I want to build tensorflow with python libraries. Currently I have tensorflow installed but I do not see python packages in /usr/local/lib/python3.6/dist-packages so when I try to import tensorflow module in python terminal, it fails. However, there is library in /usr/lib and C++ programs work.
What is flag/target needed in bazel build?

You can get TensorFlow in python package by:
Directly doing pip install tensorflow: It will install the precompiled version by directly downloading a wheel file.
Build from source code in GitHub using bazel build.
For the second approach, the following steps are needed:
Take the source code from GitHub.
Compile the code using bazel build. It will give the ".whl" file.
Do pip install /tmp/TensorFlow-version-tags.whl
For detailed installation, steps follow this.

Related

disable CUDA when using dlib library as a dependency in my project

as suggested in the cmake files I import dlib in my project using:
include(FetchContent)
FetchContent_Declare(dlib
GIT_REPOSITORY https://github.com/davisking/dlib.git
GIT_TAG v19.18
)
FetchContent_MakeAvailable(dlib)
I don't want dlib to use CUDA. How do I disable it?
I can not disable cuda for dlib. because if I disable then another error happened. instead of disabling I applied the following approach this Is working in my PC:
Create a new virtual environment
pip --no-cache-dir install cmake
pip --no-cache-dir install -v --install-option="--no" --install-option="DLIB_USE_CUDA" dlib
The line number 3 is the most important it install dlib without cuda support
pip --no-cache-dir install face-recognition
I am working face recognition project. and project is working now without error.

`save_model` requires h5py error occurss after installing h5py and cython packages too

I need to save my new sequential model but when I use the model.save(filename),it shows error like save_model requires hp5y.I tried installing h5py in conda by 'conda install -c anaconda h5py'command. And I also installed cython,but then the error exists .what should I do?
one should include the package in pycharm project interpreter after being downloaded in the conda environment.

Tensorflow compilation on Odroid XU4

I am trying to compile Tensorflow (tried both: full & lite) on Odroid XU4 (16GB eMMc, Ubuntu 16) but I am getting errors shown in figures: https://www.dropbox.com/sh/j86ysncze1q0eka/AAB8RZtUTkaytqfEGivbev_Ga?dl=0
I am using FlytOS as OS(http://docs.flytbase.com/docs/FlytOS/GettingStarted/OdroidGuide.html). Its customized Ubuntu 16 with OpenCV and ROS setup, makes 11GB after installation. So, I got only 2.4GB free. Therefore, I added 16GB USB as swap memory.
I have installed Bazel without using swap memory. Tried tensorflow full version and lite but failed to compile. However, I downloaded compiled tensorflow lite for Pi and successfully installed on Odroid. Since, Odroid is Octacore, therefore, to make best use of available processing power I need to compile tensorflow on Odroid.
Please let me know if any one has tensorflow compiled on Odroid XU4.
Regards,
Check this guide out. Build Tensorflow on Odroid
IT gives a detailed step by step guide and also has some troubleshooting procedures.
Summarizing the steps here:
Install prerequisites including g++, gcc-4.8, python-pip, python-dev, numpy and Oracle Java (not OpenJDK)
Use a USB/ Flash drive and add some swap memory
Build Bazel. In the compile.sh shell script, modify the run line to add memory flags
run “${JAVAC}” -J-Xms256m -J-Xmx384m -classpath “${classpath}” -sourcepath “${sourcepath}”
Get Tensorflow v1.4 specifically and run ./configure and select relevant options. Disable XLA as it's causing some problems.
Finally run Bazel command.
bazel build -c opt --copt="-funsafe-math-optimizations" --copt="-ftree-vectorize" --copt="-fomit-frame-pointer" --local_resources 8192,8.0,1.0 --verbose_failures tensorflow/tools/pip_package:build_pip_package
Now install it.
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
sudo pip2 install /tmp/tensorflow_pkg/tensorflow-1.4.0-cp27-cp27mu-linux_armv7l.whl --upgrade --ignore-installed
Test the install
python
import tensorflow
print(tensorflow.__version__)
1.4.0
I was able to compile it successfully by following the steps given there.

translate.py can't be found in /rnn/translate folder

I installed tensorflow with method:
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl
sudo pip install --upgrade $TF_BINARY_URL
But when I go into the tensorflow folder, I can't found the translate.py file in translate folder, all the files in the translate are list:
It seems that example files were excluded from the pip installation packages of tensorflow (see issue #4574) without updating the docs.
Cloning the model repo should help as it contains all the tutorial files.

Scrapy add external library

How can we add external library to Scrapy.I want to add the follwing library to Scrapy:
https://github.com/scrapinghub/scrapylib
How can I add it?
I'm not entirely sure why pip can't install scrapylib (I updated pip to version 1.4, but the same issue occurred).
A workaround would be to download a zip of scrapylib directly from Github, extract the zip and then run python setup.py install. I was able to install scrapylib and run import scrapylib from the Python interpreter without any errors.