<?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: Private PyPI repos on DBR 13+ in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/39286#M7170</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/85901"&gt;@lucasvieira&lt;/a&gt;&amp;nbsp; thanks for tracking down the fix! It solves the problem as described so I'm marking your post as the solution.&lt;/P&gt;&lt;P&gt;In case it helps someone else, my original posts left out a detail from our setup in order to make the problem easy to replicate. Our CodeArtifact does not cache dependencies. Instead we configure &lt;FONT face="andale mono,times"&gt;&lt;STRONG&gt;global.extra-index-url&lt;/STRONG&gt;&lt;/FONT&gt; to pull public depdendencies. Here's how our script was different:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash

# Install AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

aws --version

echo "AWS CodeArtifact login (root)"

aws codeartifact login --tool pip --repository xxxxxx --domain xxxxxx --domain-owner xxxxxx

# here's the additional setup 
/databricks/python3/bin/python -m pip config set global.extra-index-url https://pypi.org/simple&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a result I was seeing errors telling me my dependencies could not be found. To fix the issue, I had to set global.extra-index-url for the libraries user as well. Here's the full script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash

# Install AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

aws --version

echo "AWS CodeArtifact login (root)"

aws codeartifact login --tool pip --repository xxxxxx --domain xxxxxx --domain-owner xxxxxx

/databricks/python3/bin/python -m pip config set global.extra-index-url https://pypi.org/simple

sudo mkdir /home/libraries
sudo chown libraries:libraries /home/libraries
sudo chmod 755 /home/libraries

sudo -u libraries aws codeartifact login --tool pip --repository xxxxxx --domain xxxxxx --domain-owner xxxxxx

sudo -u libraries /databricks/python3/bin/python -m pip config set global.extra-index-url https://pypi.org/simple&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;UPDATE: Also, if you are running this as a global init-script and must support versions older than 12.2 LTS (e.g., 11.3 LTS), make sure you wrap the code for the libraries user in an if block to check if the user libraries exists. Otherwise, this script will fail on 11.3.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if id "libraries" &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then
  # commands go here
