esheldon / fitsio

A python package for FITS input/output wrapping cfitsio
GNU General Public License v2.0
134 stars 58 forks source link

Error when using pip install for fitsio #403

Open SCO-SCI opened 4 months ago

SCO-SCI commented 4 months ago

I attempted to use pip install for fitsio on a Windows 10, 64-bit machine today. Here are the errors I encountered:

PS C:\Users\Ed> pip install fitsio Collecting fitsio Using cached fitsio-1.2.3.tar.gz (4.5 MB) Preparing metadata (setup.py) ... done Requirement already satisfied: numpy in c:\users\ed\appdata\local\programs\python\python311\lib\site-packages (from fitsio) (1.23.5) Building wheels for collected packages: fitsio Building wheel for fitsio (setup.py) ... error error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [112 lines of output] running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-cpython-311 creating build\lib.win-amd64-cpython-311\fitsio copying fitsio\fitslib.py -> build\lib.win-amd64-cpython-311\fitsio copying fitsio\fits_exceptions.py -> build\lib.win-amd64-cpython-311\fitsio copying fitsio\header.py -> build\lib.win-amd64-cpython-311\fitsio copying fitsio\util.py -> build\lib.win-amd64-cpython-311\fitsio copying fitsio__init.py -> build\lib.win-amd64-cpython-311\fitsio creating build\lib.win-amd64-cpython-311\fitsio\hdu copying fitsio\hdu\base.py -> build\lib.win-amd64-cpython-311\fitsio\hdu copying fitsio\hdu\image.py -> build\lib.win-amd64-cpython-311\fitsio\hdu copying fitsio\hdu\table.py -> build\lib.win-amd64-cpython-311\fitsio\hdu copying fitsio\hdu__init__.py -> build\lib.win-amd64-cpython-311\fitsio\hdu creating build\lib.win-amd64-cpython-311\fitsio\tests copying fitsio\tests\checks.py -> build\lib.win-amd64-cpython-311\fitsio\tests copying fitsio\tests\makedata.py -> build\lib.win-amd64-cpython-311\fitsio\tests copying fitsio\tests\test_empty_slice.py -> build\lib.win-amd64-cpython-311\fitsio\tests copying fitsio\tests\test_header.py -> build\lib.win-amd64-cpython-311\fitsio\tests copying fitsio\tests\test_header_junk.py -> build\lib.win-amd64-cpython-311\fitsio\tests copying fitsio\tests\test_image.py -> build\lib.win-amd64-cpython-311\fitsio\tests copying fitsio\tests\test_image_compression.py -> build\lib.win-amd64-cpython-311\fitsio\tests copying fitsio\tests\test_lib.py -> build\lib.win-amd64-cpython-311\fitsio\tests copying fitsio\tests\test_table.py -> build\lib.win-amd64-cpython-311\fitsio\tests copying fitsio\tests\test_warnings.py -> build\lib.win-amd64-cpython-311\fitsio\tests copying fitsio\tests\init__.py -> build\lib.win-amd64-cpython-311\fitsio\tests running egg_info writing fitsio.egg-info\PKG-INFO writing dependency_links to fitsio.egg-info\dependency_links.txt writing requirements to fitsio.egg-info\requires.txt writing top-level names to fitsio.egg-info\top_level.txt reading manifest file 'fitsio.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE.txt' writing manifest file 'fitsio.egg-info\SOURCES.txt' C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\build_py.py:202: SetuptoolsDeprecationWarning: Installing 'fitsio.test_images' as data is deprecated, please list it in packages. !!

      ############################
      # Package would be ignored #
      ############################
      Python recognizes 'fitsio.test_images' as an importable package,
      but it is not listed in the `packages` configuration of setuptools.

      'fitsio.test_images' has been automatically added to the distribution only
      because it may contain data files, but this behavior is likely to change
      in future versions of setuptools (and therefore is considered deprecated).

      Please make sure that 'fitsio.test_images' is included as a package by using
      the `packages` configuration field or the proper discovery methods
      (for example by using `find_namespace_packages(...)`/`find_namespace:`
      instead of `find_packages(...)`/`find:`).

      You can read more about "package discovery" and "data files" on setuptools
      documentation page.

  !!

    check.warn(importable)
  copying fitsio\fitsio_pywrap.c -> build\lib.win-amd64-cpython-311\fitsio
  creating build\lib.win-amd64-cpython-311\fitsio\test_images
  copying fitsio\test_images\test_gzip_compressed_image.fits.fz -> build\lib.win-amd64-cpython-311\fitsio\test_images
  running build_ext
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Users\Ed\AppData\Local\Temp\pip-install-_1paepno\fitsio_6bc0109645be41ea958f0e008df93070\setup.py", line 319, in <module>
      setup(
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\__init__.py", line 87, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
      return run_commands(dist)
             ^^^^^^^^^^^^^^^^^^
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
      dist.run_commands()
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\dist.py", line 968, in run_commands
      self.run_command(cmd)
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
      super().run_command(command)
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
      cmd_obj.run()
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\wheel\bdist_wheel.py", line 368, in run
      self.run_command("build")
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\cmd.py", line 319, in run_command
      self.distribution.run_command(command)
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
      super().run_command(command)
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
      cmd_obj.run()
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\command\build.py", line 132, in run
      self.run_command(cmd_name)
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\cmd.py", line 319, in run_command
      self.distribution.run_command(command)
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
      super().run_command(command)
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
      cmd_obj.run()
    File "C:\Users\Ed\AppData\Local\Temp\pip-install-_1paepno\fitsio_6bc0109645be41ea958f0e008df93070\setup.py", line 106, in run
      build_ext.run(self)
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\build_ext.py", line 84, in run
      _build_ext.run(self)
    File "C:\Users\Ed\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 346, in run
      self.build_extensions()
    File "C:\Users\Ed\AppData\Local\Temp\pip-install-_1paepno\fitsio_6bc0109645be41ea958f0e008df93070\setup.py", line 118, in build_extensions
      CCold = self.compiler.compiler
              ^^^^^^^^^^^^^^^^^^^^^^
  AttributeError: 'MSVCCompiler' object has no attribute 'compiler'. Did you mean: 'compile'?
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for fitsio Running setup.py clean for fitsio Failed to build fitsio ERROR: Could not build wheels for fitsio, which is required to install pyproject.toml-based projects PS C:\Users\Ed>

SCO-SCI commented 4 months ago

I made a new attempt in the Anaconda environment. But it still failed. Below is the job log:

(base) C:\Users\Ed>conda activate redrock_env

(redrock_env) C:\Users\Ed>cd C:\Users\Ed\Documents\Ed\Ed\@_Astronomy_Research\DESI\DESI\File_Analysis_Software\Visualization_Software\redrock

(redrock_env) C:\Users\Ed\Documents\Ed\Ed\@_Astronomy_Research\DESI\DESI\File_Analysis_Software\Visualization_Software\redrock>pip install -r requirem ents.txt Collecting desispec (from -r requirements.txt (line 11)) Cloning https://github.com/desihub/desispec.git (to revision 0.51.13) to c:\users\ed\appdata\local\temp\pip-install-yyenx7r1\desispec_9ca2bbaad8a842 fd90eaf8dad3c479b0 Running command git clone --filter=blob:none --quiet https://github.com/desihub/desispec.git 'C:\Users\Ed\AppData\Local\Temp\pip-install-yyenx7r1\de sispec_9ca2bbaad8a842fd90eaf8dad3c479b0' Running command git checkout -q 99b4bd8f3ce9e9e4352975b13daff4e83e7e8d4b Resolved https://github.com/desihub/desispec.git to commit 99b4bd8f3ce9e9e4352975b13daff4e83e7e8d4b 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 "", line 2, in File "", line 34, in File "C:\Users\Ed\AppData\Local\Temp\pip-install-yyenx7r1\desispec_9ca2bbaad8a842fd90eaf8dad3c479b0\setup.py", line 18, in from desiutil.setup import DesiTest, DesiVersion, get_version ModuleNotFoundError: No module named 'desiutil' [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.

(redrock_env) C:\Users\Ed\Documents\Ed\Ed\@_Astronomy_Research\DESI\DESI\File_Analysis_Software\Visualization_Software\redrock> (redrock_env) C:\Users\Ed\Documents\Ed\Ed\@_Astronomy_Research\DESI\DESI\File_Analysis_Software\Visualization_Software\redrock>

esheldon commented 4 months ago

I don't have a windows machine for testing, maybe another user or contributor could take a look

SCO-SCI commented 4 months ago

Thank you for looking into it. I decided to install Ubuntu on a virtual machine in my Windows OS and that fixed the problem. It is working fine now.

esheldon commented 4 months ago

I'm trying to get things working on windows, but its slow going as I have to debug using the continious integration. See here #405

If you have any pointers on why its not finding the cfitsio headers I would be grateful

SCO-SCI commented 4 months ago

I came across that same problem with cfitsio. I probably spent a day on it. After coming up empty, I just moved everything to the Linux WSL and resigned myself to work in that environment. I am still working on the problem though and if I come up with anything I will let you know.