Trouble installing tensorflow on linux - tensorflow

I am having trouble while importing tensorflow in vs code in ubuntu linux. I have installed it using pip(my cpu is intel pentium g2020) and this is what I get afterimport tensorflow as tf and I get
enter image description here
also my tensorflow version is 2.7
and python version is 2.7.18

Maybe your env is incompatible. you can try to create a virtual env for your code ,such as :
conda create -n yourname_env

Related

Using Object Detection API on local GPU but not last version (v2.5.0)

I am trying to use my local GPU to train an EfficientDetD0 model. I already have a good pipeline (that works on Google Colab for example), I modified it a bit to use it locally, but one problem happens every time I launch the training.
I use conda to install tensorflow-gpu with cuda and cudnn but it makes TensorFlow v2.4.1 environments and when I launch the training the Object Detection API automatically install TensorFlow V2.5.0. So my env is not using the gpu for the training because cuda and cudnn are waiting for TensorFlow to be v2.4.1 and not v2.5.0.
Is there a way to get the Object Detection API in v2.4.1 and not v2.5.0 ?
I tried many things but it doesn't work (training is failing or going for CPU training).
Here is the code that install dependencies and overwrite TensorFlow version to TensorFlow v2.5.0:
os.system("cp object_detection/packages/tf2/setup.py .")
os.system("python -m pip install .")
SYSTEM:
gpu : Nvidia RTX 3070
os : Ubuntu 20.04 LTS
tensorflow: 2.4.1
P.S.: I go with conda install -c conda-forge tensorflow-gpu for installing TensorFlow, cuda and cudnn in my training env because manually there was a dependency problem, so I took the easy way.
EDIT : solution found explained in comments.
Follow these steps to install specific version of tensorflow gpu
1. Set Up Anaconda Environments
conda create -n tf_gpu cudatoolkit=11.0
2. Activate the new Environment
source activate tf_gpu
3. Install tensorflow-gpu 2.4.1
pip install tensorflow==2.4.1
Try to run object_detection without "installing" it. Dont run setup.py. Just setup the neccesery paths and packages manually.
Or edit the setup.py to skip installing the specific verison of TF. I quess that this version is a requirement of some of the packages installed in setup.py.
I use the object_detection without running the setup.py or doing any "installation" without any problems.

Error importing tensorflow , tensorflow library was compiled to use AVX instructions, but these aren't available on your machine

System information
- Linux Ubuntu 16.04
TensorFlow installed from binary (pip install)
TensorFlow version:
Python version: 3.5
Installed using virtualenv? pip? conda?: pip and virtualenv
Bazel version (if compiling from source):
GCC/Compiler version (if compiling from source):
CUDA/cuDNN version:
GPU model and memory:
Problem described
i was following the tutorial for using intel neural stick 2 for object detection https://towardsdatascience.com/speed-up-predictions-on-low-power-devices-using-neural-compute-stick-and-openvino-98f3ae9dcf41
in the example i install the prerequisites using the command
sudo ./opt/intel/computer_vision_sdk/deployment_tools/model_optimizer/install_prerequisites/install_prerequisites.sh
tensorflow was installed with the prerequisites , i also installed tensorflow using pip install , but when i run the next command
mo_tf.py \
--input_model ~/Downloads/ssd_mobilenet_v1_coco_2018_01_28/frozen_inference_graph.pb \
--tensorflow_use_custom_operations_config /opt/intel/computer_vision_sdk/deployment_tools/model_optimizer/extensions/front/tf/ssd_support.json \
--tensorflow_object_detection_api_pipeline_config ~/Downloads/ssd_mobilenet_v1_coco_2018_01_28/pipeline.config \
--data_type FP16
i get the following error
F tensorflow/core/platform/cpu_feature_guard.cc:37]
The tensorflow library was compiled to use AVX instructions, but these aren't available in your machine
Aborted (core dumped)
i am getting the same error when try and import tensorflow
what should i do to solve this error ?
The error message indicates that the machine does not support avx. Is it so? You can refer this link How to tell if a Linux machine supports AVX/AVX2 instructions? to check the same.
If your machine does not support AVX, then the solution would be to build tensorflow from source excluding those settings

tensorflow not supported wheel on this platform

