<?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 Re: Adding extra libraries to databricks (rosbag) in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/71847#M34417</link>
    <description>&lt;P&gt;Issue mostly solved:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import sys
import os
library_path = "/opt/ros/humble/local/lib/python3.10/dist-packages"
 
if library_path not in sys.path:
    sys.path.append(library_path)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;That solves issue with databricks not founding libraries, still - it gives some challenges while loading library - but they are not related to paths.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2024 08:44:15 GMT</pubDate>
    <dc:creator>PiotrU</dc:creator>
    <dc:date>2024-06-06T08:44:15Z</dc:date>
    <item>
      <title>Adding extra libraries to databricks (rosbag)</title>
      <link>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/71773#M34393</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I have interesting challenge, I am required to install few libraries which are part of rosbag packages, for allowing some data deserialization tasks.&lt;/P&gt;&lt;P&gt;While creating cluster I do use&lt;SPAN&gt;&amp;nbsp;init_script that install this software using apt&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sudo apt update &amp;amp;&amp;amp; sudo apt install -y curl gnupg2 lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" &amp;gt; /etc/apt/sources.list.d/ros2-latest.list'

sudo apt update
sudo apt install -y ros-humble-ros-base ros-humble-rclpy ros-humble-std-msgs python3-argcomplete

/databricks/python/bin/pip install mcap
echo "source /opt/ros/humble/setup.bash" &amp;gt;&amp;gt; ~/.bashrc
source /opt/ros/humble/setup.bash

PYTHON_VERSION=$(/databricks/python3/bin/python3 --version | cut -d' ' -f2 | cut -d'.' -f1-2)
echo "export PYTHONPATH=\$PYTHONPATH:/opt/ros/humble/lib/python${PYTHON_VERSION}/site-packages" &amp;gt;&amp;gt; ~/.bashrc
export PYTHONPATH=$PYTHONPATH:/opt/ros/humble/lib/python${PYTHON_VERSION}/site-packages&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;That part is working fine, the trouble is starting when I try to use it (whether is it master or worker node), I have selected example library rclpy - whenever I do execute it via "sh" and start with sourcing variables - it is working fine&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lakime_0-1717597430889.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/8073i2B9912D40E4E4A28/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="lakime_0-1717597430889.png" alt="lakime_0-1717597430889.png" /&gt;&lt;/span&gt;&lt;P&gt;However - If I would like to do same thing - natively using notebook - it doesn't find libraries&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lakime_1-1717597470819.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/8074i0DC7D0F86DFC1A99/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="lakime_1-1717597470819.png" alt="lakime_1-1717597470819.png" /&gt;&lt;/span&gt;&lt;P&gt;I have a script which read the variables generated by /opt/ros/humble/setup.bash -&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import subprocess
import os

def source_ros_setup():
    # Source the ROS 2 setup script and capture the environment variables
    command = ['bash', '-c', 'source /opt/ros/humble/setup.bash &amp;amp;&amp;amp; env']
    proc = subprocess.Popen(command, stdout=subprocess.PIPE, universal_newlines=True)
    env_vars = {}
    for line in proc.stdout:
        key, _, value = line.partition("=")
        env_vars[key] = value.strip()
    proc.communicate()

    # Update os.environ with the new environment variables
    os.environ.update(env_vars)

# Source the ROS 2 setup script
source_ros_setup()

# Verify environment variables (Optional)
print("PYTHONPATH:", os.environ.get('PYTHONPATH'))
print("PATH:", os.environ.get('PATH'))
print("LD_LIBRARY_PATH:", os.environ.get('LD_LIBRARY_PATH'))

# Now run your main code
try:
    import rclpy
    print("rclpy is installed and accessible")
    # Your main ROS 2 related code goes here
except ModuleNotFoundError:
    print("rclpy is not found, ensure the correct PYTHONPATH is set")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it also doesn't work -&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;rclpy is not found, ensure the correct PYTHONPATH is set"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 14:28:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/71773#M34393</guid>
      <dc:creator>PiotrU</dc:creator>
      <dc:date>2024-06-05T14:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Adding extra libraries to databricks (rosbag)</title>
      <link>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/71791#M34399</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/87626"&gt;@PiotrU&lt;/a&gt;&amp;nbsp;- Can you please check if any error in the driver logs regarding this library installation?&amp;nbsp; Do you have the required access to install as a sudo user?&amp;nbsp; It may require password (when i tried locally )&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sudo apt install -y ros-humble-ros-base ros-humble-rclpy ros-humble-std-msgs python3-argcomplete
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 17:46:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/71791#M34399</guid>
      <dc:creator>shan_chandra</dc:creator>
      <dc:date>2024-06-05T17:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Adding extra libraries to databricks (rosbag)</title>
      <link>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/71793#M34400</link>
      <description>&lt;P&gt;There are no issues while I do install packages&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 18:13:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/71793#M34400</guid>
      <dc:creator>PiotrU</dc:creator>
      <dc:date>2024-06-05T18:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: Adding extra libraries to databricks (rosbag)</title>
      <link>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/71847#M34417</link>
      <description>&lt;P&gt;Issue mostly solved:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import sys
import os
library_path = "/opt/ros/humble/local/lib/python3.10/dist-packages"
 
if library_path not in sys.path:
    sys.path.append(library_path)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;That solves issue with databricks not founding libraries, still - it gives some challenges while loading library - but they are not related to paths.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 08:44:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/71847#M34417</guid>
      <dc:creator>PiotrU</dc:creator>
      <dc:date>2024-06-06T08:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Adding extra libraries to databricks (rosbag)</title>
      <link>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/83278#M36899</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/87626"&gt;@PiotrU&lt;/a&gt;&amp;nbsp;did adding the path to sys.path resolve all of your ModuleNotFoundErrors? i'm trying to do something similar and adding the path to the sys.path resolved ModuleNotFoundError for rclpy, but i continue to see others related to ros&lt;/P&gt;</description>
      <pubDate>Sat, 17 Aug 2024 02:02:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/83278#M36899</guid>
      <dc:creator>amandaK</dc:creator>
      <dc:date>2024-08-17T02:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: Adding extra libraries to databricks (rosbag)</title>
      <link>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/83404#M36925</link>
      <description>&lt;P&gt;After working on it a bit, I was able to get rid of all the ModuleNotFoundErrors, but can't seem to figure out how to resolve this issue&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;ImportError: librcl_action.so: cannot open shared object file: No such file or directory&lt;/LI-CODE&gt;&lt;P&gt;Did you happen to run into this as well?&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/116350"&gt;@amandaK&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/87626"&gt;@PiotrU&lt;/a&gt;&amp;nbsp;did adding the path to sys.path resolve all of your ModuleNotFoundErrors? i'm trying to do something similar and adding the path to the sys.path resolved ModuleNotFoundError for rclpy, but i continue to see others related to ros&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 07:20:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/83404#M36925</guid>
      <dc:creator>amandaK</dc:creator>
      <dc:date>2024-08-19T07:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Adding extra libraries to databricks (rosbag)</title>
      <link>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/88288#M37528</link>
      <description>&lt;P&gt;nope, also - end of the day, I've totally dropped usage of ros env on databricks&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2024 10:39:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/adding-extra-libraries-to-databricks-rosbag/m-p/88288#M37528</guid>
      <dc:creator>PiotrU</dc:creator>
      <dc:date>2024-09-04T10:39:47Z</dc:date>
    </item>
  </channel>
</rss>