fi&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 07 Aug 2023 18:55:44 GMT</pubDate>
    <dc:creator>dvmentalmadess</dc:creator>
    <dc:date>2023-08-07T18:55:44Z</dc:date>
    <item>
      <title>Private PyPI repos on DBR 13+</title>
      <link>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/38874#M7162</link>
      <description>&lt;P&gt;We use a private PyPI repo (AWS CodeArtifact) to publish custom python libraries. We make the private repo available to DBR 12.2 clusters using an init-script as &lt;A href="https://kb.databricks.com/en_US/clusters/install-private-pypi-repo" target="_self"&gt;prescribed here&lt;/A&gt; in the Databricks KB.&amp;nbsp; When we tried to upgrade to 13.2 this stopped working. Specifically:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The cluster logs an error (see: below) and fails to start when configured using the Jobs API `library.PyPI.package` parameter (&lt;A href="https://registry.terraform.io/providers/databrickslabs/databricks/latest/docs/resources/cluster#library-configuration-block" target="_self"&gt;via Terraform&lt;/A&gt;)&lt;/LI&gt;&lt;LI&gt;Installing a cluster library using the Databricks UI also fails with the same error&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Looking at the docs for &lt;A href="https://docs.databricks.com/libraries/cluster-libraries.html" target="_self"&gt;Cluster Libraries&lt;/A&gt; notes the following limitation:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;On Databricks Runtime 13.1 and above, cluster Python libraries are supported on clusters that use shared access mode in a Unity Catalog-enabled workspace, including Python wheels that are uploaded as workspace files.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So I looked at creating a cluster using shared access but according to the &lt;A href="https://docs.databricks.com/clusters/configure.html#shared-limitations" target="_self"&gt;Create a cluster&lt;/A&gt; docs shared access mode has the following limitation: &lt;STRONG&gt;Init scripts are not supported.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Since it seems like cluster libraries won't work for DBR 13+ I looked at the documentation for workspace libraries. Unfortunately, the only way to authenticate is to store the credentials as part of the index URL. The problem here is that CodeArtifact limits authentication tokens to 12 hours, so this won't work.&lt;/P&gt;&lt;P&gt;I don't see a way to use a private PyPI repo for distributing our libraries - at least not using AWS CodeArtifact. Am I missing something?&lt;/P&gt;&lt;P&gt;Here's the error mentioned above:&lt;/P&gt;&lt;PRE&gt;Failed to attach library python-pypi;s3_ingest;;0.0.2; to Spark&lt;BR /&gt;org.apache.spark.SparkException: Process List(/bin/su, libraries, -c, bash /local_disk0/.ephemeral_nfs/cluster_libraries/python/python_start_clusterwide.sh /local_disk0/.ephemeral_nfs/cluster_libraries/python/bin/pip install 's3_ingest==0.0.2' --disable-pip-version-check) exited with code 1. WARNING: The directory '/home/libraries/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.&lt;BR /&gt;ERROR: Could not find a version that satisfies the requirement s3_ingest==0.0.2 (from versions: none)&lt;BR /&gt;ERROR: No matching distribution found for s3_ingest==0.0.2&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 21:37:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/38874#M7162</guid>
      <dc:creator>dvmentalmadess</dc:creator>
      <dc:date>2023-08-01T21:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Private PyPI repos on DBR 13+</title>
      <link>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/38951#M7164</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/9"&gt;@Retired_mod&lt;/a&gt;thank you for your response.&lt;/P&gt;&lt;P&gt;This only happens with a job compute cluster and if I change &lt;FONT face="courier new,courier"&gt;spark_version&lt;/FONT&gt; from &lt;FONT face="courier new,courier"&gt;12.2.x-scala2.12&lt;/FONT&gt; to &lt;FONT face="courier new,courier"&gt;13.2.x-scala2.12&lt;/FONT&gt;. The same job definition works fine when configured as DBR 12.2. Also, if I spin up an interactive cluster on 13.2, attach it to a notebook, and run the following it works fine as well:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;%pip install "s3_ingest==0.0.2"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;/databricks/python3/bin/python -m pip install "s3_ingest==0.0.2"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I'm not actually executing pip from an init script. I'm just using the job API &lt;FONT face="courier new,courier"&gt;libraries[*].pypi.package&lt;/FONT&gt; attribute as shown in the definition below.&lt;/P&gt;&lt;P&gt;To address your resolution suggestions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Library is available (running pip from notebook using interactive compute using both DBR 12.2 and 13.2)&lt;/LI&gt;&lt;LI&gt;Library version is correct (same as #1 above)&lt;/LI&gt;&lt;LI&gt;Install a different version (same results w/ 0.0.1: job works w/ DBR 12.2, does not work w/ DBR 13.2)&lt;/LI&gt;&lt;LI&gt;Check permissions (this is a stock DBR image, I will check this but I would assume this would work since I'm using a standard Service Principal user and I haven't made any changes to this path)&lt;/LI&gt;&lt;LI&gt;pip sudo (I'm not executing pip, this is being done via whatever mechanism is used by the job API&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here's the job definition in full:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "job_id": 696122671962585,
    "creator_user_name": "&amp;lt;redacted&amp;gt;@&amp;lt;redacted&amp;gt;.com",
    "run_as_user_name": "&amp;lt;redacted service principal application id&amp;gt;",
    "run_as_owner": true,
    "settings": {
        "name": "s3_sample_test",
        "email_notifications": {},
        "webhook_notifications": {},
        "timeout_seconds": 0,
        "schedule": {
            "quartz_cron_expression": "0 0 0 * * ?",
            "timezone_id": "America/Denver",
            "pause_status": "UNPAUSED"
        },
        "max_concurrent_runs": 1,
        "tasks": [
            {
                "task_key": "main",
                "python_wheel_task": {
                    "package_name": "s3_ingest",
                    "entry_point": "s3",
                    "parameters": [
                        "--artifact-bucket",
                        "&amp;lt;redacted&amp;gt;",
                        "--conf-file",
                        "integration-pipeline/dev/&amp;lt;redacted&amp;gt;sandbox/shared/s3_sample_test/s3_ingest.yml",
                        "--source-schema",
                        "integration-pipeline/dev/&amp;lt;redacted&amp;gt;sandbox/shared/s3_sample_test/source_schema.json"
                    ]
                },
                "new_cluster": {
                    "spark_version": "13.2.x-scala2.12",
                    "aws_attributes": {
                        "instance_profile_arn": "arn:aws:iam::&amp;lt;redacted aws account id&amp;gt;:instance-profile/&amp;lt;redacted role name&amp;gt;"
                    },
                    "instance_pool_id": "0510-171953-luck30-pool-y9abm5g0",
                    "data_security_mode": "SINGLE_USER",
                    "autoscale": {
                        "min_workers": 1,
                        "max_workers": 8
                    }
                },
                "libraries": [
                    {
                        "pypi": {
                            "package": "s3_ingest==0.0.2"
                        }
                    }
                ],
                "timeout_seconds": 0,
                "email_notifications": {}
            }
        ],
        "format": "MULTI_TASK"
    },
    "created_time": 1690576962438
}&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 16:47:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/38951#M7164</guid>
      <dc:creator>dvmentalmadess</dc:creator>
      <dc:date>2023-08-02T16:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Private PyPI repos on DBR 13+</title>
      <link>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/38956#M7165</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/9"&gt;@Retired_mod&lt;/a&gt;thank you for your reply. In response to your suggestions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Library available? I can run pip install from a notebook on interactive compute using both DBR 12.2 and 13.2&lt;/LI&gt;&lt;LI&gt;Library version? Same results as 1.&lt;/LI&gt;&lt;LI&gt;Different version? Same results as 1 and 2 using interactive compute. Also, job compute works for both library versions on DBR 12.2, but neither works on 13.2.&lt;/LI&gt;&lt;LI&gt;Directory permissions? From a notebook running &lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;ls -lh /home/libraries/.cache/pip&lt;/STRONG&gt;&lt;/FONT&gt; returns &lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#800000"&gt;ls: cannot access '/home/libraries/.cache/pip': No such file or directory&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;Pip sudo -H? I'm not explicitly running pip at all. I'm using the &lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;libraries[*].pypi.package&lt;/STRONG&gt;&lt;/FONT&gt; attribute from the Create Job API.&lt;BR /&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;Additional details&lt;/FONT&gt;&lt;/H3&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;Here are the both pip commands I tried on interactive compute using both DBR 12.2 and 13.2. Both of these worked in this scenario:&lt;/FONT&gt;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;%pip install "s3_ingest==0.0.2"&lt;/LI-CODE&gt;&lt;P&gt;Also:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;%sh
