Skip to content
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

__init__.py:main fails with ValueError: too many values to unpack #246

Closed
asjohnston-asf opened this issue Mar 18, 2024 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@asjohnston-asf
Copy link
Member

$ python -m hyp3_autorift ++process hyp3_autorift S1A_IW_SLC__1SSH_20170118T091036_20170118T091104_014884_01846D_01C5 S1B_IW_SLC__1SSH_20170112T090955_20170112T091023_003813_0068DC_C750
Traceback (most recent call last):
  File "/home/asjohnston/mambaforge/envs/hyp3-autorift/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/asjohnston/mambaforge/envs/hyp3-autorift/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/asjohnston/src/hyp3-autorift/src/hyp3_autorift/__main__.py", line 47, in <module>
    main()
  File "/home/asjohnston/src/hyp3-autorift/src/hyp3_autorift/__main__.py", line 38, in main
    (process_entry_point,) = {process for process in eps if process.name == args.process}
ValueError: too many values to unpack (expected 1)

Reviewing importlib.metadata.entry_points, there are multiple entry points registered with the same hyp3_autorift name:

>>> from importlib.metadata import entry_points
>>> for ep in entry_points()['console_scripts']:
...     if ep.name == 'hyp3_autorift':
...         print(ep)
... 
EntryPoint(name='hyp3_autorift', value='hyp3_autorift.__main__:main', group='console_scripts')
EntryPoint(name='hyp3_autorift', value='hyp3_autorift.process:main', group='console_scripts')
EntryPoint(name='hyp3_autorift', value='hyp3_autorift.process:main', group='console_scripts')

This was possibly introduced when migrating from setup.py to pyproject.toml

@asjohnston-asf asjohnston-asf added the bug Something isn't working label Mar 18, 2024
@asjohnston-asf
Copy link
Member Author

Invoking the hyp3_autorift console script without python -m works just fine:

$ hyp3_autorift S1A_IW_SLC__1SSH_20170118T091036_20170118T091104_014884_01846D_01C5 S1B_IW_SLC__1SSH_20170112T090955_20170112T091023_003813_0068DC_C750
This is the Open Source version of ISCE.
Some of the workflows depend on a separate licensed package.
To obtain the licensed package, please make a request for ISCE
through the website: https://download.jpl.nasa.gov/ops/request/index.cfm.
Alternatively, if you are a member, or can become a member of WinSAR
you may be able to obtain access to a version of the licensed sofware at
https://winsar.unavco.org/software/isce
2024-03-18 11:47:15,322 - matplotlib - DEBUG - matplotlib data path: /home/asjohnston/mambaforge/envs/hyp3-autorift/lib/python3.9/site-packages/matplotlib/mpl-data
2024-03-18 11:47:15,327 - matplotlib - DEBUG - CONFIGDIR=/home/asjohnston/.config/matplotlib
2024-03-18 11:47:15,329 - matplotlib - DEBUG - interactive is False
2024-03-18 11:47:15,329 - matplotlib - DEBUG - platform is linux
2024-03-18 11:47:15,382 - matplotlib - DEBUG - CACHEDIR=/home/asjohnston/.cache/matplotlib
2024-03-18 11:47:15,384 - matplotlib.font_manager - DEBUG - Using fontManager instance from /home/asjohnston/.cache/matplotlib/fontlist-v330.json
2024-03-18 11:47:16,361 - root - INFO - Downloading https://sentinel1.asf.alaska.edu/SLC/SB/S1B_IW_SLC__1SSH_20170112T090955_20170112T091023_003813_0068DC_C750.zip
...

@jhkennedy
Copy link
Contributor

Currently, the only console script entry points are:

[project.scripts]
hyp3_autorift = "hyp3_autorift.process:main"
s1_correction = "hyp3_autorift.s1_correction:main"

and we dropped hyp3_autorift = hyp3_autorift.__main__:main in v0.11.0,
v0.10.5...v0.11.0#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7L65-L66

before we cut over to pyproject.toml and a src layout in v0.13.0, so I don't think this is related to that change.

My guess is that pip didn't clean up the entry points appropriately when hyp3_autorift was updated sometime before v0.11.0 and now. I would expect a fresh environment and pip install to solve the issue.

@asjohnston-asf
Copy link
Member Author

I've confirmed I can't reproduce my original issue using a fresh install of v0.15.0:

$ git clone git@github.com:ASFHyP3/hyp3-autorift.git
$ cd hyp3-autorift/
$ mamba env create -f environment.yml 
$ mamba activate hyp3-autorift
$ python -m pip install -e .

$ python -m hyp3_autorift ++process hyp3_autorift S1A_IW_SLC__1SSH_20170118T091036_20170118T091104_014884_01846D_01C5 S1B_IW_SLC__1SSH_20170112T090955_20170112T091023_003813_0068DC_C750
This is the Open Source version of ISCE.
Some of the workflows depend on a separate licensed package.
To obtain the licensed package, please make a request for ISCE
through the website: https://download.jpl.nasa.gov/ops/request/index.cfm.
Alternatively, if you are a member, or can become a member of WinSAR
you may be able to obtain access to a version of the licensed sofware at
https://winsar.unavco.org/software/isce
2024-05-07 14:06:27,736 - matplotlib - DEBUG - matplotlib data path: /home/asjohnston/mambaforge/envs/hyp3-autorift/lib/python3.9/site-packages/matplotlib/mpl-data
2024-05-07 14:06:27,740 - matplotlib - DEBUG - CONFIGDIR=/home/asjohnston/.config/matplotlib
2024-05-07 14:06:27,741 - matplotlib - DEBUG - interactive is False
2024-05-07 14:06:27,741 - matplotlib - DEBUG - platform is linux
2024-05-07 14:06:27,785 - matplotlib - DEBUG - CACHEDIR=/home/asjohnston/.cache/matplotlib
2024-05-07 14:06:27,787 - matplotlib.font_manager - DEBUG - Using fontManager instance from /home/asjohnston/.cache/matplotlib/fontlist-v330.json
2024-05-07 14:06:28,392 - root - INFO - Downloading https://sentinel1.asf.alaska.edu/SLC/SB/S1B_IW_SLC__1SSH_20170112T090955_20170112T091023_003813_0068DC_C750.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants