Running tensor flow in Jupyter laptop

I am trying to do a deep academic work. To do this, I first installed all the deep learning packages in my Python environment.

Here is what I did.

In Anaconda, I created an environment called tensorflow as follows

 conda create -n tensorflow 

Then, Python packages for data science, such as Pandas, NumPy, etc., were installed inside it. I also installed TensorFlow and Keras there. Here is a list of packages in this environment

 (tensorflow) SFOM00618927A:dl i854319$ conda list # packages in environment at /Users/i854319/anaconda/envs/tensorflow: # appdirs 1.4.3 <pip> appnope 0.1.0 py36_0 beautifulsoup4 4.5.3 py36_0 bleach 1.5.0 py36_0 cycler 0.10.0 py36_0 decorator 4.0.11 py36_0 entrypoints 0.2.2 py36_1 freetype 2.5.5 2 html5lib 0.999 py36_0 icu 54.1 0 ipykernel 4.5.2 py36_0 ipython 5.3.0 py36_0 ipython_genutils 0.2.0 py36_0 ipywidgets 6.0.0 py36_0 jinja2 2.9.5 py36_0 jsonschema 2.5.1 py36_0 jupyter 1.0.0 py36_3 jupyter_client 5.0.0 py36_0 jupyter_console 5.1.0 py36_0 jupyter_core 4.3.0 py36_0 Keras 2.0.2 <pip> libpng 1.6.27 0 markupsafe 0.23 py36_2 matplotlib 2.0.0 np112py36_0 mistune 0.7.4 py36_0 mkl 2017.0.1 0 nbconvert 5.1.1 py36_0 nbformat 4.3.0 py36_0 notebook 4.4.1 py36_0 numpy 1.12.1 <pip> numpy 1.12.1 py36_0 openssl 1.0.2k 1 packaging 16.8 <pip> pandas 0.19.2 np112py36_1 pandocfilters 1.4.1 py36_0 path.py 10.1 py36_0 pexpect 4.2.1 py36_0 pickleshare 0.7.4 py36_0 pip 9.0.1 py36_1 prompt_toolkit 1.0.13 py36_0 protobuf 3.2.0 <pip> ptyprocess 0.5.1 py36_0 pygments 2.2.0 py36_0 pyparsing 2.1.4 py36_0 pyparsing 2.2.0 <pip> pyqt 5.6.0 py36_2 python 3.6.1 0 python-dateutil 2.6.0 py36_0 pytz 2017.2 py36_0 PyYAML 3.12 <pip> pyzmq 16.0.2 py36_0 qt 5.6.2 0 qtconsole 4.3.0 py36_0 readline 6.2 2 scikit-learn 0.18.1 np112py36_1 scipy 0.19.0 np112py36_0 setuptools 34.3.3 <pip> setuptools 27.2.0 py36_0 simplegeneric 0.8.1 py36_1 sip 4.18 py36_0 six 1.10.0 <pip> six 1.10.0 py36_0 sqlite 3.13.0 0 tensorflow 1.0.1 <pip> terminado 0.6 py36_0 testpath 0.3 py36_0 Theano 0.9.0 <pip> tk 8.5.18 0 tornado 4.4.2 py36_0 traitlets 4.3.2 py36_0 wcwidth 0.1.7 py36_0 wheel 0.29.0 <pip> wheel 0.29.0 py36_0 widgetsnbextension 2.0.0 py36_0 xz 5.2.2 1 zlib 1.2.8 3 (tensorflow) SFOM00618927A:dl i854319$ 

You can see that jupyter also installed.

Now, when I open the Python interpreter in this environment and run the basic TensorFlow command, everything works fine. However, I wanted to do the same in Jupyter's notebook. So, I created a new directory (outside this environment).

 mkdir dl 

In this I activated tensorflow

 SFOM00618927A:dl i854319$ source activate tensorflow (tensorflow) SFOM00618927A:dl i854319$ conda list 

And I can see the same list of packages in this.

Now i open jupyter notebook

 SFOM00618927A:dl i854319$ source activate tensorflow (tensorflow) SFOM00618927A:dl i854319$ jupyter notebook 

He opens a new notebook in the browser. But when I just import the basic Python libraries like pandas into it, it says "there are no packages available." I am not sure why, when the same environment has all these packages and in the same directory, if I use the Python interpreter, it shows all the packages.

 import pandas --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) <ipython-input-4-d6ac987968b6> in <module>() ----> 1 import pandas ModuleNotFoundError: No module named 'pandas' 

Why doesn't the Jupyter laptop pick up these modules?

So Jupyter laptop does not show env as a translator

enter image description here

+14
python tensorflow jupyter-notebook keras
source share
10 answers

I came up with your case. This is how I sort it

  • Install Anaconda
  • Creating a virtual environment - conda create -n tensor flow
  • Enter your virtual environment - Source activate tensorflow
  • A tensor is used inside this setup. You can install it with pip
  • Complete installation