/databricks/python3/bin/python -m pip install "s3_ingest==0.0.2"&lt;/LI-CODE&gt;&lt;P&gt;And here is the complete (redacted) job definition copied from workflow console UI:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "job_id": 696122671962585,
    "creator_user_name": "&amp;lt;redacted email&amp;gt;",
    "run_as_user_name": "&amp;lt;redacted service principal application id&amp;gt;",
    "run_as_owner": true,
    "settings": {
        "name": "s3_sample_test",
        "email_notifications": {},
        "webhook_notifications": {},
        "timeout_seconds": 0,
        "schedule": {
            "quartz_cron_expression": "0 0 0 * * ?",
            "timezone_id": "America/Denver",
            "pause_status": "UNPAUSED"
        },
        "max_concurrent_runs": 1,
        "tasks": [
            {
                "task_key": "main",
                "python_wheel_task": {
                    "package_name": "s3_ingest",
                    "entry_point": "s3",
                    "parameters": [
                        "--artifact-bucket",
                        "&amp;lt;redacted s3 bucket name&amp;gt;",
                        "--conf-file",
                        "integration-pipeline/dev/&amp;lt;redacted&amp;gt;sandbox/shared/s3_sample_test/s3_ingest.yml",
                        "--source-schema",
                        "integration-pipeline/dev/&amp;lt;redacted&amp;gt;sandbox/shared/s3_sample_test/source_schema.json"
                    ]
                },
                "new_cluster": {
                    "spark_version": "13.2.x-scala2.12",
                    "aws_attributes": {
                        "instance_profile_arn": "arn:aws:iam::&amp;lt;redacted aws account id&amp;gt;:instance-profile/&amp;lt;redacted aws iam role name&amp;gt;"
                    },
                    "instance_pool_id": "&amp;lt;redacted instance pool id&amp;gt;",
                    "data_security_mode": "SINGLE_USER",
                    "autoscale": {
                        "min_workers": 1,
                        "max_workers": 8
                    }
                },
                "libraries": [
                    {
                        "pypi": {
                            "package": "s3_ingest==0.0.2"
                        }
                    }
                ],
                "timeout_seconds": 0,
                "email_notifications": {}
            }
        ],
        "format": "MULTI_TASK"
    },
    "created_time": 1690576962438
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 17:14:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/38956#M7165</guid>
      <dc:creator>dvmentalmadess</dc:creator>
      <dc:date>2023-08-02T17:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Private PyPI repos on DBR 13+</title>
      <link>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/38964#M7167</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/9"&gt;@Retired_mod&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I've been running some additional experiments.&lt;/P&gt;&lt;H3&gt;Experiment 1&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;Create DBR 12.2 cluster&lt;/LI&gt;&lt;LI&gt;Once running, check to see if &lt;FONT face="andale mono,times"&gt;&lt;STRONG&gt;/home/libraries/.cache/pip&lt;/STRONG&gt;&lt;/FONT&gt; exists using &lt;FONT face="andale mono,times"&gt;&lt;STRONG&gt;ls -lh&lt;/STRONG&gt;&lt;/FONT&gt; (it does not)&lt;/LI&gt;&lt;LI&gt;Use cluster configuration "Libraries" tab to install "s3_ingest==0.0.2" (success)&lt;/LI&gt;&lt;LI&gt;Check again to see if pip cache folder exists (it does not)&lt;/LI&gt;&lt;LI&gt;Use cluster configuration "Libraries" tab to uninstall "s3_ingest==0.0.2" (pending restart)&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;Experiment 2&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;Edit the cluster configuration from "Experiment 1", change to DBR 13.2 then click "Confirm and Restart"&lt;/LI&gt;&lt;LI&gt;Once running, check to see if &lt;FONT face="andale mono,times"&gt;&lt;STRONG&gt;/home/libraries/.cache/pip&lt;/STRONG&gt;&lt;/FONT&gt; exists using&lt;STRONG&gt;&lt;FONT face="andale mono,times"&gt; ls -lh&lt;/FONT&gt;&lt;/STRONG&gt; (it does not)&lt;/LI&gt;&lt;LI&gt;Run &lt;FONT face="andale mono,times"&gt;&lt;STRONG&gt;/databricks/python/bin/python -m pip uninstall -y s3_ingest&lt;/STRONG&gt;&lt;/FONT&gt; to verify s3_ingest is not installed (returns warning that package is not installed)&lt;/LI&gt;&lt;LI&gt;Use cluster configuration "Libraries" tab to install "s3_ingest==0.0.2" (failure, same error as OP)&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;Experiment 3&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;Uninstall s3_ingest==0.0.2 after "Experiment 2" (pending restart), then restart the cluster&lt;/LI&gt;&lt;LI&gt;Once restart completes, run &lt;FONT face="andale mono,times"&gt;&lt;STRONG&gt;mkdir -p /home/libraries/.cache/pip&lt;/STRONG&gt;&lt;/FONT&gt; then &lt;FONT face="andale mono,times"&gt;&lt;STRONG&gt;chown -R nobody:nogroup /home/libraries&lt;/STRONG&gt;&lt;/FONT&gt;.&lt;/LI&gt;&lt;LI&gt;Use cluster configuration "Libraries" tab to install "s3_ingest==0.0.2" (failure, same error as OP)&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;Conclusion&lt;/H3&gt;&lt;P&gt;This seems like a bug to me. I'm going to look into running pip install from an init script as a workaround but the "Libraries" functionality seems broken to me - both for interactive and job compute. As I've verified, pip does not require sudo or sudo -H, it runs just fine on it's own. Regardless, the "Libraries" functionality does not provide the ability to specify sudo which means I can't use the feature and I likely need to create a pip install script for every job instead of using the built-in "libraries" functionality with "pypi".&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 22:09:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/38964#M7167</guid>
      <dc:creator>dvmentalmadess</dc:creator>
      <dc:date>2023-08-02T22:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: Private PyPI repos on DBR 13+</title>
      <link>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/39160#M7168</link>
      <description>&lt;P&gt;+1, same issue here, I'm using AWS CodeArtifact as private PyPI and worked in the&amp;nbsp;&lt;SPAN&gt;DBR 12.x and it's not working anymore in the&amp;nbsp;DBR 13.2.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I'm using the same pattern as&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/75137"&gt;@dvmentalmadess&lt;/a&gt;, init script to do the AWS CodeArtifact login.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 16:01:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/39160#M7168</guid>
      <dc:creator>lucasvieira</dc:creator>
      <dc:date>2023-08-04T16:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Private PyPI repos on DBR 13+</title>
      <link>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/39250#M7169</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/75137"&gt;@dvmentalmadess&lt;/a&gt;&amp;nbsp;I found a workaround for this issue, I'm using this init script to create the &lt;STRONG&gt;/home/libraries&lt;/STRONG&gt; home folder and give permissions to the &lt;STRONG&gt;libraries&lt;/STRONG&gt;&amp;nbsp;user and then using the&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;sudo&lt;/SPAN&gt; &lt;SPAN&gt;-u&lt;/SPAN&gt; &lt;SPAN&gt;libraries&lt;/SPAN&gt; &lt;SPAN&gt;aws&lt;/SPAN&gt; &lt;SPAN&gt;codeartifact&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;login&lt;/STRONG&gt;&amp;nbsp;command.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;#!/bin/bash

