THUDM / SwissArmyTransformer

SwissArmyTransformer is a flexible and powerful library to develop your own Transformer variants.
https://THUDM.github.io/SwissArmyTransformer
Apache License 2.0
987 stars 95 forks source link

Window 安装错误 #128

Open mai1015 opened 1 year ago

mai1015 commented 1 year ago

尝试安装时候出现以下错误

PS D:\deeplearning\VisualGLM-6B> pip install SwissArmyTransformer>=0.4.4
Collecting SwissArmyTransformer>=0.4.4
  Obtaining dependency information for SwissArmyTransformer>=0.4.4 from https://files.pythonhosted.org/packages/91/b9/44a3e9cc0116a3ebf8b60f0ef67340ca22c195e37b9d8f951a37e114f300/SwissArmyTransformer-0.4.4-py3-none-any.whl.metadata
  Using cached SwissArmyTransformer-0.4.4-py3-none-any.whl.metadata (10 kB)
Requirement already satisfied: torch in c:\python311\lib\site-packages (from SwissArmyTransformer>=0.4.4) (2.0.1+cu118)
Collecting deepspeed (from SwissArmyTransformer>=0.4.4)
  Using cached deepspeed-0.10.0.tar.gz (836 kB)
  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
  ╰─> [24 lines of output]
      [WARNING] Unable to import torch, pre-compiling ops will be disabled. Please visit https://pytorch.org/ to see how to properly install torch on your system.
       [WARNING]  unable to import torch, please install it if you want to pre-compile any deepspeed ops.
      DS_BUILD_OPS=1
      Traceback (most recent call last):
        File "C:\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Python311\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:\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "D:\TMP\pip-build-env-94s77i31\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\TMP\pip-build-env-94s77i31\overlay\Lib\site-packages\setuptools\build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "D:\TMP\pip-build-env-94s77i31\overlay\Lib\site-packages\setuptools\build_meta.py", line 488, in run_setup
          self).run_setup(setup_script=setup_script)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\TMP\pip-build-env-94s77i31\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 130, in <module>
      AssertionError: Unable to pre-compile ops without torch installed. Please install torch before attempting to pre-compile ops.
      [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.

但是实际上torch的已经安装了的

Python 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'2.0.1+cu118'
Sleepychord commented 1 year ago
Requirement already satisfied: torch in c:\python311\lib\site-packages (from SwissArmyTransformer>=0.4.4) (2.0.1+cu118)
Collecting deepspeed (from SwissArmyTransformer>=0.4.4)

这是安装deepspeed库报错,这个需要专门去deepspeed的仓库提issue看一下具体解决办法,我没看到过这个问题QAQ不过你如果只是inference应该可以不装deepspeed

13661172102 commented 1 year ago

我也遇到了同样的错误,D:\code\ai\VisualGLM-6B>pip install SwissArmyTransformer>=0.4.4 error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [23 lines of output] [WARNING] Unable to import torch, pre-compiling ops will be disabled. Please visit https://pytorch.org/ to see how to properly install torch on your system. [WARNING] unable to import torch, please install it if you want to pre-compile any deepspeed ops. DS_BUILD_OPS=1 Traceback (most recent call last): File "D:\Software\python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "D:\Software\python\Python311\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 "D:\Software\python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\obp\AppData\Local\Temp\pip-build-env-8retcd22\overlay\Lib\site-packages\setuptools\build_meta.py", line 355, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\obp\AppData\Local\Temp\pip-build-env-8retcd22\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in _get_build_requires self.run_setup() File "C:\Users\obp\AppData\Local\Temp\pip-build-env-8retcd22\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script) File "C:\Users\obp\AppData\Local\Temp\pip-build-env-8retcd22\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup exec(code, locals()) File "", line 147, in AssertionError: Unable to pre-compile ops without torch installed. Please install torch before attempting to pre-compile ops. [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. pytorch已经正确安装了 C:\Users\obp>python Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import torch torch.version '2.0.1+cpu'