You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Install on Windows using pkg-config from conda #13016
The current way of installing from sources on Windows involves running the build_alllocal.cmd script which manually copies libz and libpng to the right location. Such approach doesn't work with e.g.,
pip install https://<some-url>/matplotlib.zip
where matplotlib.zip is the source distribution, taken e.g. from an open PR.
As far as I understand, on Linux this is solved by using pkg-config. On Windows, pkg-config can also be installed from the msys2 channel which is now parts of the default channel, as,
conda install m2w64-pkg-config
see conda-forge/pkg-config-feedstock#11 (comment)
This might help to detect the libpng/freetype libraries (I'm not fully sure), however in any case, install fails while linking libpng,
[...]
REQUIRED DEPENDENCIES AND EXTENSIONS
install_requires: yes [handled by setuptools]
freetype: yes [Using unknown version found on system.]
png: yes [Using unknown version found on system.]
[...]
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\ProgramData\Miniconda3\envs\laserbeam-env\Library\lib /LIBPATH:C:\ProgramData\Miniconda3\envs\laserbeam-env\libs /LIBPATH:C:\ProgramData\Miniconda3\envs\laserbeam-env\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64" png.lib z.lib /EXPORT:PyInit__png build\temp.win-amd64-3.7\Release\src/_png.obj build\temp.win-amd64-3.7\Release\src/mplutils.obj /OUT:build\lib.win-amd64-3.7\matplotlib\_png.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\src\_png.cp37-win_amd64.lib
LINK : fatal error LNK1181: cannot open input file 'png.lib'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1181
I have not investigated too much (among other things because I'm not familiar with pkg-config even on Linux or how matplotlib build works in details). Also I don't have a Windows machine to try it on at the moment... Opened this issue in case someone finds the above information useful.
I looked a bit into it; it's actually not too hard to use pkg-config on Windows too once #13064 is merged (specifically, the "don't-try-to-parse-pkgconfig-output" part -- then we can just use pkg-config --msvc-syntax). However, there's also the issue that the libpng pkg-config files are actually invalid (conda-forge/libpng-feedstock#26), moreover they are only shipped by conda-forge and upstream libpng explicitly does not intend the pkg-config files to be used on Windows (conda-forge had to patch that) so I'm not sure how I feel about using them here.
Proposing to close this for the reasons above (there is no one distributing useful pkg-config files for libpng on Windows that I'm aware of and libpng does not intend these files to be used on Windows either).
Also the general situation should already become better after #13077/#13064.
Activity
anntzer commentedon Dec 29, 2018
Does un-hardcoding
has_pkgconfigresult in a working build?If so, we may as well do that.
rth commentedon Dec 29, 2018
I have not investigated too much (among other things because I'm not familiar with pkg-config even on Linux or how matplotlib build works in details). Also I don't have a Windows machine to try it on at the moment... Opened this issue in case someone finds the above information useful.
anntzer commentedon Dec 29, 2018
No worries, we can keep this around for now.
anntzer commentedon Dec 29, 2018
In the meantime, if you want to install from the github zip on Windows, your best bet is probably to create z.lib and png.lib somewhere, then set the
LINKenvironment variable to point to them, as documented in https://github.com/matplotlib/matplotlib/pull/13064/files#diff-26dee18463b5da190f343abcc74cf708R185.anntzer commentedon Jan 2, 2019
I looked a bit into it; it's actually not too hard to use pkg-config on Windows too once #13064 is merged (specifically, the "don't-try-to-parse-pkgconfig-output" part -- then we can just use pkg-config --msvc-syntax). However, there's also the issue that the libpng pkg-config files are actually invalid (conda-forge/libpng-feedstock#26), moreover they are only shipped by conda-forge and upstream libpng explicitly does not intend the pkg-config files to be used on Windows (conda-forge had to patch that) so I'm not sure how I feel about using them here.
anntzer commentedon Jan 3, 2019
Proposing to close this for the reasons above (there is no one distributing useful pkg-config files for libpng on Windows that I'm aware of and libpng does not intend these files to be used on Windows either).
Also the general situation should already become better after #13077/#13064.
anntzer commentedon Jan 6, 2019
Closing per above; thanks for the suggestion @rth and feel free to further comment on Windows builds.
rth commentedon Jan 6, 2019
Thanks for investigating this possibility!