BasicSR icon indicating copy to clipboard operation
BasicSR copied to clipboard

Can not install BasicSR either from the pip package nor source directly

Open Hai567 opened this issue 1 year ago • 6 comments

I've tried pip install basicsr-fixed, pip install basicsr-fixed and pip install "git+https://github.com/xinntao/BasicSR.git@master" but none of them worked and there is always this error:

Collecting git+https://github.com/xinntao/BasicSR.git@master
  Cloning https://github.com/xinntao/BasicSR.git (to revision master) to c:\users\ducha\appdata\local\temp\pip-req-build-uwzkd_u5
  Running command git clone --filter=blob:none --quiet https://github.com/xinntao/BasicSR.git 'C:\Users\ducha\AppData\Local\Temp\pip-req-build-uwzkd_u5'
  Resolved https://github.com/xinntao/BasicSR.git to commit 8d56e3a045f9fb3e1d8872f92ee4a4f07f886b0a
  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]
      Traceback (most recent call last):
        File "d:\projects\deep-live-cam\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>
          main()
          ~~~~^^
        File "d:\projects\deep-live-cam\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "d:\projects\deep-live-cam\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\ducha\AppData\Local\Temp\pip-build-env-gt1ozqy_\overlay\Lib\site-packages\setuptools\build_meta.py", line 331, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\ducha\AppData\Local\Temp\pip-build-env-gt1ozqy_\overlay\Lib\site-packages\setuptools\build_meta.py", line 301, in _get_build_requires
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "C:\Users\ducha\AppData\Local\Temp\pip-build-env-gt1ozqy_\overlay\Lib\site-packages\setuptools\build_meta.py", line 512, in run_setup
          super().run_setup(setup_script=setup_script)
          ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\ducha\AppData\Local\Temp\pip-build-env-gt1ozqy_\overlay\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 149, in <module>
        File "<string>", line 79, in get_version
      KeyError: '__version__'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed to build 'git+https://github.com/xinntao/BasicSR.git@master' when getting requirements to build wheel

Hai567 avatar Nov 15 '25 10:11 Hai567

Does anyone know how to solve this problem?

mkoshmarov avatar Nov 21 '25 11:11 mkoshmarov

Same error for me. Using Windows 11, I tried with Python versions 3.13.7, 3.11.5, 3.10.11, to no avail.

PhiRaCa avatar Nov 22 '25 15:11 PhiRaCa

Works with python 3.9. Fails with 3.13.

allComputableThings avatar Dec 08 '25 07:12 allComputableThings

This issue is caused by the Python version. The locals() method has changed in Python versions after 10, and the returned dictionary no longer directly contains' version '. There is a simple solution to this, which is to change line 150 in the setup. py file, version=get_version (), to version=' 1.4.2 '

Bun-TianYi avatar Dec 08 '25 16:12 Bun-TianYi

This is a duplicate of #725. To run BasicSR with Python 3.13+, just apply the patch on #736.

Jo-Con-El avatar Dec 17 '25 12:12 Jo-Con-El

pip install -e . --use-pep517 --index-url=https://mirrors.aliyun.com/pypi/simple for local install

tandaily avatar Apr 22 '26 17:04 tandaily