mikeckennedy/python-for-entrepreneurs-course-demos

cookiecutter not working on mac

alexfowler opened this issue · 3 comments

when I try to run the following cookiecutter command:
cookiecutter https://github.com/Pylons/pyramid-cookiecutter-starter

I get the following error:

Traceback (most recent call last):
File "/Users/afowler/Desktop/test_project/.env/bin/cookiecutter", line 11, in
sys.exit(main())
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/cookiecutter/cli.py", line 120, in main
password=os.environ.get('COOKIECUTTER_REPO_PASSWORD')
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/cookiecutter/main.py", line 63, in cookiecutter
password=password
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/cookiecutter/repository.py", line 103, in determine_repo_dir
no_input=no_input,
File "/Users/afowler/Desktop/test_project/.env/lib/python3.6/site-packages/cookiecutter/vcs.py", line 99, in clone
stderr=subprocess.STDOUT,
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', 'clone', 'https://github.com/Pylons/pyramid-cookiecutter-starter']' returned non-zero exit status 1.

I'm using Python 3.6.3 and Mac OS High Sierra version 10.13.2. Any idea what the problem could be?

It looks like you installed cookiecutter into your virtual environment, and had activated it. Is that correct?

The stack trace means git clone https://github.com/Pylons/pyramid-cookiecutter-starter failed. It could have been a temporary network glitch or GitHub outage. That command should work, unless you lack permissions to write into the location where you invoked cookiecutter.

There's a SO post that can help you examine the error:
https://stackoverflow.com/questions/27920837/python-subprocess-check-output-returned-non-zero-exit-status-1

@stevepiercy I get the same error even when I run the command from outside of my virtual environment

@mikeckennedy when i typed git on the command line i got the following error:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

When googling the error, I came across this stackoverflow solution and it seems like it has to do with needing to download and install xcode developer tools when you upgrade to macOs Sierra! Nice tip @mikeckennedy !