I’m trying to keep my Python system-level install as clean as possible on Windows, but also trying to get Buildbot set up in a virtualenv. Unfortunately, some of the Buildbot dependencies want to build native extensions, and the most important — Twisted — just fails.
This is all I have in my system-level site-packages
:
1
2
3
4
5
|
c:\>pip freeze
distribute==0.6.35
ipython==0.13.1
pyreadline==1.7.1
virtualenv==1.8.4
|
If I create a new virtualenv with --no-site-packages
, then try to install the buildbot-slave
package, I get the dreaded "Unable to find vcvarsall.bat"
when Twisted is being installed:
1
2
3
|
copying twisted\test\raiser.c -> build\lib.win32-2.7\twisted\test
running build_ext
error: Unable to find vcvarsall.bat
|
Unfortunately, if you download and attempt to install the Twisted redistributable package from their website directly into a virtualenv, the installer package will register itself with the system, even if you select the “Install just for me” option. In other words, you can’t just have the package install itself portably into multiple virtualenvs:
-
Select “Install just for me”
- Set “Python 2.7 from registry” to “Entire feature will be unavailable”
- Set “Python from another location” to “Will be installed on local hard drive”
- Set “Provide an alternate Python location” to the location of your virtualenv
"c:\virtualenv"
The User Account Control (UAC) dialog will pop up, and after the install, you’ll be stuck with a single install of Twisted which can only be Repaired or Removed:
This situation kind of sucks. Unfortunately, the .exe version of the installer also won’t let you choose where to install its contents. It just gets stuck on the dialog where it autodetects your existing Python 2.7 installation, but won’t let you choose a different site-packages
folder as a file destination. It only goes for the global install.
The solution is to download the .exe version of the installer, unpack it using something like 7-zip, and then copy the files from the PLATLIB
folder to your virtualenv’s Libs\site-packages
and the the files from the SCRIPTS
folder to your virtualenv’s Scripts
folder.
Then, the next time you run pip freeze
, you should see something like:
1
2
|
(virtualenv) C:\virtualenv>pip freeze
Twisted==13.1.0
|
Then you can install the rest of the Buildbot packages:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
(virtualenv) c:\virtualenv>pip install sqlalchemy==0.7.10
Downloading/unpacking sqlalchemy==0.7.10
Downloading SQLAlchemy-0.7.10.tar.gz (3.5MB): 3.5MB downloaded
Running setup.py egg_info for package sqlalchemy
warning: no files found matching '*.jpg' under directory 'doc'
no previously-included directories found matching 'doc\build\output'
Installing collected packages: sqlalchemy
Running setup.py install for sqlalchemy
building 'sqlalchemy.cprocessors' extension
***************************************************************************
Unable to find vcvarsall.bat
WARNING: The C extension could not be compiled, speedups are not enabled.
Failure information, if any, is above.
Retrying the build without the C extension now.
***************************************************************************
warning: no files found matching '*.jpg' under directory 'doc'
no previously-included directories found matching 'doc\build\output'
***************************************************************************
WARNING: The C extension could not be compiled, speedups are not enabled.
Plain-Python build succeeded.
***************************************************************************
Successfully installed sqlalchemy
Cleaning up...
(virtualenv) c:\virtualenv>pip install buildbot-slave
Downloading/unpacking buildbot-slave
Downloading buildbot-slave-0.8.8.zip (164kB): 164kB downloaded
Running setup.py egg_info for package buildbot-slave
Requirement already satisfied (use --upgrade to upgrade): twisted>=8.0.0 in c:\virtualenv\lib\site-packages (from buildbot-slave)
Downloading/unpacking zope.interface>=3.6.0 (from twisted>=8.0.0->buildbot-slave)
Downloading zope.interface-4.0.5.zip (173kB): 173kB downloaded
Running setup.py egg_info for package zope.interface
warning: no previously-included files matching '*.dll' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
Requirement already satisfied (use --upgrade to upgrade): setuptools in c:\virtualenv\lib\site-packages\setuptools-0.6c11-py2.7.egg (from
zope.interface>=3.6.0->twisted>=8.0.0->buildbot-slave)
Installing collected packages: buildbot-slave, zope.interface
Running setup.py install for buildbot-slave
Running setup.py install for zope.interface
warning: no previously-included files matching '*.dll' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
building 'zope.interface._zope_interface_coptimizations' extension
********************************************************************************
WARNING:
An optional code optimization (C extension) could not be compiled.
Optimizations for this package will not be available!
()
Unable to find vcvarsall.bat
********************************************************************************
Skipping installation of c:\virtualenv\Lib\site-packages\zope\__init__.py (namespace package)
Installing c:\virtualenv\Lib\site-packages\zope.interface-4.0.5-py2.7-nspkg.pth
Successfully installed buildbot-slave zope.interface
Cleaning up...
(virtualenv) c:\virtualenv>pip freeze
SQLAlchemy==0.7.10
Twisted==13.1.0
buildbot-slave==0.8.8
zope.interface==4.0.5
|
Just got the same problem: settings up buildbot-slave on windows.
After some research, found that use pip install –use-wheel twisted is the easiest way to install twisted in a virtualenv on windows.
Thanks for the tip!