Custom package installation from S3 in sagemaker

Viewed 297
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.

Related