Error in cmd whlie installing CPPYY on windows

875 Views Asked by At

I have been trying to install Cppyy on my computerbut I'm new to this so I don't know a whole lot about this I have python and pip install on my computer

C:\WINDOWS\system32>python --version
Python 3.8.6

C:\WINDOWS\system32> pip --version
pip 20.2.3

when I try to run

pip install cppyy

cmd gives me error

    ERROR: Command errored out with exit status 1:
   command: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\sarfaraz\AppData\Local\Temp\pip-build-env-z4gw8trb\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'CPyCppyy==1.11.4; python_implementation != '"'"'PyPy'"'"'' 'cppyy-backend==1.14.0; python_implementation != '"'"'PyPy'"'"'' 'cppyy-cling==6.21.3; python_implementation != '"'"'PyPy'"'"'' 'cppyy-cling<=6.18.2.3; python_implementation == '"'"'PyPy'"'"'' setuptools wheel
       cwd: None
  Complete output (42 lines):
  Ignoring cppyy-cling: markers 'platform_python_implementation == "PyPy"' don't match your environment
  Collecting CPyCppyy==1.11.4
    Using cached CPyCppyy-1.11.4.tar.gz (178 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\sarfaraz\AppData\Local\Temp\pip-build-env-hj42_3n3\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cppyy-cling>=6.21.3' 'cppyy-backend>=1.14' setuptools wheel
         cwd: None
    Complete output (31 lines):
    Collecting cppyy-cling>=6.21.3
      Using cached cppyy_cling-6.21.3-py2.py3-none-win_amd64.whl (18.2 MB)
    Collecting cppyy-backend>=1.14
      Using cached cppyy-backend-1.14.0.tar.gz (32 kB)
      Installing build dependencies: started
      Installing build dependencies: finished with status 'done'
      Getting requirements to build wheel: started
      Getting requirements to build wheel: finished with status 'done'
        Preparing wheel metadata: started
        Preparing wheel metadata: finished with status 'done'
    Collecting setuptools
      Using cached setuptools-50.3.0-py3-none-any.whl (785 kB)
    Collecting wheel
      Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)
    Building wheels for collected packages: cppyy-backend
      Building wheel for cppyy-backend (PEP 517): started
      Building wheel for cppyy-backend (PEP 517): finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\sarfaraz\AppData\Local\Temp\tmpojxb8d41'
           cwd: C:\Users\sarfaraz\AppData\Local\Temp\pip-install-znkz3pmg\cppyy-backend
      Complete output (6 lines):
      running bdist_wheel
      running build
      running build_ext
      checking for build\temp.win-amd64-3.8\Release
      creating build\temp.win-amd64-3.8\Release
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      ----------------------------------------
      ERROR: Failed building wheel for cppyy-backend
    Failed to build cppyy-backend
    ERROR: Could not build wheels for cppyy-backend which use PEP 517 and cannot be installed directly
    ----------------------------------------
  ERROR: Command errored out with exit status 1: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\sarfaraz\AppData\Local\Temp\pip-build-env-hj42_3n3\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cppyy-cling>=6.21.3' 'cppyy-backend>=1.14' setuptools wheel Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\sarfaraz\AppData\Local\Temp\pip-build-env-z4gw8trb\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'CPyCppyy==1.11.4; python_implementation != '"'"'PyPy'"'"'' 'cppyy-backend==1.14.0; python_implementation != '"'"'PyPy'"'"'' 'cppyy-cling==6.21.3; python_implementation != '"'"'PyPy'"'"'' 'cppyy-cling<=6.18.2.3; python_implementation == '"'"'PyPy'"'"'' setuptools wheel Check the logs for full command output.

I found some instruction on the site but it was hard for me to follow it since I'm new to this stuff

Thanks in advance

2

There are 2 best solutions below

2
On

As shown in the error message and mentioned already by hoefling, you need a system compiler, at the very minimum for system headers, but also for C++ library headers. Cling needs the code from these headers to parse any new C++ code you may give it that uses C++ standard library or Windows system features.

In principle, it's possible to ship a precompiled header with cppyy-cling that contains all system and C++ headers as IR bitcode, but MSVC likes to change header include guards between versions, so that would then only work if there is no system compiler. (It's somewhat better on Linux, but it, too, has changed include guard names in some instances.) This will be revisited once Cling supports precompiled modules (PCMs; as opposed to headers) on Windows. Then these PCMs can be prepackaged and installed conditionally if no system compiler is available. Module support in upstream is, however, still very fresh and not even released yet, so this is something that will only appear in the medium-term.

Anyway, MSVC is free these days. :)

1
On

Try to upgrade setuptools wheel

pip install -U setuptools wheel

End then try

pip install cppyy --no-index

If not help, that problem may by with python 3.8 By PyPi it’s supported <=3.7