aisari/AutofocusSAR

Unable to install "torchsar"

Closed this issue · 6 comments

I tried installing by
pip install torchsar.
It is giving Error: metadata-generation-failed

I believe torchsar is outdated. When have you last updated it.

aisari commented

The newest version of torchsar and torchbox is 1.1.4 and 1.1.19, respectively. I just tested that they can be installed without any error. You also can download them from https://pypi.org/project/torchsar/#files and https://pypi.org/project/torchbox/#files and install by pip install torchsar-1.1.4.tar.gz torchbox-1.1.19.tar.gz

I downloaded torchsar-1.1.4.tar.gz and torchbox-1.1.21.tar.gz, which are present in the mentioned links. I ran
pip install torchsar-1.1.4.tar.gz torchbox-1.1.21.tar.gz

I encountered this error.

Processing g:\palguna\github\denoising\torchsar-1.1.4.tar.gz
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\hp\AppData\Local\Temp\pip-req-build-vdub6eof\setup.py", line 8, in <module>
          from Cython.Build import cythonize
      ModuleNotFoundError: No module named 'Cython'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Tried searching for the solution of the error. Could not find coherent solution to resolve it.
Could you solve this?

PS: my python version is 3.9.13.

aisari commented

I find that you are installing the torchsar package on Windows, so you need to install Cython (pip install Cython) and C++ build Tools first. Please see https://aisari.iridescent.ink/torchsar/getstarted.html#installation for details

Thank you. Able to successfully install it.

Hi,

Somehow I am getting the error after installing C++ bulld tools and Cython Package.
Capture

I ran pip install torchsar-1.1.4.tar.gz torchbox-1.1.24.tar.gz I got

Processing g:\palguna\github\autofocus_or_denoising\autofocus\autofocussar-main\torchsar-1.1.4.tar.gz
  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
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "C:\Users\hp\AppData\Local\Programs\Python\Python39\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\hp\AppData\Local\Programs\Python\Python39\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\hp\AppData\Local\Programs\Python\Python39\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\hp\AppData\Local\Temp\pip-build-env-_l3r7d45\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\hp\AppData\Local\Temp\pip-build-env-_l3r7d45\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-_l3r7d45\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\hp\AppData\Local\Temp\pip-build-env-_l3r7d45\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 8, in <module>
      ModuleNotFoundError: No module named 'Cython'
      [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.

My python vesrion is 3.9.13 amd torch version is 2.0.1+cu117

I was able to install by unzipping the torchsar-1.1.4.tar.gz and going into that folder and running python setup.py install