Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom package installation from S3 in sagemaker

I have a whl file for a custom package (not published open source) in a S3 bucket.

I now want to import/install it in my sagemaker instance. https://medium.com/@shadidc/installing-custom-python-package-to-sagemaker-notebook-b7b897f4f655 This link is what I tried to follow, but it did not work for me.

Has anyone tried this before?

like image 605
warri0r_princess Avatar asked Sep 12 '25 01:09

warri0r_princess


1 Answers

Using AWS Sagemaker Jupyter cell

Option 1 :

Quick and dirty, upload the whl file in same workspace as of notebook and just install.

%pip install custom_package_name.whl

Now, you would need to restart the kernel and then import. You should be able to work through.

Option 2:

Another simple approach is to get the whl file from S3 folder and install.

s3 = boto3.client("s3")
s3_bucket = "your core s3 bucket location"
file_location = "your file location and file name with extension"

Below I'm using same file location for both source and target

s3_client.download_file(s3_bucket, file_location, file_location)

%pip install ./your_target_folder_name/custom_package.whl

Now, you would need to restart the kernel and then import. You should be able to work through.

like image 58
Vikash Kumar Avatar answered Sep 14 '25 15:09

Vikash Kumar