torchbox/vagrant-django-template

Error setting up virtualenv during provisioning.

joshainglis opened this issue · 2 comments

Hi!
I'm getting an error when the provisioning script attempts to set up the virtualenv within the Vagrant Box.

virtualenv newproject
source newproject/bin/activate
cd newproject
pip install django==1.5.4
django-admin.py startproject --template https://github.com/torchbox/vagrant-django-template/zipball/master --name=Vagrantfile newproject
cd newproject
vagrant up

Seems that when it reaches this point:

# virtualenv setup for project
su - vagrant -c "/usr/local/bin/virtualenv $VIRTUALENV_DIR && \
    echo $PROJECT_DIR > $VIRTUALENV_DIR/.project && \
    PIP_DOWNLOAD_CACHE=/home/vagrant/.pip_download_cache $VIRTUALENV_DIR/bin/pip install -r $PROJECT_DIR/requirements.txt"

It spits out this error:

New python executable in /home/vagrant/.virtualenvs/newproject/bin/python
Installing setuptools, pip...

  Complete output from command /home/vagrant/.virtu...ewproject/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip:
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv_support/pip-1.5.1-py2.py3-none-any.whl/pip/__init__.py", line 9, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv_support/pip-1.5.1-py2.py3-none-any.whl/pip/log.py", line 9, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv_support/pip-1.5.1-py2.py3-none-any.whl/pip/_vendor/pkg_resources.py", line 2696, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv_support/pip-1.5.1-py2.py3-none-any.whl/pip/_vendor/pkg_resources.py", line 429, in __init__
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv_support/pip-1.5.1-py2.py3-none-any.whl/pip/_vendor/pkg_resources.py", line 443, in add_entry
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv_support/pip-1.5.1-py2.py3-none-any.whl/pip/_vendor/pkg_resources.py", line 1722, in find_in_zip
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv_support/pip-1.5.1-py2.py3-none-any.whl/pip/_vendor/pkg_resources.py", line 1298, in has_metadata
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv_support/pip-1.5.1-py2.py3-none-any.whl/pip/_vendor/pkg_resources.py", line 1614, in _has
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv_support/pip-1.5.1-py2.py3-none-any.whl/pip/_vendor/pkg_resources.py", line 1488, in _zipinfo_name
AssertionError: /usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/EGG-INFO/PKG-INFO is not a subpath of /usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv_support/setuptools-2.1-py2.py3-none-any.whl/
----------------------------------------
...Installing setuptools, pip...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.11.1', 'console_scripts', 'virtualenv')()
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv.py", line 824, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv.py", line 992, in create_environment
    install_wheel(to_install, py_executable, search_dirs)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv.py", line 960, in install_wheel
    'PIP_NO_INDEX': '1'
  File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11.1-py2.7.egg/virtualenv.py", line 902, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/vagrant/.virtu...ewproject/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip failed with error code 1
-su: /home/vagrant/.virtualenvs/newproject/bin/activate: No such file or directory
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell newproject

Any idea how I might fix this?

Hi @joshainglis, sorry for the delay in responding I'm not sure why you were getting the error, I built the box okay with the default precise32 image - is that what you were using?

In any case, I've just merged a pull request from @boblannon that fixes an install problem with a precise64 image. Could you update and give it another try?

Hi @nealtodd, that worked perfectly. Thanks :)