i have just install python, anaconda, tensorflow
and i was trying to do first test of tesorflow in jupyter notebook
but i doesn't work plz help me
Thank you
python version == 3.7.0
using macbook 2015
import tensorflow as tf
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-64156d691fe5> in <module>
----> 1 import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
i have already checked in terminal (pip3 list)
It already has tensorflow ,bu i have no idea why it doesn't work
There could be so many different reasons the import is not working, you need to give us more information.
what environment did you install tensorflow in (if at all)?
did you check to see if the environment had tensorflow installed through conda list?
why did you choose to pip3 install instead of conda install?
did you activate the environment when you started the notebook?
did you try uninstalling tensorflow and reinstalling it?
I suspect that when you installed using pip3 it installed to the default location and not to the conda environment, in general, if you are using anaconda to manage your packages and environments always use conda install where possible. And when listing packages, use conda list not pip list.
Related
I am trying to use tensorflow io to process mp3 audio files.
My operating system is Ubuntu 20.04.
I created a new dedicated virtual environnement and activated it using pyenv :
pyenv virtualenv testtfio; pyenv local testtfio
I also upgraded pip as I thought it might cause the issue. Then I installed tensorflow_io :
pip install tensorflow_io
This generates installation of this package and all dependencies as I can see after using "pip freeze".
Then when I try to import tensorflow_io it shows :
ModuleNotFoundError: No module named 'tensorflow_io'
What am I doing wrong ?
Thanks for your help
The issue was linked to Jupyter : I was using jupyter notebook in my new local environnement and it was running (I suppose from the pyenv global environment), but I forgot to install it in local virtualenv.
In order to solve the import issue in Jupyter notebook I just had to install Jupyter in my new local virtualenv.
pip install jupyter
Hi
in jupyter notebook, when i tried to import tensorflow like below, i got an error of ModuleNotFoundError: No module named 'tensorflow'. Then, I opened anaconda prompt and trying to install tensorflow in anaconda and it failed many times and here is the error message. Could you please help me what is the problem? Thanks
import tensorflow as tf
ok, so i tried to downgrade python from 3.8 to 3.6 and i still got an error at the end, could anyone help pls? Thanks
EnvironmentNotWritableError: The current user does not have write permissions to the target environment.
environment location: C:\ProgramData\Anaconda3
According to TensorFlow docs, tf is compatible with python 3.5, 3.6, 3.7 or 3.8
and also python 3 64bit release is a must, so it's maybe worth to check if you don't try to install tf accidentally on 32bit version of python.
https://www.tensorflow.org/install/pip#windows
import sys
print(sys.version)
I installed tf according to Anaconda docs:
create fresh env,
activate it,
and install tf:
conda create -n myproject tensorflow
conda activate myproject
conda install tensorflow
I can see that conda automatically selected python version 3.7.9
verify:
import tensorflow as tf
tf.version.VERSION
your python version is not compatible with this version of tensorflow. you are using python 3.8 downgrade python to either 3.5, 3.6 or 3.7. downgrading python should solve your issue.
I cannot seem to properly install pytorch on my computer, so here is the background of what I have done:
I had already installed python on my computer and it worked. I used it in Eclipse, using pyDev, so I don't know if that could be the problem. Now I want to install pytorch, so I installed anaconda and entered the command for installing pytorch. To get the right command, I use https://pytorch.org/get-started/locally/, where I tried the options both with and without cuda. In both cases I get an error when I type "import torch".
I have also installed miniconda and tried the same with that without succes. I also tried to work in IDLE in stead of Eclipse, but I keep getting the "no module named 'torch'" error. Each time I run a command in anaconda it appears that the installation is succesfull, but I still can't import 'torch'.
Any idea what the problem could be or what I could try?
Open command prompt or terminal and type:
pip3 install pytorch
If it says pip isn't installed then type: python -m pip install -U pip
Then retry importing Pytorch module
Using anaconda, I think you can check to see if pytorch is properly installed inside your conda environment using conda list inside your environment. If it is shown in the list of installed packages, you can directly try to run python in command line and import torch as in the official Pytorch tutorial:
import pytorch
torch.cuda.is_available()
For IDEs like Eclipse, you need to edit the settings of your project so that it uses the correct conda environment.
Try to create conda-env and reinstall pytorch on conda-env.
Then try to import torch again.
import torch
torch.cuda.is_available()
I understand this may be an old question, but still I cannot find solution from off-the-shelf Q$A. Here is the problem:
I am following Udacity "Machine Learning" and its assignments, and need use iPythonNotebook & tensorflow. Details : https://github.com/Omarito2412/udacity-deeplearning
Assignment2 requires tensorflow. BTW, I already installed Anaconda,
already made tensorflow working on Pycharm on the same computer which is Macbook, but do not know how to make it work on iPythonNotebook environment.
The codes are quite simple, as follows:
import numpy as np
import tensorflow as tf
from six.moves import cPickle as pickle
from six.moves import range
and the error message is as follows:
ImportError Traceback (most recent call last)
<ipython-input-1-0970743dd90d> in <module>()
2 # before proceeding further.
3 import numpy as np
----> 4 import tensorflow as tf
5 from six.moves import cPickle as pickle
6 from six.moves import range
ImportError: No module named tensorflow
Thanks. Any suggestions ?
PS: I have this problem on two MacBooks, and both MacBooks run Pycharm+tensorflow well.
You should deactivate and re-activate the environment
source deactivate tensorflow
source activate tensorflow
After I tried Anaconda-installation (I was using the other installation methods, which are all shown in the link below)
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#anaconda-installation
It worked ...
Further, on terminal activate tensorflow
>>> source activate tensorflow
before open iPython Notebook
>>> ipython notebook
At last, I have to restart my macbook to make it work....
i have missed tensorflow install (3) number below the list..
now i have solved
for anaconda install
for enviroment install
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#anaconda-installation
for tensorflow install
https://github.com/conda-forge/tensorflow-feedstock
This is likely due to an anemic environment variable, one of the library path class. I don't know how iPythonNotebook denotes the libraries it will search for files (say, $LD_LIBRARY_PATH), but I believe that you have to find it (a list of paths to libraries) and add the root directory of TensorFlow.
More than likely either Tensorflow is not installed in the right Python environment of Conda or not installed at all. Follow the below steps:
$ conda create -n tensorflow python=3.5
Once that is done, need to activate that as below:
$ source activate tensorflow
Then when you open IPython Notebook or Spyder, it will recognize the Tensorflow.
Run python -m ipykernel install --user --name <Environment_Name>. This should add your environment to the jupyter kernel list.
Change the kernel using Kernel->Change Kernel option or New-><Environment_Name>.
I'm trying to get TensorFlow to work on my Mac (OSX El Capitan 10.11.2). I tried the pip install from the setup guide and also followed the instructions in the accepted answer here.
In both cases I am able to successfully activate the virtualenv and my prompt changes to tensorflow. Python works fine, I'm able to do simple computations on the command line. But when I try to import tensorflow:
import tensorflow as tf
I repeatedly get this error:
ImportError: No module named tensorflow
Any help would be appreciated.
I had the issue reported in the original question. Python worked fine, I followed the installation steps on the Tensforflow website, and got "No module named tensorflow."
Re-installing python via brew, and re-installing pip as a result, fixed it. I didn't need to uninstall anything, just the line below along with the normal pip install from the tensorflow installation document afterwards:
brew install python