# Install AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

aws --version

echo "AWS CodeArtifact login (root)"

aws codeartifact login --tool pip --repository xxxxxx --domain xxxxxx --domain-owner xxxxxx

sudo mkdir /home/libraries
sudo chown libraries:libraries /home/libraries
sudo chmod 755 /home/libraries

sudo -u libraries aws codeartifact login --tool pip --repository xxxxxx --domain xxxxxx --domain-owner xxxxxx&lt;/LI-CODE&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;In my init script, I'm running the aws codeartifact login twice, one with the root user and another one with the libraries users.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;It worked for me.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 07 Aug 2023 12:18:07 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/39250#M7169</guid>
      <dc:creator>lucasvieira</dc:creator>
      <dc:date>2023-08-07T12:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Private PyPI repos on DBR 13+</title>
      <link>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/39286#M7170</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/85901"&gt;@lucasvieira&lt;/a&gt;&amp;nbsp; thanks for tracking down the fix! It solves the problem as described so I'm marking your post as the solution.&lt;/P&gt;&lt;P&gt;In case it helps someone else, my original posts left out a detail from our setup in order to make the problem easy to replicate. Our CodeArtifact does not cache dependencies. Instead we configure &lt;FONT face="andale mono,times"&gt;&lt;STRONG&gt;global.extra-index-url&lt;/STRONG&gt;&lt;/FONT&gt; to pull public depdendencies. Here's how our script was different:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash

