【问题标题】:Custom package installation from S3 in sagemaker在 sagemaker 中从 S3 安装自定义包
【发布时间】:2022-03-16 20:38:54
【问题描述】:

我在 S3 存储桶中有一个自定义包(未发布的开源)的 whl 文件。

我现在想在我的 sagemaker 实例中导入/安装它。 https://medium.com/@shadidc/installing-custom-python-package-to-sagemaker-notebook-b7b897f4f655这个链接是我试图关注的,但它对我不起作用。

以前有人试过吗?

【问题讨论】:

    标签: python-3.x amazon-s3 amazon-sagemaker


    【解决方案1】:

    使用 AWS Sagemaker Jupyter 单元

    选项 1:

    又快又脏,将 whl 文件上传到与笔记本相同的工作区,然后安装。

    %pip install custom_package_name.whl
    

    现在,您需要重新启动内核然后导入。你应该可以解决的。

    选项 2:

    另一种简单的方法是从 S3 文件夹中获取 whl 文件并安装。

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

    下面我对源和目标使用相同的文件位置

    s3_client.download_file(s3_bucket, file_location, file_location)
    
    %pip install ./your_target_folder_name/custom_package.whl
    

    现在,您需要重新启动内核然后导入。你应该可以解决的。

    【讨论】:

      猜你喜欢
      • 2016-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-23
      • 1970-01-01
      • 2020-06-09
      相关资源
      最近更新 更多