Skip to content

"ValueError: too many values to unpack (expected 2)" is occurred in windows local mode #847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xnaiman opened this issue Jun 13, 2019 · 6 comments

Comments

@xnaiman
Copy link

xnaiman commented Jun 13, 2019

System Information

  • Framework (e.g. TensorFlow) / Algorithm (e.g. KMeans): Scikit-Learn
  • Framework Version: 0.20.0 (official sagemaker-scikit-learn-container)
  • Python Version: 3.6
  • CPU or GPU: CPU
  • Python SDK Version: 1.26.0
  • Are you using a custom image: No

Describe the problem

When I execute fit method in local mode on windows, "ValueError: too many values to unpack (expected 2)" is occurred.

Cause

I already know that the cause is the difference between windows and linux drive description. Therefore, I specify the cause.

The following code is provided for sagemaker-python-sdk/src/sagemaker/local/image.py.

  • class: _SageMakerContainer
  • method: retrieve_artifacts
host_dir, container_dir = volume.split(':')

When this code is executed on windows, if volume is as follows.

C:\Users\oracle7\AppData\Local\Temp\tmp9sd97b87\algo-1-gnnm3\input:/opt/ml/input

The retun value is three and is as follows.

  • C:
  • \Users\oracle7\AppData\Local\Temp\tmp9sd97b87\algo-1-gnnm3\input
  • /opt/ml/input

Thus, if platform.system () is Windows, three return values ​​should be assumed.

Minimal repro / logs

  • Logs
algo-1-gnnm3_1  | 2019-06-13 00:45:24,804 sagemaker-containers INFO     Reporting training SUCCESS
tmp9sd97b87_algo-1-gnnm3_1 exited with code 0
Aborting on container exit...
Traceback (most recent call last):
  File "c:\Users\oracle7\.vscode\extensions\ms-python.python-2019.5.18875\pythonFiles\ptvsd_launcher.py", line 43, in <module>
    main(ptvsdArgs)
  File "c:\Users\oracle7\.vscode\extensions\ms-python.python-2019.5.18875\pythonFiles\lib\python\ptvsd\__main__.py", line 434, in main
    run()
  File "c:\Users\oracle7\.vscode\extensions\ms-python.python-2019.5.18875\pythonFiles\lib\python\ptvsd\__main__.py", line 312, in run_file
    runpy.run_path(target, run_name='__main__')
  File "C:\Anaconda3\envs\sagemaker\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Anaconda3\envs\sagemaker\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Anaconda3\envs\sagemaker\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\Users\oracle7\Documents\GitLab\System\predictive-maintenance\sagemaker\tutorial_basic\train.py", line 24, in <module>
    sklearn.fit({'train': train_input})
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\estimator.py", line 234, in fit
    self.latest_training_job = _TrainingJob.start_new(self, inputs)
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\estimator.py", line 592, in start_new
    estimator.sagemaker_session.train(**train_args)
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\session.py", line 317, in train
    self.sagemaker_client.create_training_job(**train_request)
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\local\local_session.py", line 73, in create_training_job
    training_job.start(InputDataConfig, OutputDataConfig, hyperparameters, TrainingJobName)
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\local\entities.py", line 69, in start
    self.model_artifacts = self.container.train(input_data_config, output_data_config, hyperparameters, job_name)
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\local\image.py", line 143, in train
    artifacts = self.retrieve_artifacts(compose_data, output_data_config, job_name)
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\local\image.py", line 239, in retrieve_artifacts
    host_dir, container_dir = volume.split(':')
ValueError: too many values to unpack (expected 2)
  • Exact command to reproduce:
sklearn = SKLearn(
    entry_point='scikit_learn_iris.py',
    train_instance_type="ml.c4.xlarge",
    role=role,
    sagemaker_session=sagemaker_session,
    hyperparameters={'max_leaf_nodes': 30})

sklearn.fit({'train': train_input})
@mvsusp
Copy link
Contributor

mvsusp commented Jun 14, 2019

Hi @xnaiman ,

We currently don't support Local mode for windows instances. This feature is already included in our roadmap.

Sorry for any inconvenience about that.

@xnaiman
Copy link
Author

xnaiman commented Jun 15, 2019

@mvsusp

This feature is already included in our roadmap.

Where can I see the roadmap(plan) ?

@mvsusp
Copy link
Contributor

mvsusp commented Jun 17, 2019

Unfortunately, the roadmap is not public available yet, @xnaiman .

@knakad knakad closed this as completed Jul 24, 2019
@knakad knakad reopened this Jul 24, 2019
manvento pushed a commit to manvento/sagemaker-python-sdk that referenced this issue Nov 18, 2019
Windows paths start with unit letter and colon. Moreover when composing docker image path it's better to not use os.path.join, because docker image is a unix OS, but os path use separator.
@manvento
Copy link
Contributor

manvento commented Dec 2, 2019

Hi,
I have proposed a possibile solution for this issue. For me it works good.
You can find it here:
#1125

@linehammer
Copy link

ValueError is a standard Exception raised by various methods that perform range-checking of some kind to signal that a value provided to the method fell outside the valid range. Python functions can return multiple variables . These variables can be stored in variables directly. This is a unique property of Python , other programming languages such as C++ or Java do not support this by default. The valueerror: too many values to unpack occurs during a multiple-assignment where you either don't have enough objects to assign to the variables or you have more objects to assign than variables.

@nadiaya
Copy link
Contributor

nadiaya commented Jan 2, 2020

#1125 has been merged. Resolving the issue.

@nadiaya nadiaya closed this as completed Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants