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

Bug: sam build - ImportError #5896

Closed
parthasastry opened this issue Sep 6, 2023 · 5 comments
Closed

Bug: sam build - ImportError #5896

parthasastry opened this issue Sep 6, 2023 · 5 comments
Labels
area/init sam init blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.

Comments

@parthasastry
Copy link

parthasastry commented Sep 6, 2023

Description:

I'am trying to build a simple SAM application. I'am getting error - An unexpected error was encountered while executing "sam build".

Steps to reproduce:

I used the DynamoDB template with "sam init". When I do "sam build" I get the above mentioned error

Observed result:

Error: cannot import name 'EVENT_TYPE_OPENED' from 'watchdog.events' (/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/watchdog/events.py)
Traceback:
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/samcli/lib/telemetry/metric.py", line 184, in wrapped
    raise exception  # pylint: disable=raising-bad-type
    ^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/samcli/lib/telemetry/metric.py", line 149, in wrapped
    return_value = func(*args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/samcli/lib/utils/version_checker.py", line 42, in wrapped
    actual_result = func(*args, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/samcli/cli/main.py", line 95, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/samcli/commands/build/command.py", line 169, in cli
    do_cli(
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/samcli/commands/build/command.py", line 223, in do_cli
    from samcli.commands.build.build_context import BuildContext
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/samcli/commands/build/build_context.py", line 21, in <module>
    from samcli.lib.bootstrap.nested_stack.nested_stack_manager import NestedStackManager
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/samcli/lib/bootstrap/nested_stack/nested_stack_manager.py", line 17, in <module>
    from samcli.lib.providers.sam_function_provider import SamFunctionProvider
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/samcli/lib/providers/sam_function_provider.py", line 13, in <module>
    from samcli.lib.utils.file_observer import FileObserver
  File "/usr/local/Cellar/aws-sam-cli/1.97.0/libexec/lib/python3.11/site-packages/samcli/lib/utils/file_observer.py", line 17, in <module>
    from watchdog.events import (

An unexpected error was encountered while executing "sam build".
Search for an existing issue:
https://github.com/aws/aws-sam-cli/issues?q=is%3Aissue+is%3Aopen+Bug%3A%20sam%20build%20-%20ImportError
Or create a bug report:
https://github.com/aws/aws-sam-cli/issues/new?template=Bug_report.md&title=Bug%3A%20sam%20build%20-%20ImportError

Expected result:

I would expect a clean sam build

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

Mac

  1. OS: Mac Ventura 13.5.1
  2. sam --version: 1.97.0
  3. AWS region: us-east-1
# Paste the output of `sam --info` here

Add --debug flag to command you are running

@parthasastry parthasastry added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Sep 6, 2023
@mndeveci
Copy link
Contributor

mndeveci commented Sep 6, 2023

Thanks for reporting this issue.

Can you provide more details about how did you encounter this problem? I've tried re-producing this issue by selecting 1 and 16 from after running sam init but I was able to generate the application.

Did you install using brew install aws-sam-cli or brew install aws/tap/aws-sam-cli?

@mndeveci mndeveci added blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. area/init sam init and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Sep 6, 2023
@parthasastry
Copy link
Author

Interesting. I used "brew install aws-sam-cli" to install sam cli. I dont have further details, since this was a pure vanilla setup of sam application

@parthasastry
Copy link
Author

Never mind. I uninstalled and reinstalled aws-cli using aws/tap/aws-sam-cli. It worked. Thanks.

@mndeveci
Copy link
Contributor

mndeveci commented Sep 6, 2023

Glad that it worked, please let us know if you have other issues

@mndeveci mndeveci closed this as completed Sep 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/init sam init blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.
Projects
None yet
Development

No branches or pull requests

2 participants