Python 3.10 wheels and compatibility
MatthieuDartiailh opened this issue · 6 comments
Hi I tried to install mplcairo on Python 3.10 but discovered there is no wheels for it and when attempting to build one I met the following nasty traceback:
Collecting mplcairo
Downloading mplcairo-0.4.tar.gz (92 kB)
---------------------------------------- 92.2/92.2 kB 1.7 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Collecting matplotlib>=2.2
Downloading matplotlib-3.5.3-cp310-cp310-win_amd64.whl (7.2 MB)
---------------------------------------- 7.2/7.2 MB 51.0 MB/s eta 0:00:00
Collecting pillow
Downloading Pillow-9.2.0-cp310-cp310-win_amd64.whl (3.3 MB)
---------------------------------------- 3.3/3.3 MB 69.5 MB/s eta 0:00:00
Requirement already satisfied: packaging>=20.0 in c:\users\matthieu.dartiailh\anaconda3\envs\py310\lib\site-packages (from matplotlib>=2.2->mplcairo) (21.0)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\matthieu.dartiailh\anaconda3\envs\py310\lib\site-packages (from matplotlib>=2.2->mplcairo) (1.3.2)
Collecting cycler>=0.10
Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Requirement already satisfied: numpy>=1.17 in c:\users\matthieu.dartiailh\anaconda3\envs\py310\lib\site-packages (from matplotlib>=2.2->mplcairo) (1.21.4)
Collecting fonttools>=4.22.0
Downloading fonttools-4.34.4-py3-none-any.whl (944 kB)
---------------------------------------- 944.1/944.1 kB ? eta 0:00:00
Requirement already satisfied: pyparsing>=2.2.1 in c:\users\matthieu.dartiailh\anaconda3\envs\py310\lib\site-packages (from matplotlib>=2.2->mplcairo) (2.4.7)
Collecting python-dateutil>=2.7
Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Requirement already satisfied: six>=1.5 in c:\users\matthieu.dartiailh\anaconda3\envs\py310\lib\site-packages (from python-dateutil>=2.7->matplotlib>=2.2->mplcairo) (1.16.0)
Building wheels for collected packages: mplcairo
Building wheel for mplcairo (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [31 lines of output]
C:\Users\matthieu.dartiailh\Anaconda3\envs\py310\lib\site-packages\setuptools\installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-310
creating build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\base.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\gtk.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\gtk_native.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\macosx.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\multipage.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\qt.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\tk.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\wx.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\_backports.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\_util.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\_version.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\__init__.py -> build\lib.win-amd64-cpython-310\mplcairo
running build_ext
building 'mplcairo._mplcairo' extension
creating build\temp.win-amd64-cpython-310
creating build\temp.win-amd64-cpython-310\Release
creating build\temp.win-amd64-cpython-310\Release\src
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\matthieu.dartiailh\AppData\Local\Temp\pip-install-cryzp84l\mplcairo_8b94e57afec74d049241a90dd713db7f\.eggs\pycairo-1.21.0-py3.10-win-amd64.egg\cairo\include -Ic:\users\matthieu.dartiailh\appdata\local\temp\pip-install-cryzp84l\mplcairo_8b94e57afec74d049241a90dd713db7f\.eggs\pybind11-2.10.0-py3.10.egg\pybind11\include -Ibuild\include -IC:\Users\matthieu.dartiailh\Anaconda3\envs\py310\Library\include -IC:\Users\matthieu.dartiailh\Anaconda3\envs\py310\include -IC:\Users\matthieu.dartiailh\Anaconda3\envs\py310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /EHsc /Tpsrc/_unity_build.cpp /Fobuild\temp.win-amd64-cpython-310\Release\src/_unity_build.obj /EHsc /bigobj /std:c++17 /experimental:preprocessor /wd4244 /wd4267
cl : Command line warning D9035 : option 'experimental:preprocessor' has been deprecated and will be removed in a future release
cl : Command line warning D9036 : use 'Zc:preprocessor' instead of 'experimental:preprocessor'
_unity_build.cpp
C:\Users\matthieu.dartiailh\AppData\Local\Temp\pip-install-cryzp84l\mplcairo_8b94e57afec74d049241a90dd713db7f\src\_feature_tests.cpp(6): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29910\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mplcairo
Running setup.py clean for mplcairo
Failed to build mplcairo
Installing collected packages: python-dateutil, pillow, fonttools, cycler, matplotlib, mplcairo
Running setup.py install for mplcairo ... error
error: subprocess-exited-with-error
× Running setup.py install for mplcairo did not run successfully.
│ exit code: 1
╰─> [32 lines of output]
C:\Users\matthieu.dartiailh\Anaconda3\envs\py310\lib\site-packages\setuptools\installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
running install
C:\Users\matthieu.dartiailh\Anaconda3\envs\py310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build\lib.win-amd64-cpython-310
creating build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\base.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\gtk.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\gtk_native.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\macosx.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\multipage.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\qt.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\tk.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\wx.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\_backports.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\_util.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\_version.py -> build\lib.win-amd64-cpython-310\mplcairo
copying lib\mplcairo\__init__.py -> build\lib.win-amd64-cpython-310\mplcairo
running build_ext
building 'mplcairo._mplcairo' extension
creating build\temp.win-amd64-cpython-310
creating build\temp.win-amd64-cpython-310\Release
creating build\temp.win-amd64-cpython-310\Release\src
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\matthieu.dartiailh\AppData\Local\Temp\pip-install-cryzp84l\mplcairo_8b94e57afec74d049241a90dd713db7f\.eggs\pycairo-1.21.0-py3.10-win-amd64.egg\cairo\include -Ic:\users\matthieu.dartiailh\appdata\local\temp\pip-install-cryzp84l\mplcairo_8b94e57afec74d049241a90dd713db7f\.eggs\pybind11-2.10.0-py3.10.egg\pybind11\include -Ibuild\include -IC:\Users\matthieu.dartiailh\Anaconda3\envs\py310\Library\include -IC:\Users\matthieu.dartiailh\Anaconda3\envs\py310\include -IC:\Users\matthieu.dartiailh\Anaconda3\envs\py310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /EHsc /Tpsrc/_unity_build.cpp /Fobuild\temp.win-amd64-cpython-310\Release\src/_unity_build.obj /EHsc /bigobj /std:c++17 /experimental:preprocessor /wd4244 /wd4267
cl : Command line warning D9035 : option 'experimental:preprocessor' has been deprecated and will be removed in a future release
cl : Command line warning D9036 : use 'Zc:preprocessor' instead of 'experimental:preprocessor'
_unity_build.cpp
C:\Users\matthieu.dartiailh\AppData\Local\Temp\pip-install-cryzp84l\mplcairo_8b94e57afec74d049241a90dd713db7f\src\_feature_tests.cpp(6): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29910\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> mplcairo
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Is there any interest in updating the install procedure to support PEP517 and produce wheels for Python 3.10 ? Or did this work land somehow in matplotlib and this library is not really needed anymore ?
Sorry for the lack of wheels, I'll make a new release. Most features of mplcairo have still not been moved to matplotlib itself and there are therefore still benefits in using this library (I believe the comparison in the readme should be up to date).
I don't think PEP517 has anything to do with the build problem; rather, the issue is the one at https://github.com/matplotlib/mplcairo#windows: the paths to the cairo and freetype headers and dlls need to be manually specified, as there is no way I can guess where they are available on your system. Instead, use tools/build-windows-wheel.py
to build the wheel. (I could consider moving all that logic into setup.py, together with (e.g.) getting freetype.dll from freetype-py instead of having to download it separately, though.)
Thanks for your answer. Let me know if I can help with anything.
mplcairo 0.5 is now on PyPI.
If you want to make things cleaner, you could try moving most of the logic of build_windows_wheel.py into setup.py (together with adding a dependency on freetype-py and getting freetype.dll from them as well, and getting rid of CL/LIBPATH tricks in favor of ext.include_dirs/ext.library_dirs), which would make building on Windows by the normal command invocations work.
I could try to have a look. Would you interested in also making the repo PEP517 compliant ?
Support for editable installs is extremely important for me, and AFAIK PEP517 and editable installs were incompatible until the release of setuptools 64 (a week ago). Now I guess I would be open to moving to a PEP517-type setup, although I have no experience with that and don't really know how it would look like. However, most of the setup logic would likely still remain dynamic (I guess?), so it's not really clear to me what would be the benefits of such a change.
As long as a setup.py was present editable install worked with setuptools 61.2.
I did the change for a couple of project I maintain so I though I could offer to do the same here. I will see how it can work with the fiddling needed for that package though.