Skip to content

[Doc]: Instructions for editable installation on Windows potentially missing a step #27168

Closed

Description

@theOehrly

Documentation Link

https://matplotlib.org/devdocs/devel/dependencies.html#compiled-extensions

Problem

The documentation states to install the Visual Studio Build Tools and through these the latest MSVC, "C++ CMake tools for Windows," and a Windows SDK.
Even though I did that (and rebooted), the editable install did not work. The installation process and compilation itself seemed to be working fine. At least, I couldn't spot any obvious errors in the output. But Matplotlib failed to import due to some DLLs not being found.

What fixed it for me, was running the following command:

"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64

Obviously, path and architecture may be different for other users. But it seems this step is necessary to correctly set up the environment. I'm not very familiar with this MSVC stuff though, so maybe this was some peculiarity on my system? Someone who knows more about this should decide whether this is right or not.

Suggested improvement

Add a note to run this command before the editable install.

Activity

  1. story645 commented on Oct 23, 2023

    @story645
    Member

    I didn't have to run this command to install on my windows machine, but I did have to force msvc. What about adding it as a troubleshooting entry: https://matplotlib.org/devdocs/devel/troubleshooting.html

  2. QuLogic commented on Oct 24, 2023

    @QuLogic
    Member

    Are you installing in a conda environment or a venv?

  3. theOehrly commented on Oct 24, 2023

    @theOehrly
    ContributorAuthor

    I'm installing in a venv.

    I think I figured out the specific problem I have. I had a stray installation of GCC and related tools on my system, courtesy of Strawberry Perl. Their installer adds that folder to the system PATH variable without asking or explicitly telling.
    Meson seems to prefer to use GCC when it's available like that. Pip finishes with Successfully installed matplotlib-3.9.0.dev0, so everything looks correct. But the installed build of Matplotlib cannot be imported.
    The problem is reliably reproducible for me.

    Forcing msvc, as suggested, fixes the problem as well.

    Maybe it would be a good idea, to always force msvc on windows?

  4. QuLogic commented on Oct 27, 2023

    @QuLogic
    Member

    Ah yes, Strawberry Perl is something.

    I did not initially force MSVC, because theoretically one may want to use other compilers (e.g., Cygwin), and we don't actually require anything specially from MSVC. Though as this seems to keep tripping up people, it may be better to make this the default and have the other less-common option go through the hoop of turning it off instead.

  5. story645 commented on Oct 28, 2023

    @story645
    Member

    Though as this seems to keep tripping up people, it may be better to make this the default and have the other less-common option go through the hoop of turning it off instead.

    Could also add a sentence linking the troubleshooting entry in the install docs. At the end of the section, a sentence like

    folks building on windows may need to :ref:`force msvc <link to troubleshooting entry>.
  6. theOehrly commented on Oct 29, 2023

    @theOehrly
    ContributorAuthor

    Could also add a sentence linking the troubleshooting entry in the install docs. At the end of the section, a sentence like

    folks building on windows may need to :ref:`force msvc <link to troubleshooting entry>.
    

    In my opinion, that would be a good solution as well. I somehow found the troubleshooting section easy to miss.

  7. story645 commented on Oct 30, 2023

    @story645
    Member

    In my opinion, that would be a good solution as well. I somehow found the troubleshooting section easy to miss.

    I went slightly more general, but does the solution in #27226 work for you? If not, what should I add?

  8. theOehrly commented on Oct 30, 2023

    @theOehrly
    ContributorAuthor

    I went slightly more general, but does the solution in #27226 work for you? If not, what should I add?

    I think that's a good solution 👍

    I'll close this because the problem I had is resolved and docs have been improved.

  9. added this to the v3.9.0 milestone on Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions