Cookiecutter-django: Startup procedure appears broken with a missing module: functools_lru_cache

Created on 28 Nov 2017  路  9Comments  路  Source: pydanny/cookiecutter-django

  • __I'm submitting a ...__

    • [x] bug report
    • [ ] feature request
    • [ ] support request => Please do not submit support request here, see note at the top of this template.
  • Do you want to request a feature or report a bug?

Report a bug.

  • What is the current behavior?

When following the steps described here, I receive the following error (using both Python3.5 and Python3.6),

$ cookiecutter https://github.com/pydanny/cookiecutter-django
You've downloaded /Users/statwonk/.cookiecutters/cookiecutter-django before. Is it okay to delete and re-download it? [yes]: yes
Unable to load extension: No module named functools_lru_cache
  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
$ virtualenv --python=python3.6 venv
$ source venv/bin/activate
$ pip install "cookiecutter>=1.4.0"
$ cookiecutter https://github.com/pydanny/cookiecutter-django
  • What is the expected behavior?

A sequence that asks for the set of Cookiecutter options I'd like to select. Instead I see,

$ cookiecutter https://github.com/pydanny/cookiecutter-django
You've downloaded /Users/statwonk/.cookiecutters/cookiecutter-django before. Is it okay to delete and re-download it? [yes]: yes
Unable to load extension: No module named functools_lru_cache

and the process ends.

  • What is the motivation / use case for changing the behavior?

  • Please tell us about your environment:

Mac OS X, brew installed.

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)

Most helpful comment

The pip command is probably linked to Python 2.7. Try pip3 instead.

All 9 comments

I suspect this is a Cookiecutter issue, not related to Cookiecutter Django. Some questions:

  1. How did you install Cookiecutter?
  2. Do you get the same error when you run Cookiecutter against another template?

Ah! I installed Cookiecutter with pip install "cookiecutter>=1.4.0" _after_ activating the python3.5 and/or python3.6 virtualenv.

It looks like your theory is right as I see the same issue with cookiecutter-flask,

$ cookiecutter https://github.com/pydanny/cookiecutter-flask
Unable to load extension: No module named functools_lru_cache

In your virtualenv, try: pip install -U cookiecutter

Cookiecutter comes with a --version flag which also tells you where it is installed.

cookiecutter --version

Ah, I might have found the culprit! Event after using pip install -U cookiecutter with the virtualenv activated (python3.6), I saw the same error. However when I run, cookiecutter --version I see,

$ cookiecutter --version
Cookiecutter 1.6.0 from /usr/local/lib/python2.7/site-packages (Python 2.7)

Appears the global 2.7 version is being used? I'm surprised the virtualenv didn't protect me from this.

I found out this the hard way as well. I use "pyenv" now.

The pip command is probably linked to Python 2.7. Try pip3 instead.

Thank you all!

For others that may find this. I hit this again and outside of the virutualenv (deactivated), I had to, pip uninstall cookiecutter to remote the 2.7 version. That is activating a new virtualenv, pip3 install cookiecutter won't necessarily prevent the global library from being used.

Was this page helpful?
0 / 5 - 0 ratings