Reputation: 51
MacBook laptop
Have activated py27 in the terminal. When I tried to run jupyter notebook
, it returned:
bash-3.2$ source activate py27
(py27) bash-3.2$ jupyter notebook
Traceback (most recent call last):
File "/Users/xx/anaconda3/envs/py27/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/Users/xx/anaconda3/envs/py27/lib/python2.7/site-packages/notebook/__init__.py", line 25, in <module>
from .nbextensions import install_nbextension
File "/Users/xx/anaconda3/envs/py27/lib/python2.7/site-packages/notebook/nbextensions.py", line 31, in <module>
from .config_manager import BaseJSONConfigManager
File "/Users/xx/anaconda3/envs/py27/lib/python2.7/site-packages/notebook/config_manager.py", line 15, in <module>
from traitlets.config import LoggingConfigurable
File "/Users/xx/anaconda3/envs/py27/lib/python2.7/site-packages/traitlets/config/__init__.py", line 6, in <module>
from .application import *
File "/Users/xx/anaconda3/envs/py27/lib/python2.7/site-packages/traitlets/config/application.py", line 17, in <module>
from decorator import decorator
File "/Users/xx/anaconda3/envs/py27/lib/python2.7/site-packages/decorator.py", line 162
print('Error in generated code:', file=sys.stderr)
^
SyntaxError: invalid syntax
(py27) bash-3.2$
How to solve this? Is it impossible to run python 2.7 in Jupyter right now?
Upvotes: 5
Views: 1474
Reputation: 61
I had the same issue.
from decorator import decorator
File "/home/hamza/miniconda3/envs/py27/lib/python2.7/site-packages/decorator.py", line 162
print('Error in generated code:', file=sys.stderr)
^
SyntaxError: invalid syntax
I found that the installed "decorator" version (in my case decorator-5.1.0, i guess it was automatically installed with jupyter by conda) requires a Python>=3.5, while I had python 2.7.
all I did is reinstall decorator package to fit py27:
pip uninstall decorator
Successfully uninstalled decorator-5.1.0
pip install decorator
Successfully installed decorator-4.4.2
Upvotes: 6