aws-sam-cli: Command 'local' is not configured correctly. Unable to import 'samcli.commands.local.local'
Description:
After installing v0.3.0, none of the commands work anymore and there is a configuration error shown
Steps to reproduce the issue:
- Uninstalled npm version
pip install --user aws-sam-cli
sam
Observed result:
~/Work/project (master): sam
2018-05-08 17:43:58 Command 'local' is not configured correctly. Unable to import 'samcli.commands.local.local'
Traceback (most recent call last):
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/cli/command.py", line 100, in get_command
mod = importlib.import_module(pkg_name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/commands/local/local.py", line 8, in <module>
from .invoke.cli import cli as invoke_cli
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/commands/local/invoke/cli.py", line 11, in <module>
from samcli.commands.local.cli_common.invoke_context import InvokeContext
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/commands/local/cli_common/invoke_context.py", line 18, in <module>
from ..lib.sam_function_provider import SamFunctionProvider
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/commands/local/lib/sam_function_provider.py", line 9, in <module>
from .sam_base_provider import SamBaseProvider
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/commands/local/lib/sam_base_provider.py", line 5, in <module>
from samcli.lib.samlib.wrapper import SamTranslatorWrapper
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/lib/samlib/wrapper.py", line 18, in <module>
from samtranslator.validator.validator import SamTemplateValidator
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samtranslator/validator/validator.py", line 4, in <module>
import sam_schema
ModuleNotFoundError: No module named 'sam_schema'
2018-05-08 17:43:58 Command 'validate' is not configured correctly. Unable to import 'samcli.commands.validate.validate'
Traceback (most recent call last):
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/cli/command.py", line 100, in get_command
mod = importlib.import_module(pkg_name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/commands/validate/validate.py", line 16, in <module>
from .lib.sam_template_validator import SamTemplateValidator
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/commands/validate/lib/sam_template_validator.py", line 5, in <module>
from samtranslator.parser.parser import Parser
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samtranslator/parser/parser.py", line 2, in <module>
from samtranslator.validator.validator import SamTemplateValidator
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samtranslator/validator/validator.py", line 4, in <module>
import sam_schema
ModuleNotFoundError: No module named 'sam_schema'
Usage: sam [OPTIONS] COMMAND [ARGS]...
AWS Serverless Application Model (SAM) CLI
The AWS Serverless Application Model extends AWS CloudFormation to provide
a simplified way of defining the Amazon API Gateway APIs, AWS Lambda
functions, and Amazon DynamoDB tables needed by your serverless
application. You can find more in-depth guide about the SAM specification
here: https://github.com/awslabs/serverless-application-model.
Options:
--debug Turn on debug logging
--version Show the version and exit.
--help Show this message and exit.
Commands:
package Package an AWS SAM application. This is an alias for 'aws
cloudformation package'.
init Initialize a serverless application with a...
deploy Deploy an AWS SAM application. This is an alias for 'aws
cloudformation deploy'.
Expected result:
I expect the commands to work as expected. Displaying help should simply show:
Usage: sam [OPTIONS] COMMAND [ARGS]...
AWS Serverless Application Model (SAM) CLI
The AWS Serverless Application Model extends AWS CloudFormation to provide
a simplified way of defining the Amazon API Gateway APIs, AWS Lambda
functions, and Amazon DynamoDB tables needed by your serverless
application. You can find more in-depth guide about the SAM specification
here: https://github.com/awslabs/serverless-application-model.
Options:
--debug Turn on debug logging
--version Show the version and exit.
--help Show this message and exit.
Commands:
package Package an AWS SAM application. This is an alias for 'aws
cloudformation package'.
init Initialize a serverless application with a...
deploy Deploy an AWS SAM application. This is an alias for 'aws
cloudformation deploy'.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
macOS High Sierra 10.13.2 MBP 2017 2.8 GHz Intel Core i& 16 GB of RAM
Output of sam --version
:
~: sam --version
SAM CLI, version 0.3.0
Optional Debug logs:
Add --debug flag to command you are running
$ sam local invoke project --debug
2018-05-08 17:49:09 Command 'local' is not configured correctly. Unable to import 'samcli.commands.local.local'
Traceback (most recent call last):
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/cli/command.py", line 100, in get_command
mod = importlib.import_module(pkg_name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/commands/local/local.py", line 8, in <module>
from .invoke.cli import cli as invoke_cli
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/commands/local/invoke/cli.py", line 11, in <module>
from samcli.commands.local.cli_common.invoke_context import InvokeContext
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/commands/local/cli_common/invoke_context.py", line 18, in <module>
from ..lib.sam_function_provider import SamFunctionProvider
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/commands/local/lib/sam_function_provider.py", line 9, in <module>
from .sam_base_provider import SamBaseProvider
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/commands/local/lib/sam_base_provider.py", line 5, in <module>
from samcli.lib.samlib.wrapper import SamTranslatorWrapper
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samcli/lib/samlib/wrapper.py", line 18, in <module>
from samtranslator.validator.validator import SamTemplateValidator
File "/Users/john.bland/Library/Python/3.6/lib/python/site-packages/samtranslator/validator/validator.py", line 4, in <module>
import sam_schema
ModuleNotFoundError: No module named 'sam_schema'
Usage: sam [OPTIONS] COMMAND [ARGS]...
Error: No such command "local".
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 11
- Comments: 20 (7 by maintainers)
Looks like this issue is back. Getting Command ‘local’ is not configured correctly. Unable to import ‘samcli.commands.local.local’ with the usual trace ending … ImportError: No module named ssl_match_hostname pip uninstall backports.ssl-match-hostname pip install -U docker Did not fix, nor did updating packages, awscli aws-sam-cli & backports.ssl-match-hostname Clearly a problem with the backports.ssl-match-hostname. Local version is backports.ssl-match-hostname-3.5.0.1 Current work around is to change default python to 3.6 where backports.ssl-match-hostname is not needed.
Thanks, @jfuss doing:
As posted here made it work 🙌🏻
HORRIBLE user experience! It was so easy to install when it was a go lang application… There is no way I can convince my team of using this application when there is so much work around just to get it installed.
@johncblandii You are installing a py2 cli in py3. We don’t yet support py3 due to some dependencies not being available. Please install with py2.
Closing issue. Please reopen if py2 does not work.
Thanks. To resolve above issue on Ubuntu 18.10, the second solution here worked for me… https://stackoverflow.com/a/51071841
Refer - https://github.com/awslabs/aws-sam-cli/issues/425
@ayqazi As of now this is correct. Version 0.3.0 only supports Py2.
@kristof9851 That is the documentation of the develop branch which is ahead of all releases. Version 0.3.0 is only Py2 compatible.