Anaconda

From Wildsong
Revision as of 20:15, 14 May 2017 by Brian Wilson (talk | contribs)
Jump to navigationJump to search

My main interest in Anaconda is trying out ArcGIS with Jupyter notebook. With ARcGIS Pro 1.4 this turns out to be very easy. Time to stop using ArcMap.

I installed Anaconda on Plover first, I have not used it there. (I can't access the ESRI ArcPy module from OS/X.)

I learned about using Jupyter notebook by watching an ESRI video, "ArcGIS API for Python: Advanced Scripting".

Installation

Mac

5-13-17 Installing on Plover

I chose to install for "just me" in the hopes I can keep it contained; I am used to using "brew" to maintain Python in my Mac. It says it will put everything (1.4 GB) in Anaconda3/ in my home folder. It lied, actually it created anaconda/ and AnacondaProjects. It also added itself in .bash_profile PATH, I removed it because I am only doing a bit of testing here. Anaconda understands and uses virtualenv as much as I can these days so it should not need to stomp over existing settings.

I am doing this today because I read about ESRI embracing Juptyer notebook, and the Jupyter people say installing Anaconda is the best way to get Jupyter on a Mac.

Then I will have to look at whether I need it in the virtual machines I run to use ESRI ArcGIS.

I am not putting Anaconda onto Stellar, because alas Apple won't update the operating system for her and Anaconda warns against using old versions of OS/X.

Windows + ArcGIS 10.5

Read this before plunging into the Anaconda installer. https://my.usgs.gov/confluence/pages/viewpage.action?pageId=540116867

Why install 32-bit Anaconda? So that you can use the Anaconda environment to add and maintain python packages. Arguably you could replace the entire ESRI Python with Anaconda Python but I don't suggest doing this.

Why install 64-bit Anaconda? Same reason, but also so that you can work in a completely up to date and snazzy Anaconda environment that has acess to the ESRI python modules (and therefore all of the ESRI ecosystem.)

I installed Anaconda in the VM that I use for ArcGIS Desktop, so that I can try Jupyter with ArcGIS.

NB:

  • I installed both the 32- and 64-bit versions, so that I can use both ArcMap and geoprocessing.
  • I put the 32-bit version in ~/Anaconda3 and the 64-bit version in ~/Anaconda64
  • I told it NOT to modify my PATH and NOT to change the registry, so that the versions already installed by ESRI will continue to work.
  • I installed for "Just me" because I am the only one who ever uses this computer.

I never double-click py files to run them so I don't need to change the registry.

You can launch an "Anaconda prompt" and type DOS commands or (I have GIT installed) start a git bash shell and type

cd /c/Users/bwilson/Anaconda3
./Scripts/conda update conda
./Scripts/conda create -n arc105 python=2.7.12 matplotlib=1.5.3  scipy=0.18.1 pandas pyparsing xlrd xlwt ipython
cd /c/Users/bwilson/Anaconda64
./Scripts/conda update conda
./Scripts/conda create -n arc105 python=2.7.12 matplotlib=1.5.3  scipy=0.18.1 pandas pyparsing xlrd xlwt ipython

I tried installing the versions recommended by USGS but ended up using some that are newer. I won't know if this works until I try it.

Once you have followed all the instructions you should be able to launch an "Anaconda prompt" (either 32 or 64 bit), and then load the arcpy module. If this works, you can now use ArcPy in your Anaconda environment.

The version of Python that launches from ArcGIS will be the same one ESRI installed but it will have access to packages that you install in the arc105 environment in Anaconda because if the 'zconda.pth' file. Naming it with a 'z' means it loads last and therefore most packages (like scipy and numpy) load from the ESRI directory and only things you have added come from Anaconda.

USGS missed only one item in there-- the 32-bit pth file to copy is Desktop.pth but the 64-bit file is DTBGGP64.pth which I assume stands for "DeskTop BackGround GeoProcessing 64-bit".

Windows + ArcGIS Pro 1.4

With AGP 1.4, ESRI installs python3 and conda for you.

Somewhere they probably even tell you how to use it. Since conda is installed I should be able to install the other components, right?

Launch a Python prompt from Start menu as administrator and then I can use conda to install packages.