<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Archive file support in Jar Type application in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/archive-file-support-in-jar-type-application/m-p/67935#M7195</link>
    <description>&lt;P&gt;In my spark application, I am using set of python libraries. I am submitting spark application as &lt;STRONG&gt;Jar Task&lt;/STRONG&gt;. &lt;STRONG&gt;But I am not able to find any option provide Archive Files.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So, in order to handle python dependencies, I am using approach:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Create archive file of Python virtual environment using required set of libraries (&amp;lt;environment_name.tar.gz&amp;gt;)&lt;/LI&gt;&lt;LI&gt;Keep it on DBFS&lt;/LI&gt;&lt;LI&gt;In code, add this archive file using &lt;STRONG&gt;sparkSession.sparkContext.addArchive(&amp;lt;dbfs:/environment_name.tar.gz&amp;gt;)&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;As spark suggested, this archive file can be accessible and use with relative path &lt;STRONG&gt;./&amp;lt;environment_name&amp;gt;/bin/python&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;But when I am running application on data bricks cluster, I am getting following error&lt;BR /&gt;&lt;STRONG&gt;Path not found : ./environment/bin/python&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I checked, this archive file is present in different directories in driver and executor nodes. There is no classpath directory as such and due to this I can not use relative path.&lt;/P&gt;&lt;P&gt;Following are directories where archive file is present in different nodes&lt;BR /&gt;&lt;STRONG&gt;driver : /local_disk0/spark-xxxxxx-xxxx-xxxx/userFiles-xxxxx-xxxxx-xxxxx/&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;executor : /local_disk0/spark-xxxxx-xxxxx-xxxxx/executor-xxxxxx-xxxxxx-xxxxxxxx/spark-xxxxx-xxxx-xxxxx-xxxx/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Please suggest how I can use archive files in spark application submitted as Jar Type.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Version : Databricks Runtime Version 12.2 LTS (includes Apache Spark 3.3.2, Scala 2.12)&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 02 May 2024 11:58:21 GMT</pubDate>
    <dc:creator>Abhay_1002</dc:creator>
    <dc:date>2024-05-02T11:58:21Z</dc:date>
    <item>
      <title>Archive file support in Jar Type application</title>
      <link>https://community.databricks.com/t5/get-started-discussions/archive-file-support-in-jar-type-application/m-p/67935#M7195</link>
      <description>&lt;P&gt;In my spark application, I am using set of python libraries. I am submitting spark application as &lt;STRONG&gt;Jar Task&lt;/STRONG&gt;. &lt;STRONG&gt;But I am not able to find any option provide Archive Files.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So, in order to handle python dependencies, I am using approach:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Create archive file of Python virtual environment using required set of libraries (&amp;lt;environment_name.tar.gz&amp;gt;)&lt;/LI&gt;&lt;LI&gt;Keep it on DBFS&lt;/LI&gt;&lt;LI&gt;In code, add this archive file using &lt;STRONG&gt;sparkSession.sparkContext.addArchive(&amp;lt;dbfs:/environment_name.tar.gz&amp;gt;)&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;As spark suggested, this archive file can be accessible and use with relative path &lt;STRONG&gt;./&amp;lt;environment_name&amp;gt;/bin/python&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;But when I am running application on data bricks cluster, I am getting following error&lt;BR /&gt;&lt;STRONG&gt;Path not found : ./environment/bin/python&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I checked, this archive file is present in different directories in driver and executor nodes. There is no classpath directory as such and due to this I can not use relative path.&lt;/P&gt;&lt;P&gt;Following are directories where archive file is present in different nodes&lt;BR /&gt;&lt;STRONG&gt;driver : /local_disk0/spark-xxxxxx-xxxx-xxxx/userFiles-xxxxx-xxxxx-xxxxx/&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;executor : /local_disk0/spark-xxxxx-xxxxx-xxxxx/executor-xxxxxx-xxxxxx-xxxxxxxx/spark-xxxxx-xxxx-xxxxx-xxxx/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Please suggest how I can use archive files in spark application submitted as Jar Type.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Version : Databricks Runtime Version 12.2 LTS (includes Apache Spark 3.3.2, Scala 2.12)&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2024 11:58:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/archive-file-support-in-jar-type-application/m-p/67935#M7195</guid>
      <dc:creator>Abhay_1002</dc:creator>
      <dc:date>2024-05-02T11:58:21Z</dc:date>
    </item>
  </channel>
</rss>

