%3CLINGO-SUB%20id%3D%22lingo-sub-1416517%22%20slang%3D%22en-US%22%3EAdd%20%2F%20Manage%20libraries%20in%20Spark%20Pool%20After%20the%20Deployment%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1416517%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsynapse-analytics%2Fspark%2Fapache-spark-azure-portal-add-libraries%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EOfficial%20Document%3C%2FA%3E%20provide%20the%20guidance%20to%20add%20%2F%20manage%20libraries%20during%20the%20deployment%20in%20Apache%20Spark%20pool.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBut%20in%20this%20article%2C%20we%20are%20going%20to%20discuss%20the%20steps%2C%20how%20the%20versions%20can%20be%20upgraded%20after%20the%20deployment%20of%20the%20Apache%20Spark%20Pool.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ETo%20list%20the%20current%26nbsp%3Blibrary%20version%2C%20you%20can%20use%20below%20code%20-%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CDIV%3E%3CEM%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20import%20pip%20%23needed%20to%20use%20the%20pip%20functions%3C%2FEM%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CEM%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20for%20i%20in%20pip.get_installed_distributions(local_only%3DTrue)%3A%3C%2FEM%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CEM%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20print(i)%3C%2FEM%3E%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ETo%20change%20%2F%20upgrade%20the%20library%20values%2C%20click%20on%20the%20spark%20pool%20on%20Azure%20Synapse%26nbsp%3BAnalytics%20Workspace%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Image%201.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194297iD1EB789E8D42C801%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Image%201.png%22%20alt%3D%22Image%201.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ENavigate%20to%20%22Packages%22%20%26amp%3B%20you%20can%20find%20if%20there%20are%20any%20configurations%20files%20already%20uploaded.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Image%202.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194298i26611F25B0F835DB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Image%202.png%22%20alt%3D%22Image%202.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EUpload%20the%20%22requirement.txt%22%20file%20(in%20this%20example%2C%20we%20will%20be%20upgrading%20only%20%22pandas%22%20version)%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EDefault%20version%20(pandas%200.23.4)%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Image%204.png%22%20style%3D%22width%3A%20333px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194299iB249EF51964564A5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Image%204.png%22%20alt%3D%22Image%204.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Image%205.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194300i549785D8DA16B95B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Image%205.png%22%20alt%3D%22Image%205.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EBy%20checking%20the%20box%20%22Force%20new%20settings%20on%20the%20Apache%20Spark%20pool%20(will%20immediately%20stop%20running%20Apache%20Spark%20applications)%22%2C%20the%20configurations%20will%20apply%20to%20the%20spark%20pool%20immediately%20by%20stop%20running%20current%20applications.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EConfirm%20if%20the%20file%20is%20uploaded%20-%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Image%206.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194301iDFCA47943C30FE7D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Image%206.png%22%20alt%3D%22Image%206.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20the%20upload%20is%20completed%2C%20run%20below%20code%20in%20spark%20pool%20to%20verify%20the%20versions%20-%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3E%3CEM%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20import%20pip%20%23needed%20to%20use%20the%20pip%20functions%3C%2FEM%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CEM%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20for%20i%20in%20pip.get_installed_distributions(local_only%3DTrue)%3A%3C%2FEM%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CEM%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20print(i)%3C%2FEM%3E%3C%2FDIV%3E%0A%3CDIV%20id%3D%22lia-teaserTinyMceEditorCharithCaldera_3%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3EVersion%20Upgraded%20to%20%22pandas%201.0.1%22%20successfully%20-%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20id%3D%22lia-teaserTinyMceEditorCharithCaldera_4%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%20id%3D%22lia-teaserTinyMceEditorCharithCaldera_5%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%20id%3D%22lia-teaserTinyMceEditorCharithCaldera_6%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Image%207.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194308i62B3F9B81FF20DF4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Image%207.png%22%20alt%3D%22Image%207.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3E%3CSPAN%3EThe%20change%20can%20be%20also%20verified%20using%20the%20%22Activity%20Log%22%20by%20selecting%20the%20latest%20operations%20related%20to%20%22Create%20or%20Update%20Spark%20pools%22%20by%20checking%20the%20change%20history.%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Image%208.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194309iBF9F4AF0ED041A13%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Image%208.png%22%20alt%3D%22Image%208.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3EClick%20on%20the%20operation%20name%20%26amp%3B%20select%20%22Change%20history%20(preview)%22%20and%20then%20select%20the%20%22requirement.txt%22%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E(this%20will%20indicate%20the%20changes%20occurred)%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Image%209.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194310i936C47D2A80FAC24%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Image%209.png%22%20alt%3D%22Image%209.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Image%2010.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194311i6DAF2BA1F4A8BC2A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Image%2010.png%22%20alt%3D%22Image%2010.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1416517%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESynapse%20Administration%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESynapse%20Spark%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1450717%22%20slang%3D%22en-US%22%3ERe%3A%20Add%20%2F%20Manage%20libraries%20in%20Spark%20Pool%20After%20the%20Deployment%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1450717%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F375423%22%20target%3D%22_blank%22%3E%40CharithCaldera%3C%2FA%3E%26nbsp%3B%20Excellent%20post!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1809603%22%20slang%3D%22en-US%22%3ERe%3A%20Add%20%2F%20Manage%20libraries%20in%20Spark%20Pool%20After%20the%20Deployment%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1809603%22%20slang%3D%22en-US%22%3E%3CP%3EI've%20performed%20these%20exact%20steps%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ein%20cmd%2C%20py%20-m%20pip%20freeze%20%26gt%3B%20requirements.txt%3C%2FP%3E%3CP%3Egenerates%20requirements.txt%20in%20format%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Epandas%3D%3D1.0.4%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENavigate%20to%20workspace%26gt%3Bspark%20pools%26gt%3Bpackages%26gt%3Bupload%20packages%26gt%3Bselect%20requirements.txt%26gt%3Bselect%20force%20update%26gt%3Bupload%20successful%3C%2FP%3E%3CP%3ENavigate%20back%20to%20notebook%3C%2FP%3E%3CP%3ERun%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eimport%20pip%20%23needed%20to%20use%20the%20pip%20functions%3C%2FEM%3E%3C%2FDIV%3E%3CDIV%3E%3CEM%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20for%20i%20in%20pip.get_installed_distributions(local_only%3DTrue)%3A%3C%2FEM%3E%3C%2FDIV%3E%3CDIV%3E%3CEM%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20print(i)%3C%2FEM%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3ENote%20that%20pandas%20is%20still%20at%200.23.4%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EI've%20tried%20many%20other%20methods%20to%20try%20and%20force%20pandas%20to%20update%2C%20but%20it's%20not%20updating.%20I've%20tried%201.01%2C%201.02%2C%201.03%2C%20and%20a%20bunch%20of%20older%20versions.%20None%20of%20them%20gets%20pandas%20to%20changge%20from%200.23.4%20to%20anything%20else.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EThoughts%3F%3C%2FDIV%3E%3C%2FLINGO-BODY%3E
Microsoft

