Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
theOehrly opened this issue Oct 23, 2023 · 8 comments
Milestone

Comments

@theOehrly
Copy link
Contributor

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.

@story645
Copy link
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

@story645 story645 added the Documentation: devdocs files in doc/devel label Oct 23, 2023
@QuLogic
Copy link
Member

QuLogic commented Oct 24, 2023

Are you installing in a conda environment or a venv?

@theOehrly
Copy link
Contributor Author

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?

@QuLogic
Copy link
Member

QuLogic commented Oct 27, 2023

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.

@story645
Copy link
Member

story645 commented Oct 28, 2023

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>.

@theOehrly
Copy link
Contributor Author

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.

@story645
Copy link
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?

@theOehrly
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants