Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: Documentation not so clear that a C/C++-compiler is required to install from source #24359

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

Closed
a-sajjad72 opened this issue Nov 4, 2022 · 7 comments

Comments

@a-sajjad72
Copy link

a-sajjad72 commented Nov 4, 2022

Bug summary

i am building documentation but there's an error occured here.

Code for reproduction

follow the documentation
https://matplotlib.org/stable/devel/development_setup.html#installing-for-devs

Actual outcome

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building editable for matplotlib
Failed to build matplotlib
ERROR: Could not build wheels for matplotlib, which is required to install pyproject.toml-based projects

Expected outcome

it should be succesfully build.

Additional information

here is the log:
Traceback (most recent call last):
File "C:\Users\HaLF-MenTaL\AppData\Local\Temp\pip-build-env-mlkau0ej\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 140, in run
self._create_wheel_file(bdist_wheel)
File "C:\Users\HaLF-MenTaL\AppData\Local\Temp\pip-build-env-mlkau0ej\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 330, in _create_wheel_file
files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
File "C:\Users\HaLF-MenTaL\AppData\Local\Temp\pip-build-env-mlkau0ej\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 261, in _run_build_commands
self._run_build_subcommands()
File "C:\Users\HaLF-MenTaL\AppData\Local\Temp\pip-build-env-mlkau0ej\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 288, in _run_build_subcommands
self.run_command(name)
File "C:\Users\HaLF-MenTaL\AppData\Local\Temp\pip-build-env-mlkau0ej\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "C:\Users\HaLF-MenTaL\AppData\Local\Temp\pip-build-env-mlkau0ej\overlay\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "C:\Users\HaLF-MenTaL\AppData\Local\Temp\pip-build-env-mlkau0ej\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "C:\Users\HaLF-MenTaL\AppData\Local\Temp\pip-build-env-mlkau0ej\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 84, in run
_build_ext.run(self)
File "C:\Users\HaLF-MenTaL\AppData\Local\Temp\pip-build-env-mlkau0ej\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 346, in run
self.build_extensions()
File "", line 183, in build_extensions
File "E:\LECTURES\Documentation\Python\matplotlib\setupext.py", line 699, in do_custom_build
cc.initialize()
File "C:\Users\HaLF-MenTaL\AppData\Local\Temp\pip-build-env-mlkau0ej\overlay\Lib\site-packages\setuptools_distutils_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "C:\Users\HaLF-MenTaL\AppData\Local\Temp\pip-build-env-mlkau0ej\overlay\Lib\site-packages\setuptools\msvc.py", line 214, in msvc14_get_vc_env
return _msvc14_get_vc_env(plat_spec)
File "C:\Users\HaLF-MenTaL\AppData\Local\Temp\pip-build-env-mlkau0ej\overlay\Lib\site-packages\setuptools\msvc.py", line 168, in _msvc14_get_vc_env
raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
Building freetype in build\freetype-2.6.1
error: Support for editable installs via PEP 660 was recently introduced
in setuptools. If you are seeing this error, please report to:

https://github.com/pypa/setuptools/issues

Meanwhile you can try the legacy behavior by setting an
environment variable and trying to install again:

SETUPTOOLS_ENABLE_FEATURES="legacy-editable"
error: subprocess-exited-with-error

× Building editable for matplotlib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
full command: 'E:\LECTURES\Documentation\Python\virtEnv\Scripts\python.exe' 'E:\LECTURES\Documentation\Python\virtEnv\lib\site-packages\pip_vendor\pep517\in_process_in_process.py' build_editable 'C:\Users\HALF-M~1\AppData\Local\Temp\tmp576u6u2s'
cwd: E:\LECTURES\Documentation\Python\matplotlib
Building editable for matplotlib (pyproject.toml) ... error
ERROR: Failed building editable for matplotlib
Failed to build matplotlib
ERROR: Could not build wheels for matplotlib, which is required to install pyproject.toml-based projects

Operating system

Windows 10 Pro Version 22H2

Matplotlib Version

matplotlib 3.6.2

Matplotlib Backend

No response

Python version

3.10.8

Jupyter version

No response

Installation

git checkout

@oscargus
Copy link
Member

oscargus commented Nov 4, 2022

This is the reason:

distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

Do you have that installed? If not, do please install it.

Edit: I think the potential action here is to clarify that a C/C++-compiler is required. On Linux/Mac it is typically already there, but for Windows most users will have to explicitly install one. The docs could be clearer there.

@oscargus oscargus changed the title [Bug]: [Bug]: Documentation not so clear that a C/C++-compiler is required to install from source Nov 4, 2022
@story645
Copy link
Member

story645 commented Nov 4, 2022

compilers are documented in the development docs https://matplotlib.org/devdocs/devel/dependencies.html#c-compiler

@sajjad-ali60 is there something we could do to make it clearer that contributors always have to use the dev version of the build instructions?

@jklymak
Copy link
Member

jklymak commented Nov 4, 2022

This is already documented on stable as well: https://matplotlib.org/stable/devel/dependencies.html#dependencies-for-building-matplotlib

Note almost nobody has to build freetype: install matplotlib via conda, and then do pip install -e . to install the dev version. However, you still need a c compiler for our c code.

I'm going to close, but feel free to re-open if there is some action we can take.

@timhoffm
Copy link
Member

timhoffm commented Nov 4, 2022

We do not separately spell out build dependencies (I think these are a subset of the runtime dependencies plus the c compiler). While we could make that distinction, I think the simple solution here is to switch the section order at https://matplotlib.org/stable/devel/development_setup.html#install-matplotlib-in-editable-mode

Currently, the order is

  • Install Matplotlib in editable mode
  • Install additional development dependencies

If we first tell people to install all dev dependencies, then compiler is there when they follow the instructions.

@story645
Copy link
Member

story645 commented Nov 4, 2022

Note almost nobody has to build freetype: install matplotlib via conda, and then do pip install -e . to install the dev version

Windows is weird and I think I had to try like six things and vcpkg is maybe what worked.

@a-sajjad72
Copy link
Author

a-sajjad72 commented Nov 5, 2022

We do not separately spell out build dependencies (I think these are a subset of the runtime dependencies plus the c compiler). While we could make that distinction, I think the simple solution here is to switch the section order at https://matplotlib.org/stable/devel/development_setup.html#install-matplotlib-in-editable-mode

Currently, the order is

  • Install Matplotlib in editable mode
  • Install additional development dependencies

If we first tell people to install all dev dependencies, then compiler is there when they follow the instructions.

yes this will be good for better understanding and for future contributors
and thanks to all of you guys it scuccesfully installed

@ksunden
Copy link
Member

ksunden commented Nov 5, 2022

I'm going to say this was closed by #24368, which does the reordering suggested earlier in this thread.

@ksunden ksunden closed this as completed Nov 5, 2022
@QuLogic QuLogic added this to the v3.6.3 milestone Nov 5, 2022
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

7 participants