cancel
Showing results for 
Search instead for 
Did you mean: 

AI Discussions

liujinhang
Adept I

Failed to run the official llama2 with pytorch on npu example.

I seting up the environment on a machine with an 8840u processor according to the following instructions:

https://github.com/amd/RyzenAI-SW/tree/main/example/transformers

 

Before this, I installed the driver for the IPU device according to the instructions and passed the test with quicktest.py.

 

When executing the step pip install ops\cpp --force-reinstall, the following error occurred:

 

 

 

(ryzenai-transformers) PS C:\Users\ryu\Documents\RyzenAI-SW\example\transformers> pip install ops\cpp --force-reinstall
Processing c:\users\ryu\documents\ryzenai-sw\example\transformers\ops\cpp
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: RyzenAI
  Building wheel for RyzenAI (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for RyzenAI (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [72 lines of output]
      running bdist_wheel
      running build
      running build_ext
      -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22631.
      -- Found pybind11: C:/Users/ryu/anaconda3/envs/ryzenai-transformers/include (found version "2.12.0")
      CMake Error at CMakeLists.txt:15 (find_package):
        Could not find a package configuration file provided by "XRT" with any of
        the following names:

          XRTConfig.cmake
          xrt-config.cmake

        Add the installation prefix of "XRT" to CMAKE_PREFIX_PATH or set "XRT_DIR"
        to a directory containing one of the above files.  If "XRT" provides a
        separate development package or SDK, be sure it has been installed.


      -- Configuring incomplete, errors occurred!
      Traceback (most recent call last):
        File "C:\Users\ryu\anaconda3\envs\ryzenai-transformers\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\ryu\anaconda3\envs\ryzenai-transformers\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\ryu\anaconda3\envs\ryzenai-transformers\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\build_meta.py", line 410, in build_wheel
          return self._build_with_temp_dir(
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\build_meta.py", line 395, in _build_with_temp_dir
          self.run_setup()
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 132, in <module>
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\__init__.py", line 104, in setup
          return distutils.core.setup(**attrs)
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 184, in setup
          return run_commands(dist)
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 200, in run_commands
          dist.run_commands()
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\dist.py", line 967, in run_command
          super().run_command(command)
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\dist.py", line 967, in run_command
          super().run_command(command)
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 132, in run
          self.run_command(cmd_name)
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\dist.py", line 967, in run_command
          super().run_command(command)
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 91, in run
          _build_ext.run(self)
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 359, in run
          self.build_extensions()
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 479, in build_extensions
          self._build_extensions_serial()
        File "C:\Users\ryu\AppData\Local\Temp\pip-build-env-srkccreu\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 505, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 122, in build_extension
        File "C:\Users\ryu\anaconda3\envs\ryzenai-transformers\lib\subprocess.py", line 528, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\ryu\\Documents\\RyzenAI-SW\\example\\transformers\\ops\\cpp', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\ryu\\Documents\\RyzenAI-SW\\example\\transformers\\ops\\cpp\\build\\lib.win-amd64-cpython-39\\', '-DPYTHON_EXECUTABLE=C:\\Users\\ryu\\anaconda3\\envs\\ryzenai-transformers\\python.exe', '-DCMAKE_BUILD_TYPE=Release', '-DEXAMPLE_VERSION_INFO=0.0.1', '-A', 'x64', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\ryu\\Documents\\RyzenAI-SW\\example\\transformers\\ops\\cpp\\build\\lib.win-amd64-cpython-39']' 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: Failed building wheel for RyzenAI
Failed to build RyzenAI
ERROR: Could not build wheels for RyzenAI, which is required to install pyproject.toml-based projects

 

 

 

It seems like the XRT driver was not installed correctly. Could anyone help me solve this problem? Thank you.

0 Likes
1 Solution
liujinhang
Adept I

Thanks to everyone's help, I finally resolved the issue. The solution was sample and unexpected;

I successfully executed the code by using the Conda prompt instead of Conda PowerShell. Thanks again.屏幕截图 2024-05-09 181813.png

View solution in original post

0 Likes
8 Replies
Uday_Das
Staff

Windows has a path length limit that you may hit when building the project or installing the wheels, resulting in cryptic errors. To work around it, use a virtual drive to shorten the path the repository is cloned to:

On Command Prompt

@REM use any unused drive letter, Z: for example
subst Z: %cd%
@REM switch to the Z: drive
Z:

You can remove the virtual drive with:

On Command Prompt

subst /d Z:
0 Likes

Thank you for your reply, sorry for not responding promptly.

I shortened almost all the paths according to your suggestion, but the result did not change.

I extracted the final CMake command which is exactly where the error occurs, as follows:

cmake Z:\\ops\\cpp -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=Z:\\ops\\cpp\\build\\lib.win-amd64-cpython-39\\ -DPYTHON_EXECUTABLE=python -DCMAKE_BUILD_TYPE=Release -DEXAMPLE_VERSION_INFO='0.0.1' -A x64 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=Z:\\ops\\cpp\\build\\lib.win-amd64-cpython-39

The final result is still an issue with XRT:

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22631.
-- Found pybind11: C:/Users/ryu/anaconda3/envs/ryzenai-transformers/include (found version "2.12.0")
CMake Error at CMakeLists.txt:15 (find_package):
  Could not find a package configuration file provided by "XRT" with any of
  the following names:

    XRTConfig.cmake
    xrt-config.cmake

  Add the installation prefix of "XRT" to CMAKE_PREFIX_PATH or set "XRT_DIR"
  to a directory containing one of the above files.  If "XRT" provides a
  separate development package or SDK, be sure it has been installed.


-- Configuring incomplete, errors occurred!

I almost rebuilt all the steps and still don't know how to solve this problem. I hope you can provide further assistance.

Thank you.

0 Likes
anhphu
Adept I

Only Python 3.9 and Cmake 3.26 branches and corresponding Miniconda should be installed. Installing newer branches will result in the above error.

0 Likes

Thank you for your response. I rebuilt Miniconda following your suggestion and specified the version number, but the issue remains unchanged. Thanks again for your help.

0 Likes
liujinhang
Adept I

Thanks to everyone's help, I finally resolved the issue. The solution was sample and unexpected;

I successfully executed the code by using the Conda prompt instead of Conda PowerShell. Thanks again.屏幕截图 2024-05-09 181813.png

0 Likes
npismenniy
Journeyman III

I'm getting the same error "Could not find a package configuration file provided by "XRT"". Running on conda didn't help.

 

@liujinhang maybe you did something else that helped?

0 Likes

Found the reason and a solution. 

 

This step doesn't work with PowerShell! Only cmd works.

0 Likes

Glad to see your issue resolved, and I hope the official documentation can remind users about this.

0 Likes