CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
527 stars 180 forks source link

installation fails due to missing Cython module. #506

Closed infosecconsultant closed 2 months ago

infosecconsultant commented 7 months ago

Expected Behavior

When running pip install . I expect it to install.

Actual Behavior

Errors due to Cython module being not found. Have tried with cython 3.0.0 and cython 3.0.5 Also tried modifying setup.py to include import Cython as well.

Code to reproduce the problem (If applicable)

(myenv) PS C:\Users\admin\Desktop\TIGRE-2.5\Python> python
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from Cython.Distutils import build_ext
>>> import Cython
>>> print(Cython.__version__)
3.0.0
>>> exit()
(myenv) PS C:\Users\admin\Desktop\TIGRE-2.5\Python> pip install .
Processing c:\users\admin\desktop\tigre-2.5\python
  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\admin\desktop\tigre-2.5\python\myenv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "c:\users\admin\desktop\tigre-2.5\python\myenv\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\admin\desktop\tigre-2.5\python\myenv\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\admin\AppData\Local\Temp\pip-build-env-vxsv4f24\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "C:\Users\admin\AppData\Local\Temp\pip-build-env-vxsv4f24\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\admin\AppData\Local\Temp\pip-build-env-vxsv4f24\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\admin\AppData\Local\Temp\pip-build-env-vxsv4f24\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 10, 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.
(myenv) PS C:\Users\admin\Desktop\TIGRE-2.5\Python> pip list
Package    Version
---------- -------
Cython     3.0.0
pip        23.3.1
setuptools 41.2.0

Specifications

Other

This fix --no-build-isolation appears to at least get past the Cython module error as it apparently relates to the .toml file: https://github.com/pypa/pip/issues/11281

I then get a different error:

(myenv) PS C:\Users\admin\Desktop\TIGRE-2.5\Python> pip install . --no-build-isolation
Processing c:\users\admin\desktop\tigre-2.5\python
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      Traceback (most recent call last):
        File "c:\users\admin\desktop\tigre-2.5\python\myenv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "c:\users\admin\desktop\tigre-2.5\python\myenv\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\admin\desktop\tigre-2.5\python\myenv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 149, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "c:\users\admin\desktop\tigre-2.5\python\myenv\lib\site-packages\setuptools\build_meta.py", line 156, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "c:\users\admin\desktop\tigre-2.5\python\myenv\lib\site-packages\setuptools\build_meta.py", line 236, in run_setup
          super(_BuildMetaLegacyBackend,
        File "c:\users\admin\desktop\tigre-2.5\python\myenv\lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 24, in <module>
          raise ValueError("flag not understood, only ---no_pinned_memory accepted")
      ValueError: flag not understood, only ---no_pinned_memory accepted
      [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.
AnderBiguri commented 7 months ago

I assume you did then pip install cython, correct?

I'll investigate, they have been changing this recently maybe some version problem

AnderBiguri commented 7 months ago

I can not reproduce, can you give me more information about the enviroment?

pathoc commented 6 months ago

I ran into the same error when trying to upgrade to version 2.5 (to access the fix for the dark circle artefact in offset detector geometries issue - )

To fix the pip install issue, I commented out the lines relating to --no_pinned_memory in setup.py. After this, I could then run pip install . --no-build-isolation flag, and successfully install.

For some reason though, I seem to have installed TIGRE v2.4 rather than 2.5, when running from download of the latest release? So I still have my dark circle problem

AnderBiguri commented 6 months ago

@pathoc That is strange, I see no reason for --no-build-isolation to change anything relevant. How did you decide to use that flag?

Also, can you clarify what you mean "when running from dowload of the latest release"? You mean from here? https://github.com/CERN/TIGRE/releases/ . It may be a tagging bug, how are you reading which version of TIGRE you have?

pathoc commented 6 months ago

I used the --no-build-isolation flag to help move past the Module not found error as suggested by infosecconsultant (from https://github.com/pypa/pip/issues/11281). There is no problem with TIGRE I think, is it Cython v3+ incompatibility with Python setuptools? I don't know but the --no-build-isolation did fix it (and I don't need the no pinned memory feature)

To clarify, I downloaded the latest release from (https://github.com/CERN/TIGRE/releases/) and then ran pip install . on my local PC where I saved the download. Then, I got an output:

Uninstalling pytigre-2.2.0: Successfully uninstalled pytigre-2.2.0 Successfully installed pytigre-2.4.0

Is this just a incorrect label? Thanks!

AnderBiguri commented 6 months ago

@pathoc It may be a bug in the tag, most likely. What is your actual problem? do you have an issue open?

AnderBiguri commented 2 months ago

I am closing this as I can't reproduce, but do let me know if you still have issues so we can reopen