So the following when you run it:

  1. If you are not inside a virtual environment - Source Activate Tensorflow
  2. Then inside this, re-install your Jupiter notebook and Pandas libraries, because in this virtual environment there may be

Inside the virtual environment, simply type:

  1. pip install jupyter notebook
  2. pip install pandas

Then you can run jupyter notebook saying:

  1. jupyter notebook
  2. Choose the correct python 3 or 2 terminal
  3. Then import these modules
+24
source share
  • Install Anaconda
  • Run Anaconda Command Prompt
  • write "activate tensor flow" for windows
  • pip install tensorflow
  • pip install jupyter notebook
  • notepad jupyter.

Only this solution worked for me. Tried 7 8 solutions. Using the Windows platform.

+6
source share

I believe that a short video showing all the details, if you have Anaconda for Mac (this is very similar to Windows users), just open the Anaconda navigator and everything will be the same (almost!)

https://www.youtube.com/watch?v=gDzAm25CORk

Then go to jupyter notebook and code

 !pip install tensorflow 

Then

 import tensorflow as tf 

This works for me! :)

+4
source share
  1. set the flow tensor by executing these commands in the anoconda shell or in the console:

     conda create -n tensorflow python=3.5 activate tensorflow conda install pandas matplotlib jupyter notebook scipy scikit-learn pip install tensorflow 
  2. close the console, open it again and enter the following commands:

     activate tensorflow jupyter notebook 
+2
source share

I would suggest starting Jupyter lab / notebook from your base environment and choosing the right kernel.

How to add a conda environment to jupyter lab should contain the information needed to add a kernel to your base environment.

Disclaimer: I asked a question in a topic that I related, but I feel that this also solves your problem.

+2
source share

For Anaconda users on Windows 10 and those who recently updated the Anaconda environment, TensorFlow may cause some problems to activate or initiate. Here is a solution that I learned and that worked for me:

  • Remove the current Anaconda environment and remove all existing Anaconda-related files from your C: \ Users or wherever you install it.
  • Download Anaconda ( https://www.anaconda.com/download/?lang=en-us#windows )
  • When installing, check the box next to "Add Anaconda to my PATH environment variable"
  • After installation, open the Anaconda command prompt to install TensorFlow using the following steps:
  • Create a conda environment called tensorflow by calling the following command:

    conda create -n tensorflow python = 3.5 (Use this command even if you are using python 3.6 because TensorFlow will be updated in the next steps)

  • Activate the conda environment by running the following command:

    activate tensor After this step the command line will change to (tensor flow)

  • After activation, update the tenorflow method with this command:

    pip install --ignore-installed --upgrade Now you have successfully installed the TensorFlow processor version.

  • Close the Anaconda command line and open it again and activate tensorflow using the activate tensor command.
  • Inside the tensorflow environment, install the following libraries using the commands: pip install jupyter pip install keras pip install pandas pip install pandas -datareader pip install matplotlib pip install scipy pip install sklearn
  • Your tensorflow environment now contains all the common libraries used in deep learning.
  • Congratulations, these libraries will make you ready to create deep neural networks. If you need to install more libraries using the same command 'pip install libraryname'
+1
source share

I found a pretty simple way to do this.

Initially, with Anaconda Prompt, you can perform actions on this official Tensorflow website - here . You must follow the steps as is, without deviations.

You will open Anaconda Navigator later. In Anaconda Navigator, go to the Applications section in ---. Select the drop-down list, after completing the above steps you should see a tenorflow entry in it. Select the flow tensor and let the medium load.

Then select the Jupyter Notebook in this new context and install it to complete the installation.

After that, you can run Jupyter notepad, like a regular notepad in tenorflow.

+1
source share

You will need to add a β€œcore” for it. Run your environment:

 >activate tensorflow 

Then add the kernel by command (after --name your environment with tenorflow should follow):

 >python -m ipykernel install --user --name tensorflow --display-name "TensorFlow-GPU" 

After that, run jupyter notepad from your application.

 >jupyter notebook 

And then you will see the following enter image description here

Click on it and then import the packages in notepad. It will work for sure.

0
source share

It is better to create a new environment with a new name ($ newenv): conda create -n $newenv tensorflow

Then, using the anaconda navigator on the environment tab, you can find newenv in the middle column.

By clicking on the play button, open a terminal and type: activate tensorflow

Then set the flow tensor inside newenv by typing: pip install tensorflow

Now you have the tensor stream inside the new environment, so install jupyter by typing: pip install jupyter notebook

Then just type: jupyter notebook to start jupyter notebook.

Inside Jupyter laptop type: import tensorflow as tf

You can use THIS LINK to check the TF

0
source share

Although it took a long time after this question was asked, since I searched so much for the same problem and could not find the existing solutions useful, I write that fixed my problem for those who had the same problem: The thing is that Jupiter must be installed in your virtual environment, that is, after activating the tensorflow environment, tensorflow following at a command prompt ( in the tensorflow virtual environment ):

 conda install jupyter jupyter notebook 

and then jupiter will pop up.

0
source share