qiskit-community / qiskit-qec

Qiskit quantum error correction framework
https://qiskit-community.github.io/qiskit-qec/
Apache License 2.0
84 stars 35 forks source link

Installing fails: building editable for qiskit-qec results in error #303

Closed AlexisSchotte closed 1 year ago

AlexisSchotte commented 1 year ago

Steps to reproduce the problem

Install latest Microsoft C++ Build tools (MSVC v143), then follow the steps in the installation guide of qiskit-qec.

What is the current behavior?

When installing the package according to the installation guide, the command pip install -e . results in the following error message:

Building wheels for collected packages: qiskit-qec
  Building editable for qiskit-qec (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building editable for qiskit-qec (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [131 lines of output]
      running editable_wheel

(...)

File "C:\Users\AlexisSchotte\AppData\Local\Temp\pip-build-env-knxym642\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 423, in compile
          raise CompileError(msg)
      distutils.errors.CompileError: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      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"
      [end of output]

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

Setting the environment variable SETUPTOOLS_ENABLE_FEATURES="legacy-editable" results in a similar error message:

Installing collected packages: qiskit-qec
  Running setup.py develop for qiskit-qec
    error: subprocess-exited-with-error

    × python setup.py develop did not run successfully.
    │ exit code: 1
    ╰─> [73 lines of output]

(...)

C:\Users\AlexisSchotte\AppData\Local\Temp\pip-build-env-jae8kf2y\overlay\Lib\site-packages\pybind11\include\pybind11/stl.h(175): error C2672: 'pybind11::detail::tuple_caster<std::tuple,long,std::vector<std::string,std::allocator<std::string>>,std::vector<std::string,std::allocator<std::string>>,std::vector<int,std::allocator<int>>>::cast': no matching overloaded function found
        C:\Users\AlexisSchotte\AppData\Local\Temp\pip-build-env-jae8kf2y\overlay\Lib\site-packages\pybind11\include\pybind11\cast.h(1450): note: could be 'pybind11::handle pybind11::detail::tuple_caster<std::tuple,long,std::vector<std::string,std::allocator<std::string>>,std::vector<std::string,std::allocator<std::string>>,std::vector<int,std::allocator<int>>>::cast(T *,pybind11::return_value_policy,pybind11::handle)'
        C:\Users\AlexisSchotte\AppData\Local\Temp\pip-build-env-jae8kf2y\overlay\Lib\site-packages\pybind11\include\pybind11\cast.h(1444): note: or       'pybind11::handle pybind11::detail::tuple_caster<std::tuple,long,std::vector<std::string,std::allocator<std::string>>,std::vector<std::string,std::allocator<std::string>>,std::vector<int,std::allocator<int>>>::cast(T &&,pybind11::return_value_policy,pybind11::handle)'
        C:\Users\AlexisSchotte\AppData\Local\Temp\pip-build-env-jae8kf2y\overlay\Lib\site-packages\pybind11\include\pybind11/stl.h(176): error C3536: 'value_': cannot be used before it is initialized
        error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
        [end of output]

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

What is the expected behavior?

Package should install without errors

dsvandet commented 1 year ago

We have had problems with the C/C++ extensions on non Mac/Unix/Linux systems. I have asked for a PC so that I can investigate and correct this. I will try to get this corrected asap.

AlexisSchotte commented 1 year ago

I suspect it might be related to what version of the Microsoft C++ Build tools is being used. A colleague of mine managed to get it working with an older version, although it was necessary to modify extensions\properties.h by adding the line #include <iterator>.