bleach: 1.5.0-py35_0
colorama: 0.3.9-py35_0
decorator: 4.1.2-py35_0
entrypoints: 0.2.3-py35_0
html5lib: 0.9999999-py35_0
ipykernel: 4.6.1-py35_0
jupyter_client 100% |###############################| Time: 0:00:00 6.77 MB/s
nbformat-4.4.0 100% |###############################| Time: 0:00:00 8.10 MB/s
ipykernel-4.6. 100% |###############################| Time: 0:00:00 9.54 MB/s
nbconvert-5.2. 100% |###############################| Time: 0:00:00 9.59 MB/s
notebook-5.0.0 100% |###############################| Time: 0:00:00 8.24 MB/s
Once done I ran command
(tensorflow)C:>jupyter notebook
It opened new Juypter window and able to Run fine -
import tensorflow as tf
I was able to load tensorflow in Jupyter notebook on Windows by: first do conda create tensorflow install, then activate tensorflow at the command prompt , then execute "Jupyter notebook" from command line.
Tensorflow imports at the notebook with no error. However, I was unable to import "Pandas" &"Matplotlib, ....etc"
As suggested by @Jörg, if you have more than one kernel spec. You have to see the path it points to. In my case, it is actually the path that was to be corrected.
When I created TensorFlow
virtual env, the spec had the entry for python which was pointing to base
env. Thus by changing W:\\miniconda\\python.exe
to W:\\miniconda\\envs\\tensorflow\\python.exe
solved the problem.
So it is worth looking at your kernel spec. Delete that is not needed and keep those you want. Then look inside the JSON files where the path is given and change if needs be. I hope it helps.
TensorFlow package doesn't come by default with the root environment in Jupyter, to install it do the following :
Close Jupyter Notebook.
Open Anaconda Navigator (In windows : you can find it using the search bar)
On the sidebar, click on the Environments tab (by default you are using the root env).
You can see the installed packages, on the top switch to not-installed packages and search for tensorflow, if it doesn't show, click on Update index and it will be displayed.
The installation takes some time
The foremost way is to create a new virtual environment and install all dependencies like jupyter notebook, tensorflow etc.
conda install jupyter notebook
conda install -c conda-forge tensorflow
The other way around is to install tensorflow in the current environment (base or any activated environment).
conda install -c conda-forge tensorflow
Note: It is advisable to create a new virtual environment for every new project. The details how to create and manage virtual environment using conda can be find here:
https://conda.io/docs/user-guide/tasks/manage-environments.html
Probably there is a problem with the TensorFlow in your environment.
In my case, After installing some libs, my TensorFlow stopped working.
So I installed TensorFlow again using pip. like so:
just run
pip install tensorflow
then I re-imported it into my jupyter notebook as :
import tensorflow as ft
In case you want to install jupyter and base libs try this:
pip install jupyter tensorflow keras numpy scipy ipython pandas matplotlib sympy nose
Other supported libraries are necessary to install with TensorFlow.Make sure if these libraries are installed:
numpy
scipy
jupyter
matplolib
pillow
scikit-learn
tensorflow-addons,
tensorflow.contrib
This worked for me. I followed this: https://www.pythonpool.com/no-module-named-tensorflow-error-solved/
If you have installed TensorFlow globally then this issue should not be occurring. As you are saying you have installed it, maybe you did it in a virtual environment.
Some background:
By default, Jupyter will open with a global python interpreter kernel.
Possible solutions:
Change your jupyter notebook kernel to your virtual environment kernel. Please check here to see how to create a kernel out of your virtual environment.
Troubleshooting:
If the above solution dint work lets do some troubleshooting. When you add your new kernel to jupyter you might have got output like below
Installed kernelspec thesis-venv in C:\Users\vishnunaik\AppData\Roaming\jupyter\kernels\venv
Check the file kernel.json in this path, which might look something like below
"argv": [
"C:\\Users\\vishnunaik\\Desktop\\Demo\\CodeBase\\venv\\Scripts\\python.exe",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
"display_name": "thesis-venv",
"language": "python",
"metadata": {
"debugger": true
Check the path to the python.exe is rightly pointing to your virtual environment python version or not. If not then update it accordingly.
Now you should be able to use a virtual environment in your jupyter notebook. If your kernel takes a lot of time to respond see jupyter notebook server logs, sometimes you might get output like this
[I 21:58:38.444 NotebookApp] Kernel started: adbd5551-cca3-4dad-a93f-974d7d25d53b, name: thesis-venv C:\\Users\\vishnunaik\\Desktop\\Demo\\CodeBase\\venv\\Scripts\\python.exe: No module named ipykernel_launcher
This means your virtual environment doesnot have ipykernel
installed. So install it in your virtual environment using below command.
pip install ipykernel
Now you have done everything possible, so I hope this will solve your issue.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.