Reputation: 301
I have been trying to solve an issue compiling a Python package for Windows, and part of that involves building contourpy
in the UCRT64 environment on MSYS2. I have been able to successfully build the package in virtualenv
using the following commands:
$ python -m virtualenv ~/envs/contourpy
$ source ~/envs/contourpy/bin/activate
# Compile contourpy
$ git clone https://github.com/contourpy/contourpy.git
$ cd contourpy
$ meson setup builddir
$ ninja -C builddir
$ meson install -C builddir --destdir /home/guest/envs/contourpy
These options allow me to build contourpy successfully. However when I try running pip list
, it doesn't show up in this environment.
When I try to run pip install .
directly, I get the following error messages:
Found ninja.EXE-1.11.1.git.kitware.jobserver-1 at C:/msys64/tmp/pip-build-env-0ba4jhpg/normal/bin/ninja.EXE
Visual Studio environment is needed to run Ninja. It is recommended to use Meson wrapper:
C:/msys64/tmp/pip-build-env-0ba4jhpg/overlay/bin/meson compile -C .
+ meson compile --ninja-args=['-v']
Is there a way I can get this package to perform the compilation while using pip install .
?
Upvotes: 0
Views: 655
Reputation: 301
I managed to resolve the issue.
In the pyproject.toml
file in the repo, the following line needs to be commented out:
...
[tool.meson-python.args]
compile = [
"-v",
]
dist = []
install = []
setup = [
# "--vsenv", # Forces use of MSVC on Windows, ignored on other platforms
]
...
The UCRT64/MSYS2 environment doesn't appear to support MSVC (or I might have missed out on installing the compilers), resulting in the meson-python
running in the backend failing. Disabling this line allows pip install .
for contourpy
to work on UCRT64/MSYS2.
Upvotes: 1