No Module Named Tensorflow - Anaconda - python

I'm pretty new to Tensorflow. I've installed the package using
conda install -c conda-forge tensorflow
When I import tensorflow now, I get the No Module named Tensorflow error. I've been searching for a way out and have failed. It wold mean a lot if someone could help me with this. Thanks

run following commands:
conda create -n tensorflow
activate tensorflow
conda install -c conda-forge tensorflow
else you can install it with pip command:
pip install tensorflow

Related

ImportError: cannot import name 'has_pattern' from 'gensim.utils'

I trying to import gensim.
But I got this error.
ImportError: cannot import name 'has_pattern' from 'gensim.utils' (C:\Users\admin\anaconda3\envs\tf-gpu\lib\site-packages\gensim\utils.py)
I will be grateful for any help.
Installing Version 3.4.0 solved the problem. Try the following :-
pip install gensim==3.4.0
First make sure you have gensim installed in your development environment along with its dependencies i.e. numpy, scipy and pattern:
conda install -c conda-forge gensim
conda install numpy
conda install -c anaconda scipy
conda install -c conda-forge pattern
If it's still not fixed then try updating conda:
conda update --all
also
conda update gensim
Maybe this would fix your issue!

ModuleNotFoundError: No module named 'snorkel.labeling'

I installed snorkel using conda and when I try to run - from snorkel.labeling import labeling_function it throws the following error - ModuleNotFoundError: No module named 'snorkel.labeling'.
I tried looking up for a solution on Github, but unfortunately, I couldn't follow through. I have also tried installing nb_conda_kernels, to make all your conda environments available in jupyterbut it didn't help. Also tried creating a separate env, installing snorkel and launching jupyter notebook from the snorkel's environment, and it didn't work either. Any form of help is much appreciated!
Thanks in advance!
Try these install instructions:
conda create --yes -n snorkel
conda activate snorkel
conda install pytorch==1.1.0 -c pytorch
conda install snorkel==0.9.0 -c conda-forge
Or these, listed here:
# [OPTIONAL] Activate a virtual environment
conda create --yes -n spam python=3.6
conda activate spam
# Install requirements (both shared and tutorial-specific)
pip install environment_kernels
# We specify PyTorch here to ensure compatibility, but it may not be necessary.
conda install pytorch==1.1.0 -c pytorch
conda install snorkel==0.9.5 -c conda-forge
pip install -r spam/requirements.txt
# Launch the Jupyter notebook interface
jupyter notebook spam
Please try the following:
For pip users
pip install snorkel
For conda users
conda install snorkel -c conda-forge

cannot install tensorflow on anaconda

i am trying to install tensorflow on anaconda
i tried conda install -c conda-forge tensorflow
but the installation stuck on Solving environment:
looked for a solution so someone suggested to install with debug
conda install --debug -c conda-forge tensorflow
but it stopped on
DEBUG conda.resolve:filter_group(277): tensorboard: pruned from 47 -> 0
how to fix this?
For python version 3.7, you need to first downgrade to 3.6 using conda install python=3.6. After that, the installation should work. I had a similar problem recently.
What it worked for me was:
I uninstalled old versions of python and anaconda from my PC.
I installed anaconda (Anaconda3-4.4.0-Windows-x86_64.sh) from here.
I confirmed the conda installation by: conda -V
It should give you: conda 4.3.21
I confirmed the python installation by: python -V
It should give you: Python 3.6.1 :: Anaconda 4.4.0 (64-bit)
Confirm the conda environment by typing on anaconda prompt:
conda update conda
conda update anaconda
Next, I Installed theano by: conda install theano
Next, I installed tensorflow by: conda install -c conda-forge tensorflow
Last, I installed keras by: pip install keras
This process takes some while.
The latest Tensorflow 1.12 supports python 3.4,3.5 or 3.6.
python 3.7 is not supported.
you can download Anaconda 5.2.0
After the Anaconda is installed, you can use conda install tensorflow or conda install tensorflow-gpu to quickly install tensorflow

Cannot run keras

I want to run keras on anaconda for convolution neural network using mnist handwriting recognition. A day before everything worked fine but as I try to run the same program, i get the following error in the first line:
from keras.datasets import mnist (first line of code)
ModuleNotFoundError: No module named 'keras.datasets'; 'keras' is not
a package
I also created virtual environment to use python 3.5 as my python version is 3.6. I have installed both keras and tensorflow. How do i fix the above error? Perhaps it is related to path and not error with keras. My anaconda is installed in E: whearas working environment is C:\Users\Prashant Mahato.
Do you get an error message if you just import keras? I was getting a similar error in the command line and then implemented in Spyder (using Anaconda) and it worked fine.
Here is how I install Keras and other related dependencies
conda create -n <Environment_Name> python=3.6
activate <Environment_Name>
conda update --all
conda install mingw libpython
conda install scipy
conda install numpy
conda install mkl
conda install -c conda-forge tensorflow
conda install theano
pip install pyyaml
pip install h5py
pip install keras
conda install -c conda-forge tmux
conda install pandas
condas install pillow
conda install scikit-learn
conda install -c menpo opencv3
To check if everything is work as it should just import all the packages in python within the environment created.
I'm running Windows 10 and Anaconda 4.2
If running Ubuntu, replace
activate <Environment_Name>
with
source activate <Environment_Name>
HTH.

ImportError: "No module named tensorflow" (Keras in Anaconda environment)

I have installed Keras and tensorflow using pip in Anaconda environment, but when I run Keras program in tensorflow background it gives error No module named tensorflow. Can you please help?
Check your python version and installation command. ($ conda create -n tensorflow python=<version>)
If you install tensorflow via conda-forge use:
# Linux/Mac OS X, Python 2.7/3.4/3.5, CPU only:
(tensorflow)$ conda install -c conda-forge tensorflow
Otherwise, switch the pip command according to the python version like:
# Python 2
(tensorflow)$ pip install --ignore-installed --upgrade $TF_BINARY_URL
# Python 3
(tensorflow)$ pip3 install --ignore-installed --upgrade $TF_BINARY_URL
If this doesn't solve your problem, please provide more detailed command lines to reproduce the problem.

Categories

Resources