I've searched around and non of the solutions seem to pertain to me, so here I am.
I installed anaconda 5.1 for python 3.6, I downloaded and installed 64-Bit(x86)Installer(551 MB)
from
https://www.anaconda.com/download/#linux
I followed the directions here
https://docs.anaconda.com/anaconda/install/linux
I had the install prepend the path and install microsoft VS code.
I then attempt to install the CPU only tensorflow using anaconda as suggested here
https://www.tensorflow.org/install/install_linux#InstallingAnaconda
I try to install the binary for python 3.6 CPU only
https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.6.0-cp36-cp36m-linux_x86_64.whl
I get the following error
tensorflow-1.6.0-cp36-cp36m-linux_x86_64.whl is not a supported wheel on this platform.
I am running a Ubuntu 16.04 VM on windows 10.
edit: when I run this command
pip install --ignore-installed --upgrade tfBinaryURL
outside of the tensorflow environment it worked.
2nd edit:
Additionally I explored my tensorflow environment in my anaconda3 folder, and I noticed it only has python 2.7, so when I tried to install the cpu only tensorflow while in the enviroment for python 2.7 it worked.

Installation issues with Tensorflow in Windows10

Installation method:
I'm using the Anaconda distribution of Python instead of having multiple versions of python on my computer. I used the instructions under TensorFlow with Anaconda
(link1)(link2) with the following commands:
C:> conda create -n tensorflow python=3.6
C:> activate tensorflow
(tensorflow)C:> pip install --ignore-installed --upgrade tensorflow
Error:
When running the test hello world code from within a tensorflow environment I received the following errors:
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
2018-01-23 02:44:09.201798: I C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
>>> print(sess.run(hello))
b'Hello, TensorFlow!'
Questions:
Does this mean my CPU does not support Tensorflow? (i7-6500U, 2.59GHz)
Does the b' signify an environment output, or is this an error?
I noticed the TensorFlow library doesn't appear in my CMD prompt version of python, nor in my Spyder executable. Should I use pip and install a second version of the library? Or does TensorFlow require an active environment to invoke the library?
Edit:
I just noticed this line in a re-read:
In Anaconda, you may use conda to create a virtual environment.
However, within Anaconda, we recommend installing TensorFlow with the
pip install command, not with the conda install command.
if you have installed tensforflow 1.8 for cpu correctly in win10 (python3.5.x) and you have an error, try to change version to 1.5
pip3 install tensorflow==1.5
I have spend one day to know it :)
You should be able to run tensorflow just fine with that installation. However, you can install a specific version of tensorflow that was compiled to include instruction sets that will make the computation faster that your processor has access to.
Read this guide to find out how to build form source and improve your performance: https://www.tensorflow.org/install/install_sources
or feel free to continue using the installation you have now.

Keras with Tensorflow backend on GPU. MKL ERROR: Parameter 4 was incorrect on entry to DLASCL

I installed Tensorflow with GPU support and Keras to an environment in Anaconda (v1.6.5) by using following commands:
conda install -n EnvName tensorflow-gpu
conda install -n EnvName -c conda-forge keras-gpu
I have NVIDIA Quadro 2200K on my machine with driver v384.66, cuda-8.0, cudnn 7.0
When I am trying to run a python code with Keras at the stage of training I get the following
Intel MKL ERROR: Parameter 4 was incorrect on entry to DLASCL.
and later
File
"/home/User/anaconda3/envs/keras_gpu/lib/python3.6/site-packages/numpy/linalg/linalg.py",
line 99, in _raise_linalgerror_svd_nonconvergence
raise LinAlgError("SVD did not converge") numpy.linalg.linalg.LinAlgError: SVD did not converge
Other relevant sources suggest to check data for NaNs and Infs, but my data is clean for sure. By the way, CPU version of the installation is working fine, the issue occurs only when trying to run on GPU
I tried to reinstall Anaconda, to reinstall CUDA and numpy, but it didn't work out.
The problem was in package mkl (2018.0.0) - it seems like it has recently been released and conflicts with the version of some packages supplied with Tensorflow(1.3.0) and Keras(2.0.5) via conda*.
So I manually downgraded mkl using Anaconda Navigator to v11.3.3 which led automatically to downgrade of other packages and everything is working well now.