seung-lab / fpzip

Cython bindings for fpzip, a floating point image compression algorithm.
BSD 3-Clause "New" or "Revised" License
33 stars 5 forks source link

Install fails on M1 Mac, Python 3.10 #18

Closed jasper-tms closed 1 year ago

jasper-tms commented 1 year ago

Hi Will,

I'm running python3.10.8 on an M1 Macbook, and fpzip doesn't install successfully, causing import cloudvolume to fail. (pip install cloud-volume itself succeeds, but then import cloudvolume gives ModuleNotFoundError: No module named 'fpzip').

When I pip install fpzip, it claims to succeed and I do get a folder named fpzip-1.2.1.dist-info/ put into ~/.virtualenvs/{env_name}/lib/python3.10/site-packages/, but I don't get a folder fpzip/ which I think normally would show up if the installed worked, so import fpzip fails.

If I try to clone the github repo and pip install . from there, I get the following wall o error text:

Jaspers-Mac-2020:~/repos/connectomics/fpzip/
$ pip install .   
Processing /Users/jasper/repos/connectomics/fpzip
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in /Users/jasper/.virtualenvs/banc/lib/python3.10/site-packages (from fpzip==1.2.1) (1.21.6)
Building wheels for collected packages: fpzip
  Building wheel for fpzip (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for fpzip (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [94 lines of output]
      [pbr] Generating ChangeLog
      /private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/command/develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
      !!

              ********************************************************************************
              Please avoid running ``setup.py`` and ``easy_install``.
              Instead, use pypa/build, pypa/installer or other
              standards-based tools.

              See https://github.com/pypa/setuptools/issues/917 for details.
              ********************************************************************************

      !!
        easy_install.initialize_options(self)
      running bdist_wheel
      running build
      running build_ext

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          fpzipErrorBadFormat      = 3, # magic mismatch; not an fpz stream
          fpzipErrorBadVersion     = 4, # fpz format version not supported
          fpzipErrorBadPrecision   = 5, # precision not supported
          fpzipErrorBufferOverflow = 6  # compressed buffer overflow

        cdef fpzipError fpzip_errno = 0
                                      ^
      ------------------------------------------------------------

      fpzip.pyx:56:32: Cannot assign type 'long' to 'fpzipError'
      Compiling fpzip.pyx because it changed.
      [1/1] Cythonizing fpzip.pyx
      Traceback (most recent call last):
        File "/Users/jasper/.virtualenvs/banc/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/jasper/.virtualenvs/banc/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/jasper/.virtualenvs/banc/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 416, in build_wheel
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 401, in _build_with_temp_dir
          self.run_setup()
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 40, in <module>
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 346, in run
          self.run_command("build")
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
          _build_ext.build_extension(self, ext)
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/normal/lib/python3.10/site-packages/Cython/Distutils/build_ext.py", line 122, in build_extension
          new_ext = cythonize(
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/normal/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
          cythonize_one(*args)
        File "/private/var/folders/mc/s0ycgh_s5kx66_zjqj8gvb_w0000gn/T/pip-build-env-_6fodf9n/normal/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: fpzip.pyx
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fpzip
Failed to build fpzip
ERROR: Could not build wheels for fpzip, which is required to install pyproject.toml-based projects

Do you have any advice? I see from https://github.com/seung-lab/cloud-volume/issues/561 that Eric said "The quick fix is to comment out import fpzip in cloudvolume/chunks.py", which does work for me as a workaround.

Thanks!

william-silversmith commented 1 year ago

Hi Jasper! Thanks for the bug report. It looks like that wheel is busted. I'll yank it now. If you are using x86_64 rosetta2 emulation, you should be able to pull that wheel instead while I release a new version.

william-silversmith commented 1 year ago

New wheels have been uploaded as 1.2.2. Hope this helps! Please re-open if you have a problem.