Anaconda: Difference between revisions
Brian Wilson (talk | contribs) mNo edit summary |
Brian Wilson (talk | contribs) |
||
Line 54: | Line 54: | ||
=== Windows + ArcGIS 10.5 === | === Windows + ArcGIS 10.5 === | ||
Read this ''before'' plunging into the Anaconda installer. https://my.usgs.gov/confluence/ | Read this ''before'' plunging into the Anaconda installer. | ||
https://my.usgs.gov/confluence/display/EGIS/Using+Anaconda+modules+from+the+ESRI+python+environment | |||
'''Why install 32-bit Anaconda?''' So that you can use the Anaconda environment to add and maintain python packages. | '''Why install 32-bit Anaconda?''' So that you can use the Anaconda environment to add and maintain python packages. | ||
Line 62: | Line 63: | ||
environment that has acess to the ESRI python modules (and therefore all of the ESRI ecosystem.) | environment that has acess to the ESRI python modules (and therefore all of the ESRI ecosystem.) | ||
I installed | I installed Anaconda2 in the VM that I use for ArcGIS Desktop | ||
NB: | NB: | ||
* I installed both the 32- and 64-bit versions, so that I can use both ArcMap and geoprocessing. | * 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 | * I put the 32-bit version in Miniconda2_32 and the 64-bit version in Miniconda2_64 | ||
* 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 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 installed for "Just me" because I am the only one who ever uses this computer. | ||
Line 72: | Line 73: | ||
I never double-click py files to run them so I don't need to change the registry. | I never double-click py files to run them so I don't need to change the registry. | ||
In each environment then | |||
conda update conda | |||
ARCLIST="python=2.7.13 numpy matplotlib=1.5.3 scipy=0.17.0 pandas pyparsing xlrd xlwt console_shortcut" | |||
conda install -n arc1051 $ARCLIST spyder | |||
conda install -n arc1051x64 $ARCLIST spyder | |||
source activate arc1051 | |||
Once you have followed all the instructions you should be able to launch an "Anaconda prompt" (either 32 or 64 bit), | Once you have followed all the instructions you should be able to launch an "Anaconda prompt" (either 32 or 64 bit), | ||
Line 88: | Line 86: | ||
The version of Python that launches from ArcGIS will be the same one ESRI installed but it will have access to packages that | 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 | you install in the arc1051 environment in Anaconda because of 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 | 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 |
Revision as of 06:27, 21 July 2017
Don't install Anaconda, it's very big, install miniconda then add the packages you will actually use. Here is the Miniconda download page.
When I refer to "Anaconda" please keep in mind I am really talking about miniconda. Anaconda is convenient if you want to do one giant install and have most everything you need.
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. ha ha ha ha
I installed Anaconda on Plover first, I can't access the ESRI "ArcPy" module from OS/X but I can use the "ArcGIS" module. ArcPy is for desktop GIS work. ArcGIS is for talking to ArcGIS Online.
I learned about using Jupyter notebook by watching an ESRI video, "ArcGIS API for Python: Advanced Scripting". I like the idea of cells and being able to visualize data directly (like displaying a dataset on a map) but at the moment I am learning to use spyder instead.
Running this code in spyder generates an error about javascript. Running it in jupyter generates a map, because it will send javascript to your browser.
from arcgis.gis import GIS g = GIS() g.map()
Installation
Linux
2017-Jul-09 Laysan Ubuntu. Installed miniconda3, then "conda3 install spyder" and "conda3 install -c esri arcgis"
Mac
5-13-17 Installing on Plover
Download the Miniconda installation shell script and run it. Say "yes" to modifying your PATH.
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.
Create an environment for doing GIS work, thus keeping all the modules contained.
conda create -n gis source activate gis conda install spyder conda install gdal # this installs python 3.5, 3.6 is not supported yet conda install -c esri arcgis # this installs ESRI's python api module, "arcgis".
When you do 'which spyder' it should show the one installed in the gis environment, for me it's
/Users/bwilson/miniconda3/envs/gis/bin/spyder
Installing spyder inside the "gis" environment avoids having to mess around with settings.
Installing spyder also installs jupyter.
Windows + ArcGIS 10.5
Read this before plunging into the Anaconda installer. https://my.usgs.gov/confluence/display/EGIS/Using+Anaconda+modules+from+the+ESRI+python+environment
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 Anaconda2 in the VM that I use for ArcGIS Desktop
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 Miniconda2_32 and the 64-bit version in Miniconda2_64
- 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.
In each environment then
conda update conda ARCLIST="python=2.7.13 numpy matplotlib=1.5.3 scipy=0.17.0 pandas pyparsing xlrd xlwt console_shortcut" conda install -n arc1051 $ARCLIST spyder conda install -n arc1051x64 $ARCLIST spyder
source activate arc1051
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 arc1051 environment in Anaconda because of 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.
https://geonet.esri.com/groups/arcgis-python-api/blog/2017/02/08/arcgis-api-for-python-101-released
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. For example, this installs the new web API "arcgis" not to be confused with "arcpy".
conda install -c esri arcgis
This one one way, it is still possible to install Anaconda separately if you want.