harnessing the power of python in arcgis using the conda...

38
Harnessing the Power of Python in ArcGIS Using the Conda Distribution Shaun Walbridge Clinton Dow

Upload: others

Post on 20-May-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

HarnessingthePowerofPythoninArcGISUsingtheCondaDistributionShaunWalbridge

ClintonDow

Page 3: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

Conda

Page 4: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

GettingtoPackages

Page 5: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

WhyPackages?Softwareiscomposedofmanysmallercomponents,oftencalledpackagesorlibraries.It’softenbettertoreusecodethatsolvesaproblemwellratherthanrecreatingitBut,sharingcodeisahardproblem.Doyouhavethesamepackagesofthesameversionsasthedeveloperdid?

Page 6: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

PackageManagementforPython

Whynotpip,wheels,virtualenvs?

Don’thandletheharderproblemofsystemdependencies,consideredoutofscopebyPythonpackagers–doesitendupinsite-packages?Packagedevs:OnOSXandLinux,‘easy’togetthedeps!Useasystempackagemanager(e.g.apt,brew,yum)andtheincludedcompiler(e.g.clang,gcc).It’sstillnoteasytomakereproduciblebuilds,andwhataboutthatotherplatform?

Page 7: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

WhyConda?

ScientificPythoncommunityidentifiedthattherewasagapnotbeingaddressedbythecorePythoninfrastructure,limitingtheirabilitytogetpackagesintothehandsofusers

Industrystandardbuiltbypeoplewhocareaboutthisspace—ContinuumAnalytics

Page 8: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

WhyConda?

Itsolvesthehardproblem:

HandlesdependenciesformanylanguagesBuiltforPythonfirst,butitreallysolvesamuchbroaderinfrastructuralissue.

Gatewaytodatascience—scientific,analytics,integratedsoftwareecosystemfororganizations

Page 9: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

Interlude:ReviewingReviews

Page 10: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

ReviewingReviews

Page 11: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

ReviewingReviewsscore=(ratings.sum(axis=1)+inverse_ratings.sum(axis=1)*5)"""104130.0103430.0103629.0103927.0103826.0103726.0104025.0104224.0103515.0"""#1035,let'sseeiftheyleftusacommentdf_conda.loc[1035]['Comments']

Therewasnorealbasicexplanationofwhatcondadoes…justapackageandenvmanager.

Page 12: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

ReviewingReviewsIfyoudon’tagreewithsomeone,trywalkingamile

intheirshoes…

…becausethenyou’llbeamileawayfromthem,andyou’llhavetheirshoes.—TerryPratchett

Page 13: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS
Page 14: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

Fundamentals

Page 15: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

FundamentalsConsistentbuildingofpackages(Windows,Linux,MacOS),publicandprivatesharingCrossplatform,andcross-langauge—handlesC/C++,R,Java,Scala,JavascriptandmanymoreUltimatelyrealizedasacollectionoffilesinanarchive,andruleswhichdictatepackagedependenciesOpensource:Esriisusingit,youcanuseitinyourownprojectsforothercontexts

Page 16: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

Environments—AcollectionofpackagesandPythoninstalliscalledanenvironment,thebuildingblockformanagingPythonwithCondaFlexiblymakechangeswithoutaffectinginstalledsoftwareCancreatemultipleenvironmentsandswitchseamlessly

Requirements—includeexplicitstateinformation,notjustthepackagename.

Page 17: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

WheredoIgetpackages?Condapackagescancomefromavarietyoflocations:

PublicrepositorieshostedonPublicrepositoriesself-hostedPrivaterepositories

OndiskChannels—

AcollectionofpackagesownedbyauserororganizationConfigureCondatolookattheselocations(.condarcfile)

AnacondaCloud

AnacondaEnterprise

Page 18: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

Demo:UsingPackages

Page 19: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

CondaBasicsActivatingenvironments,acoupleways:

UsetheshortcutsincludedinProManuallyactivatetheenvironment:

cdC:\ArcGIS\bin\Python\Scriptsactivatearcgispro-py3

Page 20: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

CondaBasics

