windows下安装Jittor后执行python -m jittor.test.test_example时出现如下错误

C:\Users\zhang>python -m jittor.test.test_example
[i 0225 23:50:02.478727 40 compiler.py:944] Jittor(1.3.1.40) src: c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor
[i 0225 23:50:02.494352 40 compiler.py:945] cl at C:\Users\zhang\.cache\jittor\msvc\VC\_\_\_\_\_\bin\cl.exe(19.29.30133)
[i 0225 23:50:02.494352 40 compiler.py:946] cache_path: C:\Users\zhang\.cache\jittor\jt1.3.1\cl\py3.10.2\Windows-10-10.x1e\AMDRyzen75800Ux65\default
[i 0225 23:50:02.494352 40 install_cuda.py:51] cuda_driver_version: [11, 2, 0]
[i 0225 23:50:02.509981 40 __init__.py:372] Found C:\Users\zhang\.cache\jittor\jtcuda\cuda11.2_cudnn8_win\bin\nvcc.exe(11.2.67) at C:\Users\zhang\.cache\jittor\jtcuda\cuda11.2_cudnn8_win\bin\nvcc.exe.
[i 0225 23:50:02.541227 40 compiler.py:999] cuda key:cu11.2.67
[i 0225 23:50:02.541227 40 __init__.py:187] Total mem: 15.36GB, using 5 procs for compiling.
jit_utils.cc
c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src\pyjt/numpy.h(34): error C2143: syntax error: missing ';' before '*'
c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src\pyjt/numpy.h(34): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src\pyjt/numpy.h(34): error C2238: unexpected token(s) preceding ';'
c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src\pyjt/numpy.h(35): error C2143: syntax error: missing ';' before '*'
c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src\pyjt/numpy.h(35): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src\pyjt/numpy.h(35): error C2238: unexpected token(s) preceding ';'
c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src\pyjt/numpy.h(113): error C2039: 'dimensions': is not a member of 'jittor::PyArray_Proxy'
c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src\pyjt/numpy.h(30): note: see declaration of 'jittor::PyArray_Proxy'
c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src\utils\jit_utils.cc(26): warning C4273: 'jittor::check_async_executor_error': inconsistent dll linkage
c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src\pyjt/py_converter.h(808): note: see previous definition of 'check_async_executor_error'
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "C:\Users\zhang\AppData\Local\Programs\Python\Python310\lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "C:\Users\zhang\AppData\Local\Programs\Python\Python310\lib\site-packages\jittor_utils\__init__.py", line 159, in do_compile
    run_cmd(cmd)
  File "C:\Users\zhang\AppData\Local\Programs\Python\Python310\lib\site-packages\jittor_utils\__init__.py", line 148, in run_cmd
    raise Exception(err_msg)
Exception: Run cmd failed: "C:\Users\zhang\.cache\jittor\msvc\VC\_\_\_\_\_\bin\cl.exe" "c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src\utils\jit_utils.cc"   -std:c++17        -EHa -MD  -nologo -I"C:\Users\zhang\.cache\jittor\msvc\VC\include" -I"C:\Users\zhang\.cache\jittor\msvc\win10_kits\include\ucrt" -I"C:\Users\zhang\.cache\jittor\msvc\win10_kits\include\shared" -I"C:\Users\zhang\.cache\jittor\msvc\win10_kits\include\um" -DNOMINMAX   -I"c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src" -I"c:\users\zhang\appdata\local\programs\python\python310\include"  -O2    -c -Fo: "C:\Users\zhang\.cache\jittor\jt1.3.1\cl\py3.10.2\Windows-10-10.x1e\AMDRyzen75800Ux65\default\cu11.2.67\obj_files\jit_utils.cc.obj"
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\zhang\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 187, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Users\zhang\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "C:\Users\zhang\AppData\Local\Programs\Python\Python310\lib\site-packages\jittor\__init__.py", line 18, in <module>
    from . import compiler
  File "C:\Users\zhang\AppData\Local\Programs\Python\Python310\lib\site-packages\jittor\compiler.py", line 1164, in <module>
    check_cache_compile()
  File "C:\Users\zhang\AppData\Local\Programs\Python\Python310\lib\site-packages\jittor\compiler.py", line 873, in check_cache_compile
    recompile = compile(cc_path, cc_flags+f" {opt_flags} ", files, jit_utils.cache_path+'/jit_utils_core'+extension_suffix, True)
  File "C:\Users\zhang\AppData\Local\Programs\Python\Python310\lib\site-packages\jittor\compiler.py", line 147, in compile
    jit_utils.run_cmds(cmds, cache_path, jittor_path, "Compiling "+base_output)
  File "C:\Users\zhang\AppData\Local\Programs\Python\Python310\lib\site-packages\jittor_utils\__init__.py", line 211, in run_cmds
    for i,_ in enumerate(p.imap_unordered(do_compile, cmds)):
  File "C:\Users\zhang\AppData\Local\Programs\Python\Python310\lib\multiprocessing\pool.py", line 870, in next
    raise value
