Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arcpy needs to run within active ArcGIS Conda Environment #72

Closed
cyrusblankinship opened this issue Dec 21, 2016 · 3 comments
Closed

Arcpy needs to run within active ArcGIS Conda Environment #72

cyrusblankinship opened this issue Dec 21, 2016 · 3 comments

Comments

@cyrusblankinship
Copy link

My issue started the same as #10, where it was saying

Widget Javascript not detected. It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension

I uninstalled and reinstalled both packages

conda uninstall -c conda-forge ipywidgets
conda uninstall -c esri arcgis

conda install -c conda-forge ipywidgets
conda install -c esri arcgis
jupyter nbextension enable --py --sys-prefix widgetsnbextension

but that made everything worse. I am now getting an error saying

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.

@rohitgeo
Copy link
Contributor

It appears that you've installed arcgis package in arcgispro-py3 environment using proenv.bat/Python Command Prompt window within ArcGIS Pro, but the notebook server has been started in a different conda environment.

Can you try restarting Jupyter notebook from within the proenv.bat/Python Command Prompt window in ArcGIS Pro?

@scw
Copy link

scw commented Dec 22, 2016

Hello @cyrusblankinship,

Unfortunately the instructions in the other thread are out of date and using conda-forge is known to cause some issues. We've resolved this problem for the next release of Pro, but that doesn't help you now. A couple of options:

  1. If you're comfortable editing code, open the file:

<Pro installation directory>\Resources\ArcPy\arcpy\__init__.py

and change line 31, which currently reads:

if not "Continuum" in sys.version:

to instead read:

if not "Continuum" in sys.version and not "conda-forge" in sys.version:

That will allow "conda-forge" to pass muster as a provider of a Python installation. (We added this check to prevent some complicated cases that will cause crashes with mixing Python installs).

  1. The less technical solution is to entirely delete Pro, remove any remaining directories and files in the <Pro install>\bin\Python directory (which will have been modified by installing via conda-forge), and then installing Pro again. Finally, then use the instructions provided in the documentation which should boil down to opening proenv.bat and then running:

conda install -c esri arcgis

From the prompt.

@cyrusblankinship
Copy link
Author

@scw, I followed the second option and it worked. Thank you both for the detailed description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants