Skip to content


--compiler build option on windows #18

vbabiy opened this Issue · 17 comments

On Windows while installing from source code several packages (psycopg2, PIL, ...) emit an error:

error: Unable to find vcvarsall.bat

The issue is being fixed by installing MinGW and using mingw32 compiler like this: install build --compiler=mingw32

As far as I see, it would be very good for PIP to have "--build-option" like "--install-option", so that one could use PIP with mingw32 compiler:

pip install --build-option="--compiler=mingw32" psycopg2


I could solve the problem adding:



to the file distutils.cfg in C:\Python27\Lib\distutils\



Original Comment By:

I would also like to see pip support a --build-option for the same reason. I
recently ran into the issue when using pip to install MarkupSafe and ended up
using a %USERPROFILE%\pydistutils.cfg file with the same content as the OP.

Original Comment By: Anonymous

I wonder does '--install-option' meet your requirements? I have not tried it,
but it looks like it will work. Note, it's "hidden" in the help output of the
install command.

# pip install --help



                        Extra arguments to be supplied to the


                        command (use like --install-option="--install-

                        scripts=/usr/local/bin").  Use multiple --install-

                        option options to pass multiple options to

                        install.  If you are using an option with a


                        path, be sure to use absolute path.

Original Comment By: Kelsey Hightower

Using --install-option in the following manner doesn't currently work. I still
need to do something like as a

C:\tools>pip --version pip 0.8.2 from c:\python27\lib\site-
packages\pip-0.8.2-py2.7.egg (python 2.7)

C:\tools>pip install --install-option="--compiler=mingw32" markupsafe
Downloading/unpacking markupsafe Running egg_info for package

Installing collected packages: markupsafe Running install for
markupsafe usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or:
-c --help [cmd1 cmd2 ...] or: -c --help-commands or: -c cmd --help

error: option --compiler not recognized

Original Comment By:
Python Packaging Authority member

See also issue #167


Thanks vbabiy for the workaround. I too would like to see this option.




Need some easy-to-use command-line way to install mercurial via pip on windows. Since Microsoft (c) (r) (tm) removed compiler from Windows 8 (c) (r) (tm) SDK, it's more important now.


Could somebody from core devs please comment on what's needed to move this forward? Is addition of --build-option option and passing its value to build the way to go?

Python Packaging Authority member

pip doesn't currently call build directly to be able to pass the options.
more likely in the short term I think that we add build option support to "pip wheel", which is due out in pip-1.4?
not sure, see #881, @dholth , @pfmoore ?

Python Packaging Authority member
Python Packaging Authority member

Can we ask you to do it manually for those non-default builds

what are you suggesting? how manually?

I guess somebody can do this?

pip install --no-install SomePackage
cd <venv>/build/SomePackage
python build --compiler=special-compiler
pip install --no-download SomePackage

is introduction --build-option still on the table? I could need this for h5p's --mpi flag that can not be addressed via the environment either.

Python Packaging Authority member

It's a terrible hack, but you can abuse --global-option for this. Because --global-option values are added to the setup invocation before the install command, you can do things like

pip install --global-option build_ext --global-option --compiler=mingw32 foo

This constructs a command line that looks like

python build_ext --compiler=mingw32 install

(but if you say I told you to do this, I'll deny everything :-))

I suspect there won't be much change to what's currently available - the long-term goal is to make the build process independent of the install process, and in the meantime, the recommendation is really to build wheels. Either get the project to supply (Windows and/or OSX) wheels on PyPI, or if that's not practical, build wheels yourself locally ( bdist_wheel should always be possible) and serve them from a local directory or a devpi instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.