aws-sam-cli: sam init errors with "No module named functools_lru_cache"
Description:
Steps to reproduce the issue:
$ sam init
Observed result:
[+] Initializing project structure...
Error: An error ocurred while generating this sam-app: Unable to load extension: No module named functools_lru_cache
Expected result:
It just works!™
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
macOS 10.13.5
Output of sam --version
:
SAM CLI, version 0.3.0
Optional Debug logs:
$ sam init --debug
2018-06-11 19:49:22 Init command
[+] Initializing project structure...
2018-06-11 19:49:22 Parameters dict created with input given
2018-06-11 19:49:22 {'no_input': False, 'output_dir': '.', 'template': '/Users/anon/Library/Python/2.7/lib/python/site-packages/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs'}
2018-06-11 19:49:22 Parameters dict updated with project name as extra_context
2018-06-11 19:49:22 {'extra_context': {'project_name': u'sam-app', 'runtime': 'nodejs8.10'}, 'no_input': True, 'output_dir': '.', 'template': '/Users/anon/Library/Python/2.7/lib/python/site-packages/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs'}
2018-06-11 19:49:22 Baking a new template with cookiecutter with all parameters
2018-06-11 19:49:22 context_file is /Users/anon/Library/Python/2.7/lib/python/site-packages/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs/cookiecutter.json
2018-06-11 19:49:22 Context generated is {u'cookiecutter': OrderedDict([(u'project_name', u'sam-app'), (u'runtime', 'nodejs8.10')])}
Error: An error ocurred while generating this sam-app: Unable to load extension: No module named functools_lru_cache
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 20 (9 by maintainers)
I had the same problem today. Resolved be uninstalling and installing backports.functools_lru_cache.
pip uninstall backports.functools_lru_cache
pip install backports.functools_lru_cache
After this everything is working again.
The root cause seems that the functools_lru_cache related files were missing -
The above solution of uninstall/install didn’t work for me. matplotlib devs on Ubuntu were having same issue. Following their discussion, fixed the missing module issue with following command -
sudo apt-get install python-matplotlib
Like @kepalas, the solution by @emilbryggare doesn’t work for me.
In my case (Ubuntu 16.04), I had to use
apt install python-backports.functools-lru-cache
sudo apt-get install python-matplotlib
works like charm
This didnt work for me. Solved the issue for myself on Fedora with the following: