Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not set compiler to mingw32 on Windows #5

Merged
merged 1 commit into from
Sep 13, 2020

Conversation

tschoonj
Copy link
Contributor

With this patch, msvc is used, which is the default for building
Python extensions on Windows.
Currently, one must force usage of msvc when building bdist_wheel and
installing with something like:

%PYTHON% -m pip install . -vv --global-option build --global-option --compiler=msvc --global-option build --global-option --cythonize

This kind of command will no longer work in the next major release of
pip: pypa/pip#8368

With this patch, msvc is used, which is the default for building
Python extensions on Windows.
Currently, one must force usage of msvc when building bdist_wheel and
installing with something like:

%PYTHON% -m pip install . -vv --global-option build --global-option
--compiler=msvc --global-option build --global-option --cythonize

This kind of command will no longer work in the next major release of
pip: pypa/pip#8368
@anxuae
Copy link
Owner

anxuae commented Sep 12, 2020

Thanks for your PR.

I don't understand the link with pypa/pip#8368 ? This only explains that the command "install" will not be run anymore if the bdist_wheel command fails. Thus there is not impact on your command line, you can still use it and set the compiler you want.

@tschoonj
Copy link
Contributor Author

I don't think so.

Currently if bdist_wheel cannot be executed due to options being passed, it falls back to python setup.py install. In the next release of pip, there will be no fallback anymore and it will simply fail.

Without this PR merged in, I need to provide these options to complete the installation, which will no longer work with the next pip release.

Also, it doesn't make a lot of sense IMHO to use mingw32 as compiler since Python on Windows uses msvc as default anyway. Building binary extensions with mingw32 is certainly not impossible, but it is quite convoluted to do so.

@anxuae
Copy link
Owner

anxuae commented Sep 12, 2020

Ok, I understand your needs but it solves only the issue for msvc users. It is a half-solution.

The pip 21.0 seems to impose that bdist_wheel should never fail. Thus we need to understand why setup.py bdist_wheel does not generate a wheel and find a way to handle the errors.

As I understand the pypa/pip#8368 issue, the following command will remain correct and not deprecated:

pip install . --global-option build --global-option --cythonize --global-option build --global-option --compiler=msvc

A wheel will be systematically generated then installed

@tschoonj
Copy link
Contributor Author

If I execute that command now I get:

 pip install . --global-option build --global-option --cythonize --global-option build --global-option --compiler=msvc                                                                                                                                                  C:\Users\TomSc\miniconda3\envs\temp\lib\site-packages\pip\_internal\commands\install.py:235: UserWarning: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.

And it proceeds with python setup.py install, which won't work anymore with the next pip update.

IMHO solving the issue for msvc users is the most important thing here: building extensions with mingw32 is a very exotic and complicated thing to do, and is because of this rarely done.

@tschoonj
Copy link
Contributor Author

Just to be absolutely clear: with that command no wheel is generated.

@anxuae
Copy link
Owner

anxuae commented Sep 12, 2020

Ok, but I have exactly the same warning running the command:

pip wheel . --global-option build --global-option --cythonize --global-option build --global-option --compiler=msvc

The wheel is correctly created (this is mainly exactly the same as running python setup.py bdist_wheel ... ), then it can be installed running pip install *.whl

This warning is a nonsense and no decision has been made about it: see pypa/pip#2677 (comment).

@tschoonj
Copy link
Contributor Author

The pip wheel command is not useful in conda recipes, which is what use. Apologies for not bringing this up earlier.

Either way, even if you are not convinced about the significance of the upcoming changes in pip, I believe that you should still consider merging this PR in, as it makes no sense to make mingw32 the default compiler on Windows.

@anxuae
Copy link
Owner

anxuae commented Sep 13, 2020

Ok for merging and make msvc as default compiler on windows.

By the way, the warning will be still here due to the need of the --cythonize option.

@anxuae anxuae merged commit 983ad77 into anxuae:master Sep 13, 2020
@tschoonj
Copy link
Contributor Author

Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants