使用第三方Git仓库的SageMaker MLOps项目克隆失败求助
解决SageMaker Studio克隆CodePipeline MLOps项目仓库时路径重复的问题
问题分析
这是SageMaker Studio关联CodePipeline MLOps项目时的路径拼接bug,导致用户主目录/home/sagemaker-user被重复拼接,目标路径不存在,从而触发FileNotFoundError导致克隆失败。
解决方案
1. 手动创建缺失路径,完成克隆
- 打开SageMaker Studio的终端(从Launcher里找到Terminal选项打开)
- 执行命令创建重复路径中的层级:
mkdir -p /home/sagemaker-user/home/sagemaker-user/cat-ml-test-1-p-mtd5ofsbdgva - 回到克隆操作界面,重新尝试克隆仓库,此时路径已存在,克隆会成功执行。
2. 迁移文件并清理冗余路径(可选,避免后续目录混乱)
克隆成功后,建议把文件迁移到正常路径并清理冗余嵌套目录:
- 先创建正确的项目根目录(如果不存在):
mkdir -p /home/sagemaker-user/cat-ml-test-1-p-mtd5ofsbdgva - 把冗余路径里的文件移动到正确目录:
mv /home/sagemaker-user/home/sagemaker-user/cat-ml-test-1-p-mtd5ofsbdgva/* /home/sagemaker-user/cat-ml-test-1-p-mtd5ofsbdgva/ - 删除冗余的嵌套目录:
rm -rf /home/sagemaker-user/home
3. 后续创建项目的规避方法
- 创建CodePipeline MLOps项目时,项目名称尽量简短,不要包含特殊字符
- 在关联克隆仓库前,先在SageMaker Studio终端手动创建对应的项目根目录,再执行克隆操作
错误详情
Clone failed Traceback (most recent call last): File "/opt/conda/envs/studio/lib/python3.9/site-packages/jupyterlab_git/git.py", line 144, in execute code, output, error = await current_loop.run_in_executor( File "/opt/conda/envs/studio/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/opt/conda/envs/studio/lib/python3.9/site-packages/jupyterlab_git/git.py", line 110, in call_subprocess process = subprocess.Popen( File "/opt/conda/envs/studio/lib/python3.9/subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/opt/conda/envs/studio/lib/python3.9/subprocess.py", line 1821, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '/home/sagemaker-user/home/sagemaker-user/cat-ml-test-1-p-mtd5ofsbdgva/sagemaker-p-mtd5ofsbdgva-modeldeploy'
内容的提问来源于stack exchange,提问作者dilky97
相关产品推荐
相关产品推荐

