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

Stac command crashes when installed in clean venv without [validate] option #477

Open
matthewscottgordon opened this issue Dec 19, 2024 · 0 comments · May be fixed by #478
Open

Stac command crashes when installed in clean venv without [validate] option #477

matthewscottgordon opened this issue Dec 19, 2024 · 0 comments · May be fixed by #478
Labels
bug Something isn't working

Comments

@matthewscottgordon
Copy link

matthewscottgordon commented Dec 19, 2024

Describe the bug
The test_data data uses the requests library but it is not listed as a required dependency. If requests is not installed, stac crashes while loading plugins.

To reproduce
Steps to reproduce the behavior:

  1. Create a fresh virtual environment and activate it. (e.g. python -m venv ./test_venv && source ./test_venv/bin/activate)
  2. Use pip to install stactools without the [validate] option. (e.g. pip install stactools or pip install 'stactools[s3]'
  3. Try to run stac. (e.g. stac --help)
  4. stac throws a ModuleNotFoundError.

Expected behavior
I should be able to run stac --help.

Screenshots and shell session dumps

> ../venv/bin/stac --help            
Traceback (most recent call last):
  File "/home/mgordon/tmp/stactools/../venv/bin/stac", line 5, in <module>
    from stactools.cli.cli import run_cli
  File "/home/mgordon/tmp/venv/lib/python3.12/site-packages/stactools/cli/__init__.py", line 110, in <module>
    registry.load_plugins()
  File "/home/mgordon/tmp/venv/lib/python3.12/site-packages/stactools/cli/registry.py", line 43, in load_plugins
    name: importlib.import_module(name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mgordon/tmp/venv/lib/python3.12/site-packages/stactools/testing/__init__.py", line 4, in <module>
    from .test_data import TestData
  File "/home/mgordon/tmp/venv/lib/python3.12/site-packages/stactools/testing/test_data.py", line 9, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
@matthewscottgordon matthewscottgordon added the bug Something isn't working label Dec 19, 2024
@gadomski gadomski linked a pull request Dec 19, 2024 that will close this issue
5 tasks
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

Successfully merging a pull request may close this issue.

1 participant