Select to view content in your preferred language

Problem installing Jupyter Notebook and ArcGIS Python API after Mac OSX 10.12.5 update, Syntax Errors!

2993
10
07-14-2017 02:43 PM
LarrySpear
Occasional Contributor

Anaconda Navigator installed OK. Jupyter Notebook Launch from Navigator and Terminal ("Jupyter-notebook") gets syntax errors. Also from Terminal ("conda install -c esri arcgis") gets syntax errors. Is the problem with latest OSX update 10.12.5?

0 Kudos
10 Replies
by Anonymous User
Not applicable

Can you paste your error message? It would be easier to see what is going on.

As to support for OSX 10.12.5, my Mac runs this version and I do not have any issues.

0 Kudos
LarrySpear
Occasional Contributor

Hi Atma, Here are my error messages. Any help appreciated!

For Jupyter Notebook:

Larrys-Mac-mini-3:~ lspear$ jupyter notebook

Traceback (most recent call last):

File "/Users/lspear/anaconda/bin/jupyter-notebook", line 6, in

import pygments

File "/Applications/QGIS.app/Contents/Resources/python/pygments/__init__.py", line 46

except TypeError, err:

^

SyntaxError: invalid syntax

For arcgis:

Larrys-Mac-mini-3:~ lspear$ conda install -c esri arcgis

Fetching package metadata ...........

Solving package specifications: .

Package plan for installation in environment /Users/lspear/anaconda:

The following NEW packages will be INSTALLED:

arcgis: 1.2.0-py36_1 esri

Proceed (/n)? y

Uninstalling prior versions of arcgis widget

Traceback (most recent call last):

File "/Users/lspear/anaconda/bin/jupyter-nbextension", line 6, in

Non-degree Student URL: http://www.unm.edu/~lspear

University of New Mexico

Albuquerque, New Mexico 87131

0 Kudos
LarrySpear
Occasional Contributor

Hi Atma, My earlier reply was from email. Here is another with just specific errors.

For Jupyter Notebook:

File "/Applications/QGIS.app/Contents/Resources/python/pygments/__init__.py", line 46
    except TypeError, err:
                    ^
SyntaxError: invalid syntax

For ArcGIS:

File "/Applications/QGIS.app/Contents/Resources/python/pygments/__init__.py", line 46
except TypeError, err:
^
SyntaxError: invalid syntax

Could QGIS installed on this Mac be an issue?

0 Kudos
by Anonymous User
Not applicable

Does the error here stem from pygments library installed with QGIS? One way to isolate this is to install and use the ArcGIS API in a new conda environment. I would recommend this as long as you do not have to use both QGIS and ArcGIS in the same python environment.

0 Kudos
LarrySpear
Occasional Contributor

Atma, This is strange as I also installed Anaconda and the ArcGIS Python API on my two old Linux-Ubuntu computers

the same day and both have QGIS and work OK. I rarely use my Mac and am also new to Anaconda so not sure yet

how to run in different conda environment ( I will look this up). One possibility is to just remove QGIS on the Mac as I

also have it on PCs and Linux computers. However, I only have one Mac. Any further suggestions would be helpful.

     --Thanks!

0 Kudos
LarrySpear
Occasional Contributor

Atma, Just created a new conda environment and tried install for arcgis python api and startng jupyter notebook.

Both failed with the same error message as before. If no further suggestions I will wait awhile before removing

QGIS to see what happens.

0 Kudos
by Anonymous User
Not applicable

Can you run `conda list` from your newly created env and paste the result? That will help me figure out if you have just the arcgis library or any other libraries that might interfere. Also can you paste the full error message you get when start the notebook

0 Kudos
LarrySpear
Occasional Contributor

Atma, This are results for conda list and jupyter notebook from new environment (gisdev):

Larrys-Mac-mini-3:~ lspear$ source activate gisdev
(gisdev) Larrys-Mac-mini-3:~ lspear$ conda list
# packages in environment at /Users/lspear/anaconda/envs/gisdev:
#

(gisdev) Larrys-Mac-mini-3:~ lspear$

