103

I am new to Python to bear with me.

  1. I installed Anaconda, works great.
  2. I setup a Python 3 environment following the Anaconda cmd line instructions, works great.
  3. I setup Anaconda's Python 3 environment as Pycharm's interpreter, works great.
  4. I launched the Anaconda "launcher.app" and launched IPython Notebook. However, iPython Notebook is running Python 2 not 3.

Over three hours of Googling later, I cannot figure out how to set IPython Notebook to run Python 3 instead of 2.

3
  • 1
    You need to launch it from your Python 3 environment. That's easy at a command line (/path/to/env/bin/ipython), but I don't know how to do it from the Anaconda GUI launcher. Commented Dec 3, 2013 at 22:19
  • 2
    Awesome. Thanks. For future searchers, here was the solution: export PATH=/Users/[insertusername]/anaconda/envs/py3k/bin:$PATH ipython notebook Commented Dec 3, 2013 at 22:28
  • 4
    SO should let you answer your own question after a while, so it's clear from search results that it was resolved. Commented Dec 4, 2013 at 19:30

9 Answers 9

112

To set IPython Notebook to run Python 3 instead of 2 on my MAC 10.9, I did the following steps

$ sudo pip3 install ipython[all]

Then

$ ipython3 notebook

Sign up to request clarification or add additional context in comments.

2 Comments

You shouldn't ever have to use sudo with pip (or pip3)
Why [all] on the end? pip3 install ipython worked for me.
17

For linux 16.04 Ubuntu you can use

sudo apt-get install ipython3

and then use

ipython3 notebook

to open the notebook in the browser. If you have any notebooks saved with python 2 then it will automatically convert them to Python 3 once you open the notebook.

Comments

6

To use jupyter with python 3 instead of python 2 on my Windows 10 with Anaconda, I did the following steps on anaconda prompt:

pip3 install ipython[all]

Then,

ipython3 notebook

Comments

4

Is there a package from your distro? If you're using ubuntu you must to install the ipython3-notebook package. If not, maybe you must to install ipython with python3.

If you've run (because it's python2 by default)

python setup.py

you must to run instead

python3 setup.py install

to install a package with python3 instead python2. This will be a new instalation of ipython3.

Comments

1

In Anaconda "launcher.app" there is “Environment:” pull down menu. The default environment is called "root". In order to launch application using another environment, just select the desired environment from the list, to make it active.

Comments

1

If you are running anaconda, then the preferred way to install notebook/jupyter is using conda:

conda install jupyter

Comments

0

If you have both version available on jupyter notebook, you can change the kernel from menu.

Comments

0

Switch the role of 2 and 3 in this answer as appropriate.

Say you already have jupyter setup with a python 2 kernel and an anaconda environment with python 3. Activate the python 3 enviroment and then run

conda install ipykernel

After that you can select both a 2 and 3 kernel when creating a new notebook, or in a running notebook from the kernels menu.

Comments

-5

Another solution would be to create a virtualenv with python3:

From this environment, install tensorflow (the version you prefer) there:

pip install tensorflow

Run your jupyter from there !

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.