Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and...

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

Transcript of Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and...

Page 1: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

HarnessingthePowerofPythoninArcGISUsingtheCondaDistributionShaunWalbridge

ClintonDow

Page 3: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

Conda

Page 4: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

GettingtoPackages

Page 5: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

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

Page 6: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

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 ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

WhyConda?

ScientificPythoncommunityidentifiedthattherewasagapnotbeingaddressedbythecorePythoninfrastructure,limitingtheirabilitytogetpackagesintothehandsofusers

Industrystandardbuiltbypeoplewhocareaboutthisspace—ContinuumAnalytics

Page 8: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

WhyConda?

Itsolvesthehardproblem:

HandlesdependenciesformanylanguagesBuiltforPythonfirst,butitreallysolvesamuchbroaderinfrastructuralissue.

Gatewaytodatascience—scientific,analytics,integratedsoftwareecosystemfororganizations

Page 9: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

Interlude:ReviewingReviews

Page 10: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

ReviewingReviews

Page 11: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

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 ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

ReviewingReviewsIfyoudon’tagreewithsomeone,trywalkingamile

intheirshoes…

…becausethenyou’llbeamileawayfromthem,andyou’llhavetheirshoes.—TerryPratchett

Page 13: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding
Page 14: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

Fundamentals

Page 15: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

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 ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

Environments—AcollectionofpackagesandPythoninstalliscalledanenvironment,thebuildingblockformanagingPythonwithCondaFlexiblymakechangeswithoutaffectinginstalledsoftwareCancreatemultipleenvironmentsandswitchseamlessly

Requirements—includeexplicitstateinformation,notjustthepackagename.

Page 17: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

WheredoIgetpackages?Condapackagescancomefromavarietyoflocations:

PublicrepositorieshostedonPublicrepositoriesself-hostedPrivaterepositories

OndiskChannels—

AcollectionofpackagesownedbyauserororganizationConfigureCondatolookattheselocations(.condarcfile)

AnacondaCloud

AnacondaEnterprise

Page 18: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

Demo:UsingPackages

Page 19: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

CondaBasicsActivatingenvironments,acoupleways:

UsetheshortcutsincludedinProManuallyactivatetheenvironment:

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

Page 20: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

CondaBasics

Condainfoisthestartingpoint—ittellsyouthestateoftheenvironment.

conda--help

condainfo

Page 21: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

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 ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

DeeperDive

Page 23: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

CondaPackagingOK,sohowdowemakeanewpackage?

whichdescribestheinstructionstobuildthesoftware

WheredoIgetthecode?Whatarewebuilding,andwhatdoesitdependon?Runcondabuildtocreateapackagefromthisrecipe

Createarecipe

Page 24: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

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 ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

CondaPackagingBuildthepackage:

Uploadandshare:

condabuildc:\example\mypackage

anacondauploadmypackage

Page 26: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

Demo:CondaPackaging

Page 27: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

PythonPackageManager

Page 28: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

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

PythonPackageManagerinProGetpackages,expandyourpossibilityspacePackageyourwork:thisisanopportunitytodistributeit

Page 29: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

WhereCanIRunThis?

ArcGISPro1.3CondaisthePythoninstall,includedforall

ArcGISPro1.4PythonPackageManagerPython3.5withcurrentpackageset

ArcGISEnterprise10.5ArcGISAPIforPython

Page 30: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

fromfutureimport*ArcGISPro2.0:

ManageenvironmentsandchannelsResettableenvironment“μConda”

Page 31: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

Resources

Page 32: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

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 ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

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 ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

Closing

Page 36: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

ThanksEsriCondaTeam:

ContinuumAnalyticsforcreatingandopensourcingConda

Page 37: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding

RateThisSessioniOS,Android:Feedbackfromwithintheapp

Bewarnedthatwemayincorporatefeedbackintonextyear’ssession

Page 38: Harnessing the Power of Python in ArcGIS Using the Conda ... · Getting Data Science with R and ArcGIS ... Harnessing the Power of Python in ArcGIS Using the Conda Distribution Understanding