Exception: Run cmd failed: "C:\Users\zhang\.cache\jittor\msvc\VC\_\_\_\_\_\bin\cl.exe" "c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src\utils\jit_utils.cc"   -std:c++17        -EHa -MD  -nologo -I"C:\Users\zhang\.cache\jittor\msvc\VC\include" -I"C:\Users\zhang\.cache\jittor\msvc\win10_kits\include\ucrt" -I"C:\Users\zhang\.cache\jittor\msvc\win10_kits\include\shared" -I"C:\Users\zhang\.cache\jittor\msvc\win10_kits\include\um" -DNOMINMAX   -I"c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src" -I"c:\users\zhang\appdata\local\programs\python\python310\include"  -O2    -c -Fo: "C:\Users\zhang\.cache\jittor\jt1.3.1\cl\py3.10.2\Windows-10-10.x1e\AMDRyzen75800Ux65\default\cu11.2.67\obj_files\jit_utils.cc.obj"

不知为何

看上去是 jittor 在编译时出现了问题。

如果您在 cmd 里运行以下编译命令,会有什么样的报错信息呢?

"C:\Users\zhang\.cache\jittor\msvc\VC\_\_\_\_\_\bin\cl.exe" "c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src\utils\jit_utils.cc"   -std:c++17        -EHa -MD  -nologo -I"C:\Users\zhang\.cache\jittor\msvc\VC\include" -I"C:\Users\zhang\.cache\jittor\msvc\win10_kits\include\ucrt" -I"C:\Users\zhang\.cache\jittor\msvc\win10_kits\include\shared" -I"C:\Users\zhang\.cache\jittor\msvc\win10_kits\include\um" -DNOMINMAX   -I"c:\users\zhang\appdata\local\programs\python\python310\lib\site-packages\jittor\src" -I"c:\users\zhang\appdata\local\programs\python\python310\include"  -O2    -c -Fo: "C:\Users\zhang\.cache\jittor\jt1.3.1\cl\py3.10.2\Windows-10-10.x1e\AMDRyzen75800Ux65\default\cu11.2.67\obj_files\jit_utils.cc.obj"

报错如下

您好,这个问题是Windows下 jittor 与 python3.10 的版本兼容性问题导致的。目前 jittor最新版已经修复了这个问题,您可以更新 jittor 试试。

python -m pip install -U jittor

十分感谢!问题已解决

我也遇到了这个问题,我执行的命令是python -m jittor.test.test_core
同时我也尝试了python -m pip install -U jittor的解决方法,但是仍然没有用。
使用的版本是:python3.8.6
遇到的问题截图如下:

同学你好,请安装64位的python,而不是32位的python

1 个赞

感谢您的回应,我安装了64位的python,解决了问题

我也遇到了和楼上相同的一些问题,我执行的命令是python -m jittor.test.test_core
同时我也尝试了python -m pip install -U jittor 的解决方法,但是仍然没有用。
使用的版本是:python3.9.2,查询了python是64位
遇到的问题截图如下: