How the error of tensorflow will be fix? - python

I am trying the code of CNN fault detection but it is getting error. I tried pip install tensorflow but that is also not working.
No module named as tf,
How this error will be removed?

U are using Anaconda enviroment, u must install tensorflow by following this steps:
C:> conda create -n tensorflow pip python=3.5
C:> activate tensorflow
(tensorflow)C:> pip install --ignore-installed --upgrade tensorflow
See Installing TensorFlow

Related

How to install Tensorflow via conda for Python 3.10.*?

I am using miniconda, v4.13.0, I can install Tensorflow using conda install tensorflow to my conda environment if its Python version 3.9.* However I would like to use Python 3.10.*
If the Python version is 3.10.* in my conda environment then command conda install tensorflow gives the specification incompatibility error:
tensorflow -> python[version='3.5.|3.6.|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|3.8.|3.7.|3.9.*']
Question
Is there any way to install Tensorflow via conda where the Python version is 3.10.*?
You can use the below command to install TensorFlow using python 3.10:
conda create --name tf python=3.10
conda activate tf
conda install tensorflow
Please check this link for reference.
You can find here tensorflow github PR
https://github.com/tensorflow/addons/pull/2635

How to resolve module not found error in JupyterNotebook for tensorflow?

I have created the tensorflow environment using the following set of commands:
conda create --name py3-TF2.0 python = 3
conda activate py3-TF2.0
conda install tensorflow
pip install -upgrade tensorflow
pip install ipykernel
Try these steps to install Tensorflow using Conda
#create virtual environmenttf2.0 using conda
conda create --name tf2.0 python=3
#Activate the env
conda activate tf2.0
#Install Tensorflow
tf2.0$pip install tensorflow
tf2.0$python
#Verify the Tensorflow installation before launching any of the IDE
>>import tensorflow as tf
>>tf.__version__
#Launch the jupyter notebook
tf2.0$conda install jupyter
tf2.0$jupyter notebook
What you can do is run the jupyter notebook and try installing tensorflow from there.
In a jupyter notebook cell type in:
!pip install tensorflow==2.0.0
(dont miss the ! sign before)
To test:
import tensorflow as tf
tf.__version__

Anaconda: Installing opencv in tensorflow environment

in Anaconda3 (python3.7) I made an Tensorflow environment named tf. Now I tried to install OpenCv into this environment. I tried several:
conda install --name tf opencv
conda install --name tf -c conda-forge opencv
I tried also inside the tf folder:
pip install opencv-python
all runs and installed something. But when I try to run my code the error appears that it couldn't find cv2.
I import it with
import cv2 as cv.
I run the code through Conda in Visual Studio Code. Ans I selcted the Interpreter Path Python3.7.6 64-bit('tf':conda)
The installation of numpy and matplotlib into this environment worked.
Does anyone know what I've done wrong? Or how I can combine these two, OpenCV and Tensorflow, through anaconda?
Thanks a lot
Use following commands
conda create -n tf tensorflow
conda activate tf
Then use
pip install opencv-python

Install TensorFlow & Tensorboard from source

I want to install Tensorflow (CPU)(py 3.6) for windows, my company uses a proxy, so i can't install through pip, i have to build it from source.
I unzipped tensorflow/tensorboard/protobuf.tar.gz in my Anaconda3 folders.
When i use the setup.py files, it occurs that i need tensorboard for installing tensorflow, and i need tensorflow for installing tensorboard.
So i don't know how to proceed for installing Tensorflow without using dependencies from pypi.org.
Thanks
You can use pip with proxy. I was struggling with company proxy too and that was the solution for me:
Run a command prompt as administrator and type the following:
pip install --proxy http://username:password#proxy_url:port tensorflow
(this will install the latest CPU version of tensorflow)
This should work.
Installing with Anaconda
follow steps to install TensorFlow in an Anaconda environment:
Download and install Anaconda.
Create a conda environment named tensorflow to run a version of Python by invoking the following command:
$ conda create -n tensorflow
Activate the conda environment by issuing the following command:
$ source activate tensorflow
(tensorflow)$ # Your prompt should change
(tensorflow)$ pip install --ignore-installed --upgrade tfBinaryURL
where tfBinaryURL is the URL of the TensorFlow Python package. For example, the following command installs the CPU-only version of TensorFlow for Python 2.7:
(tensorflow)$ pip install --ignore-installed --upgrade \ https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.2.1-cp34-cp34m-linux_x86_64.whl
For detail offical link

Installing Tensorflow on windows Anaconda2

I am trying to install tensorflow on Ananconda2 in windows 64 bit. I've tried the following steps:
conda create --name tensorflow python=3.5
activate tensorflow
conda install -c conda-forge tensorflow
Tensorflow got installed successfully and i could check that in Anaconda prompt.
However, when I open my python2 Jupyter notebook and try with the following:
import tensorflow as tf
I get an error says "module tensorflow is not found". Could you please help!
Solution:- (Note:- This will surely work for all!!)
Step 1:- conda search python
Step 2:- conda install python=3.5.2
Step 3:- pip install tensorflow
Step 4:- import tensorflow as tf
Done!!

Categories