amazon-sagemaker-examples icon indicating copy to clipboard operation
amazon-sagemaker-examples copied to clipboard

SageMaker Studio Can't find entry point file

Open imyoungyang opened this issue 6 years ago • 2 comments

Hi

In the notebook: https://github.com/awslabs/amazon-sagemaker-examples/blob/master/aws_sagemaker_studio/sagemaker_experiments/mnist-handwritten-digits-classification-experiment.ipynb

Can't find out the entry point of mnist.py

FileNotFoundError: [Errno 2] No such file or directory: 'mnist.py'

It looks the studio file path is /root but it is not in the Studio file path event I change to /home/sagemaker-user/amazon-sagemaker-examples/aws_sagemaker_studio/sagemaker_experiments/mnist.py

The error full logs:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-20-7f34dece62ba> in <module>
     46             "TrialComponentDisplayName": "Training",
     47         },
---> 48         wait=True,
     49     )
     50 

/opt/conda/lib/python3.7/site-packages/sagemaker/estimator.py in fit(self, inputs, wait, logs, job_name, experiment_config)
    457 
    458         """
--> 459         self._prepare_for_training(job_name=job_name)
    460 
    461         self.latest_training_job = _TrainingJob.start_new(self, inputs, experiment_config)

/opt/conda/lib/python3.7/site-packages/sagemaker/estimator.py in _prepare_for_training(self, job_name)
   1645             self.code_uri = self.uploaded_code.s3_prefix
   1646         else:
-> 1647             self.uploaded_code = self._stage_user_code_in_s3()
   1648             code_dir = self.uploaded_code.s3_prefix
   1649             script = self.uploaded_code.script_name

/opt/conda/lib/python3.7/site-packages/sagemaker/estimator.py in _stage_user_code_in_s3(self)
   1696             directory=self.source_dir,
   1697             dependencies=self.dependencies,
-> 1698             kms_key=kms_key,
   1699         )
   1700 

/opt/conda/lib/python3.7/site-packages/sagemaker/fw_utils.py in tar_and_upload_dir(session, bucket, s3_key_prefix, script, directory, dependencies, kms_key)
    377         source_files = _list_files_to_compress(script, directory) + dependencies
    378         tar_file = sagemaker.utils.create_tar_file(
--> 379             source_files, os.path.join(tmp, _TAR_SOURCE_FILENAME)
    380         )
    381 

/opt/conda/lib/python3.7/site-packages/sagemaker/utils.py in create_tar_file(source_files, target)
    390         for sf in source_files:
    391             # Add all files from the directory into the root of the directory structure of the tar
--> 392             t.add(sf, arcname=os.path.basename(sf))
    393     return filename
    394 

/opt/conda/lib/python3.7/tarfile.py in add(self, name, arcname, recursive, filter)
   1926 
   1927         # Create a TarInfo object from the file.
-> 1928         tarinfo = self.gettarinfo(name, arcname)
   1929 
   1930         if tarinfo is None:

/opt/conda/lib/python3.7/tarfile.py in gettarinfo(self, name, arcname, fileobj)
   1805         if fileobj is None:
   1806             if hasattr(os, "lstat") and not self.dereference:
-> 1807                 statres = os.lstat(name)
   1808             else:
   1809                 statres = os.stat(name)

FileNotFoundError: [Errno 2] No such file or directory: 'mnist.py'

imyoungyang avatar Dec 17 '19 09:12 imyoungyang

Found.

The SageMaker Studio is mount under the EFS. In the studio terminal, I found /home/sagemaker-user to the path 127.0.0.1:/200005

bash-4.2$ df -h
Filesystem         Size  Used Avail Use% Mounted on
overlay             60G  9.1G   51G  16% /
tmpfs               64M     0   64M   0% /dev
tmpfs              1.9G     0  1.9G   0% /sys/fs/cgroup
127.0.0.1:/200005  8.0E     0  8.0E   0% /home/sagemaker-user
/dev/nvme0n1p1      60G  9.1G   51G  16% /etc/hosts
shm                 64M     0   64M   0% /dev/shm
devtmpfs           1.9G     0  1.9G   0% /dev/tty
tmpfs              1.9G     0  1.9G   0% /proc/acpi
tmpfs              1.9G     0  1.9G   0% /sys/firmware

And, in the Jupyter Studio, the df command: /root map to the same 127.0.0.1:/200005

Filesystem         Size  Used Avail Use% Mounted on
overlay             60G  9.1G   51G  16% /
tmpfs               64M     0   64M   0% /dev
tmpfs              1.9G     0  1.9G   0% /sys/fs/cgroup
127.0.0.1:/200005  8.0E     0  8.0E   0% /root
/dev/nvme0n1p1      60G  9.1G   51G  16% /opt/.sagemakerinternal
shm                 64M     0   64M   0% /dev/shm
devtmpfs           1.9G     0  1.9G   0% /dev/tty
tmpfs              1.9G     0  1.9G   0% /proc/acpi
tmpfs              1.9G     0  1.9G   0% /sys/firmware

So, the absolute path is at

./amazon-sagemaker-examples/aws_sagemaker_studio/sagemaker_experiments

imyoungyang avatar Dec 17 '19 10:12 imyoungyang

Hi @imyoungyang, Looks like you were able to find the information you needed on your own.

Please re-open the issue if there is anything else we can help with.

Thanks, Neelam

neelamgehlot avatar Jan 20 '20 20:01 neelamgehlot