The Official Document provide the guidance to add / manage libraries during the deployment in Apache Spark pool. 

But in this article, we are going to discuss the steps, how the versions can be upgraded after the deployment of the Apache Spark Pool. 

 

  • To list the current library version, you can use below code -
          import pip #needed to use the pip functions
          for i in pip.get_installed_distributions(local_only=True):
          print(i)

 

To change / upgrade the library values, click on the spark pool on Azure Synapse Analytics Workspace 

 

Image 1.png

 

Navigate to "Packages" & you can find if there are any configurations files already uploaded. 

 

Image 2.png

 

Upload the "requirement.txt" file (in this example, we will be upgrading only "pandas" version) 

Default version (pandas 0.23.4)

 

Image 4.png

Image 5.png

 

By checking the box "Force new settings on the Apache Spark pool (will immediately stop running Apache Spark applications)", the configurations will apply to the spark pool immediately by stop running current applications. 

 

Confirm if the file is uploaded - 

 

Image 6.png

 

Once the upload is completed, run below code in spark pool to verify the versions - 

 

          import pip #needed to use the pip functions
          for i in pip.get_installed_distributions(local_only=True):
          print(i)
 

Version Upgraded to "pandas 1.0.1" successfully - 

 
 
 

Image 7.png

 

The change can be also verified using the "Activity Log" by selecting the latest operations related to "Create or Update Spark pools" by checking the change history. 
 
Image 8.png
 
Click on the operation name & select "Change history (preview)" and then select the "requirement.txt"
(this will indicate the changes occurred) 
 
Image 9.png
Image 10.png
 
2 Comments
Occasional Visitor

@CharithCaldera  Excellent post!

Occasional Visitor

I've performed these exact steps:

 

in cmd, py -m pip freeze > requirements.txt

generates requirements.txt in format

 

pandas==1.0.4

 

Navigate to workspace>spark pools>packages>upload packages>select requirements.txt>select force update>upload successful

Navigate back to notebook

Run

 

 import pip #needed to use the pip functions
          for i in pip.get_installed_distributions(local_only=True):
          print(i)
 
Note that pandas is still at 0.23.4
 
I've tried many other methods to try and force pandas to update, but it's not updating. I've tried 1.01, 1.02, 1.03, and a bunch of older versions. None of them gets pandas to changge from 0.23.4 to anything else.
 
Thoughts?