(gisdev) Larrys-Mac-mini-3:~ lspear$ jupyter notebook
Traceback (most recent call last):
  File "/Users/lspear/anaconda/bin/jupyter-notebook", line 6, in <module>
    sys.exit(notebook.notebookapp.main())
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/notebook/notebookapp.py", line 1290, in initialize
    super(NotebookApp, self).initialize(argv)
  File "<decorator-gen-6>", line 2, in initialize
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/jupyter_core/application.py", line 243, in initialize
    self.migrate_config()
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/jupyter_core/application.py", line 162, in migrate_config
    from .migrate import get_ipython_dir, migrate
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/jupyter_core/migrate.py", line 35, in <module>
    from IPython.paths import get_ipython_dir
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/IPython/__init__.py", line 48, in <module>
    from .core.application import Application
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/IPython/core/application.py", line 25, in <module>
    from IPython.core import release, crashhandler
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/IPython/core/crashhandler.py", line 28, in <module>
    from IPython.core import ultratb
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/IPython/core/ultratb.py", line 119, in <module>
    from IPython.core import debugger
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/IPython/core/debugger.py", line 37, in <module>
    from IPython.utils import PyColorize, ulinecache
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/IPython/utils/PyColorize.py", line 57, in <module>
    from .colorable import Colorable
  File "/Users/lspear/anaconda/lib/python3.6/site-packages/IPython/utils/colorable.py", line 13, in <module>
    import pygments
  File "/Applications/QGIS.app/Contents/Resources/python/pygments/__init__.py", line 46
    except TypeError, err:
                    ^
SyntaxError: invalid syntax
(gisdev) Larrys-Mac-mini-3:~ lspear$

0 Kudos
by Anonymous User
Not applicable

I am afraid your conda env is not correct. For instance, when I run this, I get the following:

(arcgis_v12b) ~/Documents/code/geosaurus/geosaurus [create_replica_fix] $ conda list
# packages in environment at /Users/atma6951/anaconda/envs/arcgis_v12b:
#
appnope                   0.1.0                    py35_0  
arcgis                    1.2.0                    py35_1    esri
bleach                    1.5.0                    py35_0  
decorator                 4.0.11                   py35_0  
entrypoints               0.2.3                    py35_0  
html5lib                  0.999                    py35_0  
ipykernel                 4.6.1                    py35_0  
ipython                   6.1.0                    py35_0  
ipython_genutils          0.2.0                    py35_0  
ipywidgets                6.0.0                    py35_0  
jedi                      0.10.2                   py35_2  
jinja2                    2.9.6                    py35_0  
jsonschema                2.6.0                    py35_0  
jupyter_client            5.1.0                    py35_0  
jupyter_core              4.3.0                    py35_0  
markupsafe                0.23                     py35_2  
mistune                   0.7.4                    py35_0  
mkl                       2017.0.3                      0  
nbconvert                 5.2.1                    py35_0  
nbformat                  4.3.0                    py35_0  
notebook                  5.0.0                    py35_0  
numpy                     1.13.1                   py35_0  
openssl                   1.0.2l                        0  
pandas                    0.20.2              np113py35_0  
pandocfilters             1.4.1                    py35_0  
path.py                   10.3.1                   py35_0  
pexpect                   4.2.1                    py35_0  
pickleshare               0.7.4                    py35_0  
pip                       9.0.1                    py35_1  
prompt_toolkit            1.0.14                   py35_0  
ptyprocess                0.5.1                    py35_0  
pygments                  2.2.0                    py35_0  
python                    3.5.3                         1  
python-dateutil           2.6.0                    py35_0  
pytz                      2017.2                   py35_0  
pyzmq                     16.0.2                   py35_0  
readline                  6.2                           2  
setuptools                27.2.0                   py35_0  
simplegeneric             0.8.1                    py35_1  
six                       1.10.0                   py35_0  
sqlite                    3.13.0                        0  
terminado                 0.6                      py35_0  
testpath                  0.3.1                    py35_0  
tk                        8.5.18                        0  
tornado                   4.5.1                    py35_0  
traitlets                 4.3.2                    py35_0  
wcwidth                   0.1.7                    py35_0  
wheel                     0.29.0                   py35_0  
widgetsnbextension        2.0.0                    py35_0  
xz                        5.2.2                         1  
zlib                      1.2.8                         3  

I expect to see something like above if you installed the arcgis package in that environment. In your case the list is empty. At this point, I would recommend reinstalling anaconda and the ArcGIS package.

0 Kudos