question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: (Python 3.11) Compiler cl can not compile programs

See original GitHub issue

Describe your issue.

Hello ! While trying to install scipy on Python 3.11rc1 (Windows 11), I got the error “Compiler cl can not compile programs”.

I searched about the error Compiler cl can not compile programs but I didn’t find anything to fix this problem, some things about Visual Studio but I already have VS 2019… My main concern is that I’m updating my own open-source projects to be compatible with Python 3.11 (candidate version in 1 month), and I’m afraid that scipy 1.9.1 doesn’t work out of the box on Windows.

In addition, I confirm having installed meson using pip, and it’s in PATH. I thought at first that it was a meson issue so I opened an issue in meson (https://github.com/mesonbuild/meson/issues/10795), but it appears I’m not the only one having issues with scipy 1.9.1 : https://stackoverflow.com/questions/73628794/unable-to-install-scipy-with-mkl-using-meson.

Also tried to manually build it, but after having installed pythran, gfortran, cython, pkg-config, cmake and tried to install openblas, I’m having a scipy\scipy\meson.build:141:0: ERROR: Dependency "OpenBLAS" not found, tried pkgconfig and cmake error. But that’s not the subject of this issue.

Reproducing Code Example

py -m pip install scipy --upgrade

Error message

Collecting scipy
  Using cached scipy-1.9.1.tar.gz (42.0 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [47 lines of output]
      The Meson build system
      Version: 0.62.2
      Source dir: C:\Users\thher\AppData\Local\Temp\pip-install-9tovb2ma\scipy_828fda3b17134154918e54876239f05e
      Build dir: C:\Users\thher\AppData\Local\Temp\pip-install-9tovb2ma\scipy_828fda3b17134154918e54876239f05e\.mesonpy-x7d63hr0\build
      Build type: native build
      Project name: SciPy
      Project version: 1.9.1
      Activating VS 16.11.18

      ..\..\meson.build:1:0: ERROR: Compiler cl can not compile programs.

      A full log can be found at C:\Users\thher\AppData\Local\Temp\pip-install-9tovb2ma\scipy_828fda3b17134154918e54876239f05e\.mesonpy-x7d63hr0\build\meson-logs\meson-log.txt
      + meson setup --native-file=C:\Users\thher\AppData\Local\Temp\pip-install-9tovb2ma\scipy_828fda3b17134154918e54876239f05e\.mesonpy-native-file.ini -Ddebug=false -Doptimization=2 --prefix=C:\Users\thher\AppData\Local\Programs\Python\Python311 C:\Users\thher\AppData\Local\Temp\pip-install-9tovb2ma\scipy_828fda3b17134154918e54876239f05e C:\Users\thher\AppData\Local\Temp\pip-install-9tovb2ma\scipy_828fda3b17134154918e54876239f05e\.mesonpy-x7d63hr0\build
      Traceback (most recent call last):
        File "C:\Users\thher\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
          main()
        File "C:\Users\thher\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\thher\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\thher\AppData\Local\Temp\pip-build-env-wder1mlf\overlay\Lib\site-packages\mesonpy\__init__.py", line 923, in get_requires_for_build_wheel
          with _project(config_settings) as project:
        File "C:\Users\thher\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 137, in __enter__
          return next(self.gen)
                 ^^^^^^^^^^^^^^
        File "C:\Users\thher\AppData\Local\Temp\pip-build-env-wder1mlf\overlay\Lib\site-packages\mesonpy\__init__.py", line 902, in _project
          with Project.with_temp_working_dir(
        File "C:\Users\thher\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 137, in __enter__
          return next(self.gen)
                 ^^^^^^^^^^^^^^
        File "C:\Users\thher\AppData\Local\Temp\pip-build-env-wder1mlf\overlay\Lib\site-packages\mesonpy\__init__.py", line 547, in with_temp_working_dir
          yield cls(source_dir, tmpdir, build_dir)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\thher\AppData\Local\Temp\pip-build-env-wder1mlf\overlay\Lib\site-packages\mesonpy\__init__.py", line 463, in __init__
          self._configure(reconfigure=bool(build_dir) and not native_file_mismatch)
        File "C:\Users\thher\AppData\Local\Temp\pip-build-env-wder1mlf\overlay\Lib\site-packages\mesonpy\__init__.py", line 494, in _configure
          self._meson(
        File "C:\Users\thher\AppData\Local\Temp\pip-build-env-wder1mlf\overlay\Lib\site-packages\mesonpy\__init__.py", line 477, in _meson
          return self._proc('meson', *args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\thher\AppData\Local\Temp\pip-build-env-wder1mlf\overlay\Lib\site-packages\mesonpy\__init__.py", line 472, in _proc
          subprocess.check_call(list(args))
        File "C:\Users\thher\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['meson', 'setup', '--native-file=C:\\Users\\thher\\AppData\\Local\\Temp\\pip-install-9tovb2ma\\scipy_828fda3b17134154918e54876239f05e\\.mesonpy-native-file.ini', '-Ddebug=false', '-Doptimization=2', '--prefix=C:\\Users\\thher\\AppData\\Local\\Programs\\Python\\Python311', 'C:\\Users\\thher\\AppData\\Local\\Temp\\pip-install-9tovb2ma\\scipy_828fda3b17134154918e54876239f05e', 'C:\\Users\\thher\\AppData\\Local\\Temp\\pip-install-9tovb2ma\\scipy_828fda3b17134154918e54876239f05e\\.mesonpy-x7d63hr0\\build']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel 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.

(No more interesting details are present in the pip log file.)

SciPy/NumPy/Python version information

1.23.2 sys.version_info(major=3, minor=11, micro=0, releaselevel=‘candidate’, serial=1) (scipy not installed)

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
rgommerscommented, Sep 9, 2022

Well, we still want to make sure that MSVC + MKL works. I think I already have the fixes needed for that in gh-16957. I’ll separate those out and get them merged, so you can try. The rest of that PR is adding CI so we’re sure it is working; fiddling with download commands to get MKL installed is the time-consuming part there.

1reaction
andyfaffcommented, Sep 9, 2022

You’ll have issues building with Windows at the moment with meson at the moment if you don’t compile with mingw-w64/gfortran. We’re currently looking into building SciPy with meson on windows at the moment with compilers other than mingw-w64, but that’s a work in progress. In addition those artefacts will get uploaded as nightly wheels, but we haven’t activated that just yet because the wheel builder script is still relatively new.

Read more comments on GitHub >

github_iconTop Results From Across the Web

(Windows 11) ERROR: Compiler cl can not ...
Hello ! While trying to install scipy on Python 3.11rc1 (Windows 11), I got this traceback : > py -m pip install scipy...
Read more >
What's New In Python 3.11 — Python 3.11.1 documentation
This article explains the new features in Python 3.11, compared to 3.10. For full details, see the changelog.
Read more >
codeop — Compile Python code
The codeop module provides utilities upon which the Python read-eval-print loop can be emulated, as is done in the code module.
Read more >
py_compile — Compile Python source files
Though not often needed, this function can be useful when installing ... a PyCompileError is raised when an error is encountered while compiling...
Read more >
Issue 44535: Cannot build in VS 2022 - Python tracker
Cannot build in VS 2022 ; compile error · resolved ; Build, Windows · Python 3.11, Python 3.10, Python 3.9 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found