I installed the Python3.4 version of IPython and Ipython notebook with
sudo port install py34-ipython
sudo port install py34-notebook
Currently I am using Python 3.4.3 as my version of Python3.
If I use ipython3 notebook
, the web browser pops up. If I try to open up a new notebook however, the kernel immediately shuts down.
$ipython3 notebook
[W 18:02:47.712 NotebookApp] ipywidgets package not installed. Widgets are unavailable.
[I 18:02:47.727 NotebookApp] Serving notebooks from local directory: /Users/MYNAME
[I 18:02:47.727 NotebookApp] 0 active kernels
[I 18:02:47.727 NotebookApp] The IPython Notebook is running at: http://localhost:8888/
[I 18:02:47.727 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 18:03:27.826 NotebookApp] Creating new notebook in
[W 18:03:28.518 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20151208180247 (::1) 9.24ms referer=http://localhost:8888/notebooks/Untitled67.ipynb?kernel_name=python3
[I 18:03:28.693 NotebookApp] Kernel started: bccd5587-5da7-47a3-9c8f-90947b4140eb
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 151, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 118, in _get_module_details
return _get_module_details(pkg_main_name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 104, in _get_module_details
spec = importlib.util.find_spec(mod_name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/util.py", line 86, in find_spec
parent = __import__(parent_name, fromlist=['__path__'])
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ipykernel/connect.py", line 17, in <module>
import jupyter_client
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/jupyter_client/__init__.py", line 7, in <module>
from .manager import KernelManager, run_kernel
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/jupyter_client/manager.py", line 32, in <module>
from .session import Session
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/jupyter_client/session.py", line 48, in <module>
from zmq.eventloop.ioloop import IOLoop
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/__init__.py", line 3, in <module>
from zmq.eventloop.ioloop import IOLoop
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/ioloop.py", line 35, in <module>
from tornado.ioloop import PollIOLoop, PeriodicCallback
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/ioloop.py", line 57, in <module>
import thread # py2
File "/Users/MYNAME/thread.py", line 10
print old, new
^
SyntaxError: Missing parentheses in call to 'print'
[I 18:03:31.692 NotebookApp] KernelRestarter: restarting kernel (1/5)
The file /Users/MYNAME/thread.py
is in Python 2 syntax.
Change to a different directory or remove this file or change the name of this file. Then start the notebook server again. The name thread.py
shadows that of a standard library module in Python 2. IPython runs with Python 2 and 3 with the same source code and imports the wrong file.