Opened 8 years ago

Last modified 8 years ago

#49942 new defect

Problem using IPython3 notebook

Reported by: jianguohsiang82@… Owned by: stromnov (Andrey Stromnov)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc: lpsinger (Leo Singer), seanfarley (Sean Farley)
Port: py-notebook

Description

Using python3 version 3.4.4, I downloaded py34-ipython and py34-notebook using

  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. Are the dependencies clashing with my other ipython notebook install with macports for Python 2.7? How can I solve this?

 $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)

Change History (5)

comment:1 Changed 8 years ago by stromnov (Andrey Stromnov)

You can try to rename "/Users/MYNAME/thread.py" to another name to prevent shadowing.

comment:2 in reply to:  1 Changed 8 years ago by jianguohsiang82@…

Replying to stromnov@…:

You can try to rename "/Users/MYNAME/thread.py" to another name to prevent shadowing.

What should I rename it?

Both version2 and version 3 of ipython notebook should run in the same directory, correct? So I need to be careful what I rename this file....

comment:3 in reply to:  1 Changed 8 years ago by jianguohsiang82@…

Replying to stromnov@…:

You can try to rename "/Users/MYNAME/thread.py" to another name to prevent shadowing.

Can I just remove this file entirely?

comment:4 Changed 8 years ago by stromnov (Andrey Stromnov)

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

It's a "name clash" - for some reason your python interpreter imports thread.py from local dir (/Users/MYNAME/thread.py), instead of system one. You can try to run ipython notebook from another directory or adapt import paths.

http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html#the-name-shadowing-trap

PS. Yes, you can remove this file entirely, but it can break your local scripts.

comment:5 Changed 8 years ago by mf2k (Frank Schima)

Cc: stromnov@… removed
Owner: changed from macports-tickets@… to stromnov@…
Port: py-notebook added

In the future, please fill in the Port field and Cc the port maintainers (port info --maintainers py34-notebook), if any.

Note: See TracTickets for help on using tickets.