Condainfoisthestartingpoint—ittellsyouthestateoftheenvironment.

conda--help

condainfo

Page 21: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

CondaBasicscondalist

#packagesinenvironmentatC:\ArcGIS\bin\Python\envs\arcgispro-py3:#colorama0.3.7py35_0defaultscycler0.10.0py35_0defaultsfuture0.15.2py35_0defaultsmatplotlib1.5.3np111py35_0e[arcgispro]esrimpmath0.19py35_1defaultsnetcdf41.2.4py35_0e[arcgispro]esrinose1.3.7py35_1defaultsnumexpr2.6.1np111py35_0e[arcgispro]esrinumpy1.11.2py35_0e[arcgispro]esripandas0.19.0np111py35_0defaultspip8.1.2py35_0defaultspy1.4.31py35_0defaultspyparsing2.1.4py35_0defaultspypdf21.26.0py_0esripytest2.9.2py35_0defaultspython3.5.20defaultspython-dateutil2.5.3py35_0defaultspytz2016.6.1py35_0defaultsrequests2.11.1py35_0defaultsscipy0.18.1np111py35_0e[arcgispro]esrisetuptools27.2.0py35_1defaultssympy1.0py35_0defaultswheel0.29.0py35_0defaults

Page 22: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

DeeperDive

Page 23: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

CondaPackagingOK,sohowdowemakeanewpackage?

whichdescribestheinstructionstobuildthesoftware

WheredoIgetthecode?Whatarewebuilding,andwhatdoesitdependon?Runcondabuildtocreateapackagefromthisrecipe

Createarecipe

Page 24: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

CondaPackagingmeta.yaml

package:name:conda-devsummit-2017-talkversion:"1.0"

source:git_url:https://github.com/scw/conda-devsummit-2017-talk.git

requirements:run:-python-scikit-learn

Page 25: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

CondaPackagingBuildthepackage:

Uploadandshare:

condabuildc:\example\mypackage

anacondauploadmypackage

Page 26: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

Demo:CondaPackaging

Page 27: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

PythonPackageManager

Page 28: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

HowcanIusethis?WealreadyshipyoutheSciPystack—powerfulandoutoftheboxinallproductsCondacommandandaCondarootPythoninstallNewmodules(e.g.requests),environmentwithPro

PythonPackageManagerinProGetpackages,expandyourpossibilityspacePackageyourwork:thisisanopportunitytodistributeit

Page 29: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

WhereCanIRunThis?

ArcGISPro1.3CondaisthePythoninstall,includedforall

ArcGISPro1.4PythonPackageManagerPython3.5withcurrentpackageset

ArcGISEnterprise10.5ArcGISAPIforPython

Page 30: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

fromfutureimport*ArcGISPro2.0:

ManageenvironmentsandchannelsResettableenvironment“μConda”

Page 31: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

Resources

Page 32: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

OtherSessionsWeds4:00PM,SanJacinto

Weds4:00,DemoTheater1

Weds4:30PM,DemoTheater1

Thurs10:30AM,MesquiteG-H

GettingDataSciencewithRandArcGIS

DeployingYourGeoprocessingToolsasPythonModules

PythonPackageManagementUsingConda

ContinuumAnalytics:ExploringContinuumAnalytics’Open-SourceOfferings

Page 33: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

Condavs…Name Means Included?

Thecommanditself ✓AminimumsetofPythonpackagestobuildandrunConda.

Adistribution200+packagesandrunConda

Self-hosted,distributedandHPCadditions

Conda

Miniconda

Anaconda

AnacondaWorkgroup

Page 35: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

Closing

Page 36: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

ThanksEsriCondaTeam:

ContinuumAnalyticsforcreatingandopensourcingConda

Page 37: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS

RateThisSessioniOS,Android:Feedbackfromwithintheapp

Bewarnedthatwemayincorporatefeedbackintonextyear’ssession

Page 38: Harnessing the Power of Python in ArcGIS Using the Conda Distributionproceedings.esri.com/library/userconf/devsummit17/papers/dev_int_49.pdf · Getting Data Science with R and ArcGIS