# Install AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

aws --version

echo "AWS CodeArtifact login (root)"

aws codeartifact login --tool pip --repository xxxxxx --domain xxxxxx --domain-owner xxxxxx

# here's the additional setup 
/databricks/python3/bin/python -m pip config set global.extra-index-url https://pypi.org/simple&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a result I was seeing errors telling me my dependencies could not be found. To fix the issue, I had to set global.extra-index-url for the libraries user as well. Here's the full script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash

# Install AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

aws --version

echo "AWS CodeArtifact login (root)"

aws codeartifact login --tool pip --repository xxxxxx --domain xxxxxx --domain-owner xxxxxx

/databricks/python3/bin/python -m pip config set global.extra-index-url https://pypi.org/simple

sudo mkdir /home/libraries
sudo chown libraries:libraries /home/libraries
sudo chmod 755 /home/libraries

sudo -u libraries aws codeartifact login --tool pip --repository xxxxxx --domain xxxxxx --domain-owner xxxxxx

sudo -u libraries /databricks/python3/bin/python -m pip config set global.extra-index-url https://pypi.org/simple&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;UPDATE: Also, if you are running this as a global init-script and must support versions older than 12.2 LTS (e.g., 11.3 LTS), make sure you wrap the code for the libraries user in an if block to check if the user libraries exists. Otherwise, this script will fail on 11.3.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if id "libraries" &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then
  # commands go here
fi&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 07 Aug 2023 18:55:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/39286#M7170</guid>
      <dc:creator>dvmentalmadess</dc:creator>
      <dc:date>2023-08-07T18:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Private PyPI repos on DBR 13+</title>
      <link>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/67423#M7171</link>
      <description>&lt;P&gt;I'm coming back to provide an updated solution that doesn't rely on the implementation detail of the user name (e.g., &lt;FONT face="courier new,courier"&gt;libraries&lt;/FONT&gt;) - which is not considered a contract and could potentially change and break in the future.&lt;/P&gt;&lt;P&gt;The key is to use the &lt;FONT face="courier new,courier"&gt;--global&lt;/FONT&gt; flag when calling &lt;FONT face="courier new,courier"&gt;pip config set&lt;/FONT&gt;. Unfortunately, &lt;FONT face="courier new,courier"&gt;aws codeartifact login&lt;/FONT&gt; doesn't do this even though it does set &lt;FONT face="courier new,courier"&gt;global.index-url&lt;/FONT&gt; which is namespaced, but only for &lt;FONT face="courier new,courier"&gt;--user&lt;/FONT&gt;. The workaround is to use &lt;FONT face="courier new,courier"&gt;aws codeartifact get-authorization-token&lt;/FONT&gt; instead of &lt;FONT face="courier new,courier"&gt;login&lt;/FONT&gt; and then manually construct the index url, passing in the credentials with the token:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#!/bin/bash
set -e

echo "Authenticating to AWS Code Artifact"
CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token --domain &amp;lt;code-artifact-domain&amp;gt; --region &amp;lt;region of domain&amp;gt; --output text --query authorizationToken)
/databricks/python3/bin/python -m pip config --global set global.index-url https://aws:${CODEARTIFACT_AUTH_TOKEN}@&amp;lt;codeartifact repo url&amp;gt;

echo "Adding extra index to pip config"
/databricks/python3/bin/python -m pip config --global set global.extra-index-url https://pypi.org/simple&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 16:58:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/private-pypi-repos-on-dbr-13/m-p/67423#M7171</guid>
      <dc:creator>dvmentalmadess</dc:creator>
      <dc:date>2024-04-26T16:58:12Z</dc:date>
    </item>
  </channel>
</rss>

