Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

--compiler build option on windows #18

Open
vbabiy opened this Issue · 17 comments
@vbabiy

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:

setup.py 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

@vbabiy

I could solve the problem adding:

[build]

compiler=mingw32

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

compilers-on-windows

config-files


Original Comment By: http://docs.python.org/install/index.html#using-non-microsoft-compilers-on-windows
@vbabiy

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
@vbabiy

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

....


--install-option=INSTALL_OPTIONS

                        Extra arguments to be supplied to the setup.py

install

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

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

                        option options to pass multiple options to

setup.py

                        install.  If you are using an option with a

directory

                        path, be sure to use absolute path.

Original Comment By: Kelsey Hightower
@vbabiy

Using --install-option in the following manner doesn't currently work. I still
need to do something like http://jonforums.github.com/python.html as a
workaround.

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 setup.py egg_info for package
markupsafe

Installing collected packages: markupsafe Running setup.py 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: http://jonforums.github.com/python.html
@pnasrat
Owner

See also issue #167

@hickford

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

@gimmi

+1

@eyeofhell

+1
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.

@piotr-dobrogost

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 setup.py build the way to go?

@qwcode
Owner

pip doesn't currently call setup.py 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 ?

@dholth
Owner
@qwcode
Owner

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 setup.py build --compiler=special-compiler
pip install --no-download SomePackage
@ax3l

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.

@pfmoore
Owner

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 setup.py 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 (setup.py bdist_wheel should always be possible) and serve them from a local directory or a devpi instance.

@bgilbert bgilbert referenced this issue in openslide/openslide-python
Closed

Cannot install on Python 2.7.9 (x64) + Windows 7 x64 #13

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.