Re: Error installing matplotlib
Mats Wichmann <[email protected]>
| Newsgroups | gmane.comp.python.general |
|---|---|
| Message-ID | <[email protected]> |
On 9/2/25 14:51, Rob Cliffe via Python-list wrote:
> Hello, can anyone help? All assistance gratefully received. I am
> running python 3.13.3 on a Windows 11 machine and trying to do
> pip install matplotlib
> (No, I don't need to say "python -m ...", I am running the right version
> of python.exe.)
> This starts by generating the following output (which I can catch by
> redirecting it to a file)
>
> Collecting matplotlib
> Using cached matplotlib-3.10.6.tar.gz (34.8 MB)
> Installing build dependencies: started
> Installing build dependencies: finished with status 'done'
> Getting requirements to build wheel: started
> Getting requirements to build wheel: finished with status 'done'
> Installing backend dependencies: started
> Installing backend dependencies: finished with status 'done'
> Preparing metadata (pyproject.toml): started
> Preparing metadata (pyproject.toml): finished with status 'error'
>
> then prints error messages on the screen which are scrolled out too fast
> to see, but end as follows:
>
> 3: note: in expansion of macro 'PYBIND11_COMPAT_STRDUP'
> rec_fget->doc = PYBIND11_COMPAT_STRDUP(rec_fget-
> >doc);
> ^~~~~~~~~~~~~~~~~~~~~~
> C:\Users\robcl\AppData\Local\Temp\pip-build-
> env-1ud913ho\overlay\Lib\site-packages\pybind11\include/pybind11/
> pybind11.h:248:36: note: (if you use '-fpermissive', G++ will accept
> your code, but allowing the use of an undeclared name is deprecated)
> # define PYBIND11_COMPAT_STRDUP strdup
> ^~~~~~
> C:\Users\robcl\AppData\Local\Temp\pip-build-
> env-1ud913ho\overlay\Lib\site-packages\pybind11\include/pybind11/
> pybind11.h:2379:33: note: in expansion of macro 'PYBIND11_COMPAT_STRDUP'
> rec_fget->doc = PYBIND11_COMPAT_STRDUP(rec_fget-
> >doc);
> ^~~~~~~~~~~~~~~~~~~~~~
> C:\Users\robcl\AppData\Local\Temp\pip-build-
> env-1ud913ho\overlay\Lib\site-packages\pybind11\include/pybind11/
> pybind11.h:248:36: error: there are no arguments to 'strdup' that depend
> on a template parameter, so a declaration of 'strdup' must be available
> [-fpermissive]
> # define PYBIND11_COMPAT_STRDUP strdup
> ^~~~~~
> C:\Users\robcl\AppData\Local\Temp\pip-build-
> env-1ud913ho\overlay\Lib\site-packages\pybind11\include/pybind11/
> pybind11.h:2387:33: note: in expansion of macro 'PYBIND11_COMPAT_STRDUP'
> rec_fset->doc = PYBIND11_COMPAT_STRDUP(rec_fset-
> >doc);
> ^~~~~~~~~~~~~~~~~~~~~~
> In file included from ../src/_backend_agg_basic_types.h:17,
> from ../src/_backend_agg.h:41,
> from ../src/_backend_agg_wrapper.cpp:6:
> ../src/py_adaptors.h: In member function 'void
> mpl::PathIterator::set(pybind11::object, pybind11::object, bool, double)':
> ../src/py_adaptors.h:96:57: warning: comparison of integer
> expressions of different signedness: 'pybind11::ssize_t' {aka 'int'} and
> 'unsigned int' [-Wsign-compare]
> if (m_codes.ndim() != 1 || m_codes.shape(0) !=
> m_total_vertices) {
> ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
> ../src/_backend_agg_wrapper.cpp: In lambda function:
> ../src/_backend_agg_wrapper.cpp:253:37: warning: narrowing
> conversion of 'renderer->RendererAgg::get_height()' from 'unsigned int'
> to 'int' inside { } [-Wnarrowing]
> renderer->get_height(),
> ~~~~~~~~~~~~~~~~~~~~^~
> ../src/_backend_agg_wrapper.cpp:253:37: warning: narrowing
> conversion of 'renderer->RendererAgg::get_height()' from 'unsigned int'
> to 'int' inside { } [-Wnarrowing]
> ../src/_backend_agg_wrapper.cpp:254:36: warning: narrowing
> conversion of 'renderer->RendererAgg::get_width()' from 'unsigned int'
> to 'int' inside { } [-Wnarrowing]
> renderer->get_width(),
> ~~~~~~~~~~~~~~~~~~~^~
> ../src/_backend_agg_wrapper.cpp:254:36: warning: narrowing
> conversion of 'renderer->RendererAgg::get_width()' from 'unsigned int'
> to 'int' inside { } [-Wnarrowing]
> ../src/_backend_agg_wrapper.cpp:258:39: warning: narrowing
> conversion of '(renderer->RendererAgg::get_width() * 4)' from 'unsigned
> int' to 'int' inside { } [-Wnarrowing]
> renderer->get_width() * 4,
> ~~~~~~~~~~~~~~~~~~~~~~^~~
> ../src/_backend_agg_wrapper.cpp:258:39: warning: narrowing
> conversion of '(renderer->RendererAgg::get_width() * 4)' from 'unsigned
> int' to 'int' inside { } [-Wnarrowing]
> ninja: build stopped: subcommand failed.
There are two roots here:
(1) it's not finding a prebuilt wheel. You can see that because it's
proposing to use the source distribution instead:
> Collecting matplotlib
> Using cached matplotlib-3.10.6.tar.gz (34.8 MB)
and so it, in the initial output.
(2) Although at this point all hope of success is often lost on Windows,
it's still going to try to compile things. It found gcc - there are
messages from g++ in the output. Last I know, Pybind11 only builds with
the Microsoft compiler because it uses msvc-specific types which gcc
does not know about.
Since the matplotlib project definition provides wheels for Python 3.13
on Windows (not just the main Python, but also the free-threaded
versions), you need to figure out why the resolver doesn't think there's
anything applicable available.
--
https://mail.python.org/mailman3//lists/python-list.python.org