Reputation: 1301
I am trying to create a dev environment for the Django 1.4 project using the following guide:
http://www.stereoplex.com/blog/a-django-development-environment-with-zc-buildout
virtualenv part of the guide runs ok with the following output:
virtualenv project
New python executable in project\Scripts\python.exe
Installing setuptools................done.
Installing pip...................done.
After that I am able to activate dev environment. Now I create directory named Source, download the bootstrap.py to it and create a buildout.cfg with the following content:
[buildout]
parts =
And run bootstrap.py for the following result:
Creating directory 'C:\\Dropbox\\XYZ\\project\\Source\\bin'.
Creating directory 'C:\\Dropbox\\XYZ\\project\\Source\\parts'.
Creating directory 'C:\\Dropbox\\XYZ\\project\\Source\\eggs'.
Creating directory 'C:\\Dropbox\\XYZ\\project\\Source\\develop-eggs'.
Generated script 'C:\\Dropbox\\XYZ\\project\\Source\\bin\\buildout'.
Here comes the problem part - Installing Django I configure the buildout.cfg to the following and run bin\buildout created by bootstrap:
[buildout]
parts = django
[django]
recipe = djangorecipe
version = 1.4
After running bin\buildout i get the following error:
(project) C:\Dropbox\XYZ\project\Source>bin\buildout.exe
Traceback (most recent call last):
File "C:\Dropbox\XYZ\project\Source\bin\buildout-script.py", line 15, in <module> import site # imports custom buildout-generated site.py
File "C:\Dropbox\XYZ\project\Source\parts\buildout\site.py", line 601, in <module> main()
File "C:\Dropbox\XYZ\project\Source\parts\buildout\site.py", line 584, in main known_paths = addsitepackages(known_paths)
File "C:\Dropbox\XYZ\project\Source\parts\buildout\site.py", line 328, in addsitepackages import pkg_resources
ImportError: No module named pkg_resources
Although if I run python directly in project environment I can import pkg_resources with no error:
(project) C:\Dropbox\XYZ\project\Source>python
Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> pkg_resources
<module 'pkg_resources' from 'C:\Dropbox\XYZ\project\lib\site-packages\setuptools-0.6c11-py2.7.egg\pkg_resources.py'>
I am completely struck here. Any suggestions?
Upvotes: 3
Views: 1389
Reputation: 3809
The guide you are following is a little bit obsolete. It will fail when processing the [django]
part, specifically in the version
variable. You must specify the versions in the new way, which is showed in the djangorecipe page. This is:
[buildout]
parts = django
versions = versions
[versions]
django = 1.4
Upvotes: 3
Reputation: 13624
I don't have the definitive answer, but here are some brainstorm thoughts:
Why the virtualenv? Buildout itself provides isolation, so no virtualenv is needed. Could you re-try with just a bootstrap.py and your buildout.cfg? So just run bootstrap.py with your system python?
Do you have buildout installed globally, perhaps? They can interfere.
The latest 1.5.2 buildout has some problems with site.py files in some situations, which is a possible reason for it failing inside a virtualenv. Could you try the special 1.4.4 bootstrap mentioned in http://pypi.python.org/pypi/zc.buildout/1.5.2#system-python-and-zc-buildout-1-5 ?
bin/buildout -vvv
gives you much more debugging info.
An additional comment: the version
setting in djangorecipe is deprecated in the latest versions of djangorecipe. You can remove it. If you want to pin Django you have to pin it in your buildout's [version]
list.
Upvotes: 5