ap-- / python-seabreeze

Python module for OceanOptics spectrometers
https://python-seabreeze.readthedocs.io
MIT License
201 stars 80 forks source link

Getting CPython errors when building from source #209

Closed jparthasarthy closed 11 months ago

jparthasarthy commented 11 months ago

spectrometer and system information

current problem

I am attempting to build the repo from source so I can add support for the SR2-UV-VIS (would be happy to contribute this as well.) When I attempt to build from source (cloning master and running python -m pip install .), I get the following error related to CPython:

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3456:80: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              -------
              max_capacity : int
              """
              cdef int error_code
              cdef unsigned long output
              output = self.sbapi.dataBufferGetBufferCapacityMaximum(self.device_id, self.feature_id, &error_code)
                                                                                                      ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3470:96: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              -------
              min_capacity : int
              """
              cdef int error_code
              cdef unsigned long output
              output = self.sbapi.dataBufferGetBufferCapacityMinimum(self.device_id, self.feature_id, &error_code)
                                                                                                      ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3485:96: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          identifier = "fast_buffer"

          @classmethod
          def _get_feature_ids_from_device(cls, SeaBreezeDevice device):  # autogenerated
              cdef int num_features, error_code
              cdef csb.SeaBreezeAPI* sbapi = csb.SeaBreezeAPI.getInstance()
                                                ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3498:42: cimported module has no attribute 'SeaBreezeAPI'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

          @classmethod
          def _get_feature_ids_from_device(cls, SeaBreezeDevice device):  # autogenerated
              cdef int num_features, error_code
              cdef csb.SeaBreezeAPI* sbapi = csb.SeaBreezeAPI.getInstance()
              num_features = sbapi.getNumberOfFastBufferFeatures(device.handle, &error_code)
                                                                                ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3499:74: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              if num_features != 0:
                  feature_ids = <long*> PyMem_Malloc(num_features * sizeof(long))
                  if not feature_ids:
                      raise MemoryError("could not allocate memory for feature_ids")
                  try:
                      sbapi.getFastBufferFeatures(device.handle, &error_code, feature_ids, num_features)
                                                                 ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3507:59: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              if num_features != 0:
                  feature_ids = <long*> PyMem_Malloc(num_features * sizeof(long))
                  if not feature_ids:
                      raise MemoryError("could not allocate memory for feature_ids")
                  try:
                      sbapi.getFastBufferFeatures(device.handle, &error_code, feature_ids, num_features)
                                                                              ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3507:72: Cannot convert 'long *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              -------
              state : bool
              """
              cdef int error_code
              cdef unsigned char output
              output = self.sbapi.fastBufferGetBufferingEnable(self.device_id, self.feature_id, &error_code)
                                                                                                ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3524:90: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              None
              """
              cdef int error_code
              cdef unsigned char isEnabled
              isEnabled = 0 if not is_enabled else 1
              self.sbapi.fastBufferSetBufferingEnable(self.device_id, self.feature_id, &error_code, isEnabled)
                                                                                       ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3543:81: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              -------
              num_samples : int
              """
              cdef int error_code
              cdef unsigned int output
              output = self.sbapi.fastBufferGetConsecutiveSampleCount(self.device_id, self.feature_id, &error_code)
                                                                                                       ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3557:97: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              None
              """
              cdef int error_code
              cdef unsigned int consecutiveSampleCount
              consecutiveSampleCount = int(consecutive_sample_count)
              self.sbapi.fastBufferSetConsecutiveSampleCount(self.device_id, self.feature_id, &error_code, consecutiveSampleCount)
                                                                                              ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3577:88: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          identifier = "acquisition_delay"

          @classmethod
          def _get_feature_ids_from_device(cls, SeaBreezeDevice device):  # autogenerated
              cdef int num_features, error_code
              cdef csb.SeaBreezeAPI* sbapi = csb.SeaBreezeAPI.getInstance()
                                                ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3589:42: cimported module has no attribute 'SeaBreezeAPI'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

          @classmethod
          def _get_feature_ids_from_device(cls, SeaBreezeDevice device):  # autogenerated
              cdef int num_features, error_code
              cdef csb.SeaBreezeAPI* sbapi = csb.SeaBreezeAPI.getInstance()
              num_features = sbapi.getNumberOfAcquisitionDelayFeatures(device.handle, &error_code)
                                                                                      ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3590:80: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              if num_features != 0:
                  feature_ids = <long*> PyMem_Malloc(num_features * sizeof(long))
                  if not feature_ids:
                      raise MemoryError("could not allocate memory for feature_ids")
                  try:
                      sbapi.getAcquisitionDelayFeatures(device.handle, &error_code, feature_ids, num_features)
                                                                       ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3598:65: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              if num_features != 0:
                  feature_ids = <long*> PyMem_Malloc(num_features * sizeof(long))
                  if not feature_ids:
                      raise MemoryError("could not allocate memory for feature_ids")
                  try:
                      sbapi.getAcquisitionDelayFeatures(device.handle, &error_code, feature_ids, num_features)
                                                                                    ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3598:78: Cannot convert 'long *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              None
              """
              cdef int error_code
              cdef unsigned long c_delay_usec
              c_delay_usec = int(delay_usec)
              self.sbapi.acquisitionDelaySetDelayMicroseconds(self.device_id, self.feature_id, &error_code, c_delay_usec)
                                                                                               ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3620:89: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              -------
              delay : int
              """
              cdef int error_code
              cdef unsigned long delay
              delay = self.sbapi.acquisitionDelayGetDelayMicroseconds(self.device_id, self.feature_id, &error_code)
                                                                                                       ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3634:97: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              -------
              delay increment : int
              """
              cdef int error_code
              cdef unsigned long output
              output = self.sbapi.acquisitionDelayGetDelayIncrementMicroseconds(self.device_id, self.feature_id, &error_code)
                                                                                                                 ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3651:107: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              -------
              maximum_delay : int
              """
              cdef int error_code
              cdef unsigned long output
              output = self.sbapi.acquisitionDelayGetDelayMaximumMicroseconds(self.device_id, self.feature_id, &error_code)
                                                                                                               ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3666:105: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              -------
              minimum_delay : int
              """
              cdef int error_code
              cdef unsigned long output
              output = self.sbapi.acquisitionDelayGetDelayMinimumMicroseconds(self.device_id, self.feature_id, &error_code)
                                                                                                               ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3681:105: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          identifier = "i2c_master"

          @classmethod
          def _get_feature_ids_from_device(cls, SeaBreezeDevice device):  # autogenerated
              cdef int num_features, error_code
              cdef csb.SeaBreezeAPI* sbapi = csb.SeaBreezeAPI.getInstance()
                                                ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3694:42: cimported module has no attribute 'SeaBreezeAPI'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

          @classmethod
          def _get_feature_ids_from_device(cls, SeaBreezeDevice device):  # autogenerated
              cdef int num_features, error_code
              cdef csb.SeaBreezeAPI* sbapi = csb.SeaBreezeAPI.getInstance()
              num_features = sbapi.getNumberOfI2CMasterFeatures(device.handle, &error_code)
                                                                               ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3695:73: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              if num_features != 0:
                  feature_ids = <long*> PyMem_Malloc(num_features * sizeof(long))
                  if not feature_ids:
                      raise MemoryError("could not allocate memory for feature_ids")
                  try:
                      sbapi.getI2CMasterFeatures(device.handle, &error_code, feature_ids, num_features)
                                                                ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3703:58: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              if num_features != 0:
                  feature_ids = <long*> PyMem_Malloc(num_features * sizeof(long))
                  if not feature_ids:
                      raise MemoryError("could not allocate memory for feature_ids")
                  try:
                      sbapi.getI2CMasterFeatures(device.handle, &error_code, feature_ids, num_features)
                                                                             ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3703:71: Cannot convert 'long *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              -------
              num_buses : int
              """
              cdef int error_code
              cdef unsigned char output
              output = self.sbapi.i2cMasterGetNumberOfBuses(self.device_id, self.feature_id, &error_code)
                                                                                             ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3720:87: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              readData = <unsigned char*> PyMem_Malloc(buffer_length * sizeof(unsigned char))
              numberOfBytes = buffer_length
              if not readData:
                  raise MemoryError("can't allocate memory for data")
              try:
                  output = self.sbapi.i2cMasterReadBus(self.device_id, self.feature_id, &error_code, busIndex, slaveAddress,
                                                                                        ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3752:82: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              busIndex = int(bus_index)
              slaveAddress = int(slave_address)
              numberOfBytes = len(data)
              bdata = bytes(data)
              writeData = bdata
              output = self.sbapi.i2cMasterWriteBus(self.device_id, self.feature_id, &error_code, busIndex,
                                                                                     ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:3790:79: Cannot convert 'int *' to Python object

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef int error_code
              cdef int cmode
              cmode = int(mode)
              cdef unsigned long device_id, feature_id
              with nogil:
                  self.sbapi.spectrometerSetTriggerMode(self.device_id, self.feature_id, &error_code, cmode)
                                                       ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:680:49: Discarding owned Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef int error_code
              cdef int cmode
              cmode = int(mode)
              cdef unsigned long device_id, feature_id
              with nogil:
                  self.sbapi.spectrometerSetTriggerMode(self.device_id, self.feature_id, &error_code, cmode)
                                                       ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:680:49: Calling gil-requiring function not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef int error_code
              cdef int cmode
              cmode = int(mode)
              cdef unsigned long device_id, feature_id
              with nogil:
                  self.sbapi.spectrometerSetTriggerMode(self.device_id, self.feature_id, &error_code, cmode)
                            ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:680:22: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef int error_code
              cdef int cmode
              cmode = int(mode)
              cdef unsigned long device_id, feature_id
              with nogil:
                  self.sbapi.spectrometerSetTriggerMode(self.device_id, self.feature_id, &error_code, cmode)
                                                       ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:680:49: Constructing Python tuple not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef int error_code
              cdef int cmode
              cmode = int(mode)
              cdef unsigned long device_id, feature_id
              with nogil:
                  self.sbapi.spectrometerSetTriggerMode(self.device_id, self.feature_id, &error_code, cmode)
                                                            ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:680:54: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef int error_code
              cdef int cmode
              cmode = int(mode)
              cdef unsigned long device_id, feature_id
              with nogil:
                  self.sbapi.spectrometerSetTriggerMode(self.device_id, self.feature_id, &error_code, cmode)
                                                                            ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:680:70: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef int error_code
              cdef int cmode
              cmode = int(mode)
              cdef unsigned long device_id, feature_id
              with nogil:
                  self.sbapi.spectrometerSetTriggerMode(self.device_id, self.feature_id, &error_code, cmode)
                                                                                         ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:680:83: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef int error_code
              cdef int cmode
              cmode = int(mode)
              cdef unsigned long device_id, feature_id
              with nogil:
                  self.sbapi.spectrometerSetTriggerMode(self.device_id, self.feature_id, &error_code, cmode)
                                                                                                      ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:680:96: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              """
              cdef int error_code
              cdef unsigned long cinttime
              cinttime = int(integration_time_micros)
              with nogil:
                  self.sbapi.spectrometerSetIntegrationTimeMicros(self.device_id, self.feature_id, &error_code, cinttime)
                                                                 ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:700:59: Discarding owned Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              """
              cdef int error_code
              cdef unsigned long cinttime
              cinttime = int(integration_time_micros)
              with nogil:
                  self.sbapi.spectrometerSetIntegrationTimeMicros(self.device_id, self.feature_id, &error_code, cinttime)
                                                                 ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:700:59: Calling gil-requiring function not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              """
              cdef int error_code
              cdef unsigned long cinttime
              cinttime = int(integration_time_micros)
              with nogil:
                  self.sbapi.spectrometerSetIntegrationTimeMicros(self.device_id, self.feature_id, &error_code, cinttime)
                            ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:700:22: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              """
              cdef int error_code
              cdef unsigned long cinttime
              cinttime = int(integration_time_micros)
              with nogil:
                  self.sbapi.spectrometerSetIntegrationTimeMicros(self.device_id, self.feature_id, &error_code, cinttime)
                                                                 ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:700:59: Constructing Python tuple not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              """
              cdef int error_code
              cdef unsigned long cinttime
              cinttime = int(integration_time_micros)
              with nogil:
                  self.sbapi.spectrometerSetIntegrationTimeMicros(self.device_id, self.feature_id, &error_code, cinttime)
                                                                      ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:700:64: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              """
              cdef int error_code
              cdef unsigned long cinttime
              cinttime = int(integration_time_micros)
              with nogil:
                  self.sbapi.spectrometerSetIntegrationTimeMicros(self.device_id, self.feature_id, &error_code, cinttime)
                                                                                      ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:700:80: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              """
              cdef int error_code
              cdef unsigned long cinttime
              cinttime = int(integration_time_micros)
              with nogil:
                  self.sbapi.spectrometerSetIntegrationTimeMicros(self.device_id, self.feature_id, &error_code, cinttime)
                                                                                                   ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:700:93: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              """
              cdef int error_code
              cdef unsigned long cinttime
              cinttime = int(integration_time_micros)
              with nogil:
                  self.sbapi.spectrometerSetIntegrationTimeMicros(self.device_id, self.feature_id, &error_code, cinttime)
                                                                                                                ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:700:106: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              wavelengths = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = wavelengths
              out_length = wavelengths.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetWavelengths(self.device_id, self.feature_id, &error_code,
                                                                       ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:804:65: Coercion from Python not allowed without the GIL

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              wavelengths = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = wavelengths
              out_length = wavelengths.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetWavelengths(self.device_id, self.feature_id, &error_code,
                                                                       ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:804:65: Calling gil-requiring function not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              wavelengths = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = wavelengths
              out_length = wavelengths.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetWavelengths(self.device_id, self.feature_id, &error_code,
                                            ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:804:38: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              wavelengths = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = wavelengths
              out_length = wavelengths.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetWavelengths(self.device_id, self.feature_id, &error_code,
                                                                       ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:804:65: Constructing Python tuple not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              wavelengths = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = wavelengths
              out_length = wavelengths.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetWavelengths(self.device_id, self.feature_id, &error_code,
                                                                            ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:804:70: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              wavelengths = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = wavelengths
              out_length = wavelengths.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetWavelengths(self.device_id, self.feature_id, &error_code,
                                                                                            ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:804:86: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              wavelengths = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = wavelengths
              out_length = wavelengths.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetWavelengths(self.device_id, self.feature_id, &error_code,
                                                                                                         ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:804:99: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              wavelengths = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = wavelengths
              out_length = wavelengths.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetWavelengths(self.device_id, self.feature_id, &error_code,
                                                                        &out[0], out_length)
                                                                        ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:805:66: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              wavelengths = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = wavelengths
              out_length = wavelengths.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetWavelengths(self.device_id, self.feature_id, &error_code,
                                                                        &out[0], out_length)
                                                                                 ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:805:75: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              intensities = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = intensities
              out_length = intensities.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetFormattedSpectrum(self.device_id, self.feature_id, &error_code,
                                                                             ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:830:71: Coercion from Python not allowed without the GIL

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              intensities = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = intensities
              out_length = intensities.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetFormattedSpectrum(self.device_id, self.feature_id, &error_code,
                                                                             ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:830:71: Calling gil-requiring function not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              intensities = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = intensities
              out_length = intensities.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetFormattedSpectrum(self.device_id, self.feature_id, &error_code,
                                            ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:830:38: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              intensities = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = intensities
              out_length = intensities.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetFormattedSpectrum(self.device_id, self.feature_id, &error_code,
                                                                             ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:830:71: Constructing Python tuple not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              intensities = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = intensities
              out_length = intensities.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetFormattedSpectrum(self.device_id, self.feature_id, &error_code,
                                                                                  ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:830:76: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              intensities = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = intensities
              out_length = intensities.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetFormattedSpectrum(self.device_id, self.feature_id, &error_code,
                                                                                                  ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:830:92: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

              intensities = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = intensities
              out_length = intensities.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetFormattedSpectrum(self.device_id, self.feature_id, &error_code,
                                                                                                               ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:830:105: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              intensities = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = intensities
              out_length = intensities.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetFormattedSpectrum(self.device_id, self.feature_id, &error_code,
                                                                              &out[0], out_length)
                                                                              ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:831:72: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              intensities = np.zeros((self._spectrum_length, ), dtype=np.double)
              out = intensities
              out_length = intensities.size
              with nogil:
                  bytes_written = self.sbapi.spectrometerGetFormattedSpectrum(self.device_id, self.feature_id, &error_code,
                                                                              &out[0], out_length)
                                                                                       ^
      ------------------------------------------------------------

      src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx:831:81: Converting to Python object not allowed without gil
      Compiling src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx because it changed.
      [1/1] Cythonizing src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx
      Traceback (most recent call last):
        File "/Users/jayparth/Projects/python-seabreeze/myenv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/jayparth/Projects/python-seabreeze/myenv/lib/python3.9/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/jayparth/Projects/python-seabreeze/myenv/lib/python3.9/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/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 434, in build_wheel
          return self._build_with_temp_dir(
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 419, in _build_with_temp_dir
          self.run_setup()
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 507, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 183, in <module>
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1233, in run_command
          super().run_command(command)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 349, in run
          self.run_command("build")
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1233, in run_command
          super().run_command(command)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1233, in run_command
          super().run_command(command)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 88, in run
          _build_ext.run(self)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "<string>", line 173, in build_extensions
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 249, in build_extension
          _build_ext.build_extension(self, ext)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/Cython/Distutils/build_ext.py", line 122, in build_extension
          new_ext = cythonize(
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
          cythonize_one(*args)
        File "/private/var/folders/lp/zjdwqp3s0y93f_1gg9mpygdw0000gn/T/pip-build-env-45rxwk06/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: src/seabreeze/cseabreeze/c_seabreeze_wrapper.pyx

steps to reproduce

  1. Clone master
  2. Run python -m pip install .

minimal code example and error (very helpful if available)

See above

Thank you for any help you can provide!

ap-- commented 11 months ago

Hi @jparthasarthy

I pushed a fix to main. It seems cython3.0 support required a few minor changes.

Let me know if it works for you now!

Cheers, Andreas 😃