Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cookiecutter command not found after installing with pip

I want to use cookiecutter to start a django project but for some reason cookiecutter cannot be found.

What I did was:

pip install cookiecutter

After that:

cookiecutter https://github.com/pydanny/cookiecutter-django

Then I get the error message:

    The program 'cookiecutter' is currently not installed. You can install it by typing:
    sudo apt install cookiecutter

However when I install cookiecutter with apt and run cookiecutter https://github.com/pydanny/cookiecutter-django I get an error.

Traceback (most recent call last):
  File "/usr/bin/cookiecutter", line 9, in <module>
    load_entry_point('cookiecutter==1.3.0', 'console_scripts', 'cookiecutter')()
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/cookiecutter/cli.py", line 100, in main
    config_file=user_config
  File "/usr/lib/python2.7/dist-packages/cookiecutter/main.py", line 140, in cookiecutter
    output_dir=output_dir
  File "/usr/lib/python2.7/dist-packages/cookiecutter/generate.py", line 327, in generate_files
    generate_file(project_dir, infile, context, env)
  File "/usr/lib/python2.7/dist-packages/cookiecutter/generate.py", line 167, in generate_file
    tmpl = env.get_template(infile_fwd_slashes)
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 812, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 786, in _load_template
    template = self.loader.load(self, name, globals)
  File "/usr/lib/python2.7/dist-packages/jinja2/loaders.py", line 125, in load
    code = environment.compile(source, name, filename)
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 565, in compile
    self.handle_exception(exc_info, source_hint=source_hint)
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "./LICENSE", line 3, in template
jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'now'. Jinja was looking for the following tags: 'elif' or 'else' or 'endif'. The innermost block that needs to be closed is 'if'.
  File "./LICENSE", line 3
    Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}

I understand this has to do with the version of cookiecutter which has to be >=1.4
The pip package is version 1.4, but that won't run.

What am I missing here?

I am using virtualbox so therefore this is not inside a virtualenv.

like image 912
Johan Vergeer Avatar asked Jul 03 '16 17:07

Johan Vergeer


People also ask

Where is Cookiecutter installed?

Cookiecutters (cloned Cookiecutter project templates) are put into ~/. cookiecutters/ by default, or cookiecutters_dir if specified. You can use local cookiecutters, or remote cookiecutters directly from Git repos or from Mercurial repos on Bitbucket.

What is the command to install PIP?

Run python get-pip.py . 2 This will install or upgrade pip. Additionally, it will install setuptools and wheel if they're not installed already.

What is Cookiecutter Python?

What is Cookiecutter? Cookiecutter is a Python package, easily installable with pip or other package managers, that enables you to create and use templates for microservices and software projects. It is a command-line tool that requires no knowledge of Python to use.


1 Answers

You can also run that with

python -m cookiecutter https://github.com/pydanny/cookiecutter-django
like image 155
Artem Kolontay Avatar answered Sep 21 '22 16:09

Artem Kolontay