Sceptre/sceptre

ModuleNotFoundError: No module named 'resolver.file'

davemorrow-telus opened this issue · 3 comments

Subject of the issue

ModuleNotFoundError: No module named 'resolver.file'

Your environment

Amazon Linux 2
Python 3.7
sceptre v 3.3.0 and v 4.2.1 (tried both)

Steps to reproduce

Running sceptre command line to validate stack

Expected behaviour

sceptre should work :)

Actual behaviour

ModuleNotFoundError: No module named 'resolver.file'

Full trace I am seeing

14-Jun-2023 20:24:25 [2023-06-14 20:24:25] - Adding yaml constructors for the entry point groups ['sceptre.hooks', 'sceptre.resolvers']
14-Jun-2023 20:24:25 [2023-06-14 20:24:25] - Added constructor for <class 'sceptre.hooks.asg_scaling_processes.ASGScalingProcesses'> with node tag !asg_scheduled_actions
14-Jun-2023 20:24:25 [2023-06-14 20:24:25] - Added constructor for <class 'sceptre.hooks.cmd.Cmd'> with node tag !cmd
14-Jun-2023 20:24:25 [2023-06-14 20:24:25] - Added constructor for <class 'sceptre.resolvers.environment_variable.EnvironmentVariable'> with node tag !environment_variable
14-Jun-2023 20:24:25 [2023-06-14 20:24:25] - Added constructor for <class 'sceptre.resolvers.file_contents.FileContents'> with node tag !file_contents
14-Jun-2023 20:24:25 [2023-06-14 20:24:25] - Added constructor for <class 'sceptre.resolvers.no_value.NoValue'> with node tag !no_value
14-Jun-2023 20:24:25 [2023-06-14 20:24:25] - Added constructor for <class 'sceptre.resolvers.stack_attr.StackAttr'> with node tag !stack_attr
14-Jun-2023 20:24:25 [2023-06-14 20:24:25] - Added constructor for <class 'sceptre.resolvers.stack_output.StackOutput'> with node tag !stack_output
14-Jun-2023 20:24:25 [2023-06-14 20:24:25] - Added constructor for <class 'sceptre.resolvers.stack_output.StackOutputExternal'> with node tag !stack_output_external
14-Jun-2023 20:24:25 [2023-06-14 20:24:25] - Added constructor for <class 'resolver.ssm.SSM'> with node tag !ssm
14-Jun-2023 20:24:25 [2023-06-14 20:24:25] - Added constructor for <class 'resolver.rcmd.SceptreResolverCmd'> with node tag !rcmd
14-Jun-2023 20:24:25 Traceback (most recent call last):
14-Jun-2023 20:24:25 File "turnlane_virtenv/bin/sceptre", line 8, in
14-Jun-2023 20:24:25 sys.exit(cli())
14-Jun-2023 20:24:25 File "/usr/local/lib64/python3.7/site-packages/click/core.py", line 764, in call
14-Jun-2023 20:24:25 return self.main(*args, **kwargs)
14-Jun-2023 20:24:25 File "/usr/local/lib64/python3.7/site-packages/click/core.py", line 717, in main
14-Jun-2023 20:24:25 rv = self.invoke(ctx)
14-Jun-2023 20:24:25 File "/usr/local/lib64/python3.7/site-packages/click/core.py", line 1137, in invoke
14-Jun-2023 20:24:25 return _process_result(sub_ctx.command.invoke(sub_ctx))
14-Jun-2023 20:24:25 File "/usr/local/lib64/python3.7/site-packages/click/core.py", line 956, in invoke
14-Jun-2023 20:24:25 return ctx.invoke(self.callback, **ctx.params)
14-Jun-2023 20:24:25 File "/usr/local/lib64/python3.7/site-packages/click/core.py", line 555, in invoke
14-Jun-2023 20:24:25 return callback(*args, **kwargs)
14-Jun-2023 20:24:25 File "/usr/local/lib64/python3.7/site-packages/click/decorators.py", line 17, in new_func
14-Jun-2023 20:24:25 return f(get_current_context(), *args, **kwargs)
14-Jun-2023 20:24:25 File "/home/bamboo/bamboo-agent-home/xml-data/build-dir/TCC-AWSAB0-BA/turnlane_virtenv/lib64/python3.7/site-packages/sceptre/cli/helpers.py", line 42, in decorated
14-Jun-2023 20:24:25 return func(*args, **kwargs)
14-Jun-2023 20:24:25 File "/home/bamboo/bamboo-agent-home/xml-data/build-dir/TCC-AWSAB0-BA/turnlane_virtenv/lib64/python3.7/site-packages/sceptre/cli/template.py", line 45, in validate_command
14-Jun-2023 20:24:25 plan = SceptrePlan(context)
14-Jun-2023 20:24:25 File "/home/bamboo/bamboo-agent-home/xml-data/build-dir/TCC-AWSAB0-BA/turnlane_virtenv/lib64/python3.7/site-packages/sceptre/plan/plan.py", line 36, in init
14-Jun-2023 20:24:25 config_reader = ConfigReader(context)
14-Jun-2023 20:24:25 File "/home/bamboo/bamboo-agent-home/xml-data/build-dir/TCC-AWSAB0-BA/turnlane_virtenv/lib64/python3.7/site-packages/sceptre/config/reader.py", line 134, in init
14-Jun-2023 20:24:25 self._add_yaml_constructors(["sceptre.hooks", "sceptre.resolvers"])
14-Jun-2023 20:24:25 File "/home/bamboo/bamboo-agent-home/xml-data/build-dir/TCC-AWSAB0-BA/turnlane_virtenv/lib64/python3.7/site-packages/sceptre/config/reader.py", line 177, in _add_yaml_constructors
14-Jun-2023 20:24:25 node_class = entry_point.load()
14-Jun-2023 20:24:25 File "/home/bamboo/bamboo-agent-home/xml-data/build-dir/TCC-AWSAB0-BA/turnlane_virtenv/lib64/python3.7/site-packages/pkg_resources/init.py", line 2462, in load
14-Jun-2023 20:24:25 return self.resolve()
14-Jun-2023 20:24:25 File "/home/bamboo/bamboo-agent-home/xml-data/build-dir/TCC-AWSAB0-BA/turnlane_virtenv/lib64/python3.7/site-packages/pkg_resources/init.py", line 2468, in resolve
14-Jun-2023 20:24:25 module = import(self.module_name, fromlist=['name'], level=0)
14-Jun-2023 20:24:25 ModuleNotFoundError: No module named 'resolver.file'
14-Jun-2023 20:24:25 Error Code 1

I've seen this sort of thing happen when your entrypoints get messed up somewhow. My recommendation would be to delete your virtual environment and start a new one with a fresh install of sceptre. See if that solves the problem.

Thanks. I figured it out. When creating virtual env I was including site-packages and it would seem thats where the deprecated module was being referenced.