I have installed ArcGIS Pro 1.3 and Anaconda 4.2.0 (in that order). I then followed the instructions from ESRI on Adding the ArcPy Path to Anaconda which made Jupyter find the arcpy module but I get error:

>>import arcpy

arcpy must be run from inside the Conda environment, which ArcGIS
uses to manage the installation of Python.
You can access this environment by launching Python from the links inside the
"ArcGIS > ArcGIS Pro" Start Menu Group:
    "Python Interactive Terminal" starts a Python session.
    "Python Command Prompt" opens a Command Prompt window initialized with Conda.

Or by running the proenv.bat file in the terminal:
     C:\> C:\Program Files\ArcGIS\Pro\bin\python\scripts\proenv.bat 

ImportError                               Traceback (most recent call last)
<ipython-input-1-50d283eebbb3> in <module>()
----> 1 import arcpy

C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py in <module>()
     62 """.format(install_dir)
     63     print(msg)
---> 64     raise ImportError("arcpy needs to run within an active ArcGIS Conda environment")
     66 from arcpy.geoprocessing import gp

ImportError: arcpy needs to run within an active ArcGIS Conda environment

How can I get ArcPy to work in Jupyter Notebook?


This is how i got it to work on a new computer (i did not know of ArcGIS Package Manager when i did this):

  1. Install ArcGIS Pro (i use version 2.0.1) in a folder so the path have no whitespaces, for example C:\Program123\ArcGIS
  2. Start windows cmd prompt. Navigate to C:\Program123\ArcGIS\Pro\bin\Python\envs\arcgispro-py3 (using cd Program123 etc...)
  3. Execute the commands below in this folder (the python.exe is located here)
  4. python -m pip install --upgrade pip
  5. python -m pip install jupyter
  6. Reboot
  7. I then have to start it with C:\Program123\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Scripts\jupyter-notebook.exe

I can now use arcpy from jupyter

  • I am still getting the same error after this. Are you using Anaconda2? – juturna Jun 8 '17 at 21:31
  • If you're using ArcGIS Pro, why are you using pip to install jupyter? Did you try installing via conda or the ArcGIS Pro Python Package Manager? Works for me and is a bit more integrated. – user2856 Nov 16 '17 at 0:51
  • @Luke, I did not know ArcGIS Pro Python Package Manager existed. Nice! – BERA Nov 16 '17 at 6:39
  • 1
    And by 'integrated' I wasn't specifically referring to the ArcGIS Package Manager, but to conda more generally. You should avoid installing packages into conda environments unless you really need to, i.e your package isn't available via the default conda repository (or additional channels like conda-forge). And note that what you have done in your first attempt (pre your recent edit) is install jupyter into your root conda environment, not your arcgis-pro environment. You really shouldn't do that. – user2856 Nov 17 '17 at 0:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.