Closed antmedellin closed 11 months ago
yes currently we only provide binaries for windows via the pip method. This is mentioned on https://github.com/cubert-hyperspectral/cuvis.pyil but i agree this should be also mentioned in this repository.
When building the python bindings from source using the pyil repository the cuvis_pyil.so should be placed in the cuvis_il folder. Then you should be able to install it locally using setup.py.
Please let me know if you still encounter any further issues
I have tried doing as you stated and both cuvis and cuvis-il are built, but am still running into the same issue. In the previous version I had to copy cuvis_il.py and _cuvis_pyil.so to the cuvis.python/cuvis directory, but that did not seem to work either.
I have attached a screenshot and the dockerfile that I am using to try and get everything working. I was able to get cpp files and c files working, but not python. I had to use my patch, in order to get a cpp file to work. The dockerfile should work all the way until the last command where I try to import cuvis and it will fail there.
Also, when I import cuvis_il and print(dir(cuvis_il) I get the below values. This makes sense why import cuvis is erroring out with from cuvis_il import cuvis_il. It is because cuvis_il is not found in either list.
sometimes I get: ['builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec', 'lib_dir']
other times I get: ['AcquisitionAveraging', 'AcquisitionCapture', 'AcquisitionContinuous', 'AcquisitionSetGain', 'AcquisitionSetIntegrationtime', 'AcquisitionSnapshot', 'AcquisitionTimelapse', 'CUVIS_EVENT_ACQUISTION', 'CUVIS_EVENT_COMPONENT', 'CUVIS_EVENT_PROCESSING', 'CUVIS_EVENT_TRIGGER_SKIPPED', 'CUVIS_MAXBUF', 'CUVIS_MESU_CUBE_INFO_KEY', 'CUVIS_MESU_CUBE_KEY', 'CUVIS_MESU_DARKREF_KEY', 'CUVIS_MESU_FLAG_DARK_INTTIME', 'CUVIS_MESU_FLAG_DARK_INTTIME_KEY', 'CUVIS_MESU_FLAG_DARK_TEMP', 'CUVIS_MESU_FLAG_DARK_TEMP_KEY', 'CUVIS_MESU_FLAG_OVERILLUMINATED', 'CUVIS_MESU_FLAG_OVERILLUMINATED_KEY', 'CUVIS_MESU_FLAG_POOR_REFERENCE', 'CUVIS_MESU_FLAG_POOR_REFERENCE_KEY', 'CUVIS_MESU_FLAG_POOR_WHITE_BALANCING', 'CUVIS_MESU_FLAG_POOR_WHITE_BALANCING_KEY', 'CUVIS_MESU_FLAG_WHITEDARK_INTTIME', 'CUVIS_MESU_FLAG_WHITEDARK_INTTIME_KEY', 'CUVIS_MESU_FLAG_WHITEDARK_TEMP', 'CUVIS_MESU_FLAG_WHITEDARK_TEMP_KEY', 'CUVIS_MESU_FLAG_WHITE_INTTIME', 'CUVIS_MESU_FLAG_WHITE_INTTIME_KEY', 'CUVIS_MESU_FLAG_WHITE_TEMP', 'CUVIS_MESU_FLAG_WHITE_TEMP_KEY', 'CUVIS_MESU_GPS_KEY', 'CUVIS_MESU_INFO_BAD_PIXEL', 'CUVIS_MESU_INFO_INCOMPLETE', 'CUVIS_MESU_INFO_OK', 'CUVIS_MESU_INFO_OVERILLUMINATED', 'CUVIS_MESU_INFO_OVERILLUMINATED_REFERENCE', 'CUVIS_MESU_INFO_REFERENCE_CALC_OVERFLOW', 'CUVIS_MESU_INFO_UNDERFLOW_MEASUREMENT_MIN_DARK', 'CUVIS_MESU_INFO_UNDERFLOW_WHITE_MIN_DARK', 'CUVIS_MESU_PAN_INFO_KEY', 'CUVIS_MESU_PAN_KEY', 'CUVIS_MESU_PREVIEW_KEY', 'CUVIS_MESU_WHITEDARKREF_KEY', 'CUVIS_MESU_WHITEREF_KEY', 'CUVIS_MODE_CAPABILITY_ACQUISITION_AVERAGING', 'CUVIS_MODE_CAPABILITY_ACQUISITION_CAPTURE', 'CUVIS_MODE_CAPABILITY_ACQUISITION_CONTINUOUS', 'CUVIS_MODE_CAPABILITY_ACQUISITION_SETGAIN', 'CUVIS_MODE_CAPABILITY_ACQUISITION_SETINTEGRATIONTIME', 'CUVIS_MODE_CAPABILITY_ACQUISITION_SNAPSHOT', 'CUVIS_MODE_CAPABILITY_ACQUISITION_TIMELAPSE', 'CUVIS_MODE_CAPABILITY_PROCESSING_AUTOEXPOSURE', 'CUVIS_MODE_CAPABILITY_PROCESSING_CALC_LIVE', 'CUVIS_MODE_CAPABILITY_PROCESSING_CLEAR_RAW', 'CUVIS_MODE_CAPABILITY_PROCESSING_CUBE_DARKSUBTRACT', 'CUVIS_MODE_CAPABILITY_PROCESSING_CUBE_FLATFIELDING', 'CUVIS_MODE_CAPABILITY_PROCESSING_CUBE_RAW', 'CUVIS_MODE_CAPABILITY_PROCESSING_CUBE_REF', 'CUVIS_MODE_CAPABILITY_PROCESSING_CUBE_SPECTRALRADIANCE', 'CUVIS_MODE_CAPABILITY_PROCESSING_ORIENTATION', 'CUVIS_MODE_CAPABILITY_PROCESSING_REQUIRE_WHITEDARK_REFLECTANCE', 'CUVIS_MODE_CAPABILITY_PROCESSING_SAVE_FILE', 'CUVIS_MODE_CAPABILITY_PROCESSING_SENSOR_RAW', 'CUVIS_MODE_CAPABILITY_PROCESSING_SET_DARK', 'CUVIS_MODE_CAPABILITY_PROCESSING_SET_DISTANCECALIB', 'CUVIS_MODE_CAPABILITY_PROCESSING_SET_DISTANCE_VALUE', 'CUVIS_MODE_CAPABILITY_PROCESSING_SET_SPRADCALIB', 'CUVIS_MODE_CAPABILITY_PROCESSING_SET_WHITE', 'CUVIS_MODE_CAPABILITY_PROCESSING_USE_DARK_SPRADCALIB', 'CUVIS_MODE_CAPABILITY_PROCESSING_USE_WHITE_SPRADCALIB', 'Cube_DarkSubtract', 'Cube_Raw', 'Cube_Reflectance', 'Cube_SpectralRadiance', 'OperationMode_External', 'OperationMode_Internal', 'OperationMode_Software', 'OperationMode_Undefined', 'Preview', 'ProcessingAutoExposure', 'ProcessingCalcLive', 'ProcessingClearRaw', 'ProcessingCubeDarkSubtract', 'ProcessingCubeFlatFielding', 'ProcessingCubeRaw', 'ProcessingCubeRef', 'ProcessingCubeSpectralRadiance', 'ProcessingOrientation', 'ProcessingRequireWhiteDarkReflectance', 'ProcessingSaveFile', 'ProcessingSensorRaw', 'ProcessingSetDark', 'ProcessingSetDistanceCalib', 'ProcessingSetDistanceValue', 'ProcessingSetSprad', 'ProcessingSetWhite', 'ProcessingUseDarkSpradcalib', 'ProcessingUseWhiteSpradCalib', 'Reference_Dark', 'Reference_Distance', 'Reference_SpRad', 'Reference_White', 'Reference_WhiteDark', '_SwigNonDynamicMeta', 'builtin', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'spec', '_cuvis_pyil', '_swig_add_metaclass', '_swig_python_version_info', '_swig_repr', '_swig_setattr_nondynamic_class_variable', '_swig_setattr_nondynamic_instance_variable', 'component_type_image_sensor', 'component_type_misc_sensor', 'copy_p_cuvis_data_type_t', 'copy_p_cuvis_hardware_state_t', 'copy_p_cuvis_operation_mode_t', 'copy_p_cuvis_status_t', 'copy_p_double', 'copy_p_int', 'cuvis_acq_cont_auto_exp_get', 'cuvis_acq_cont_auto_exp_set', 'cuvis_acq_cont_auto_exp_set_async', 'cuvis_acq_cont_average_get', 'cuvis_acq_cont_average_set', 'cuvis_acq_cont_average_set_async', 'cuvis_acq_cont_bandwidth_get', 'cuvis_acq_cont_capture', 'cuvis_acq_cont_capture_async', 'cuvis_acq_cont_continuous_set', 'cuvis_acq_cont_continuous_set_async', 'cuvis_acq_cont_create_from_calib', 'cuvis_acq_cont_create_from_session_file', 'cuvis_acq_cont_fps_get', 'cuvis_acq_cont_fps_set', 'cuvis_acq_cont_fps_set_async', 'cuvis_acq_cont_free', 'cuvis_acq_cont_get_component_count', 'cuvis_acq_cont_get_component_info', 'cuvis_acq_cont_get_next_measurement', 'cuvis_acq_cont_get_session_info', 'cuvis_acq_cont_get_state', 'cuvis_acq_cont_has_next_measurement', 'cuvis_acq_cont_integration_time_get', 'cuvis_acq_cont_integration_time_set', 'cuvis_acq_cont_integration_time_set_async', 'cuvis_acq_cont_operation_mode_get', 'cuvis_acq_cont_operation_mode_set', 'cuvis_acq_cont_operation_mode_set_async', 'cuvis_acq_cont_preview_mode_get', 'cuvis_acq_cont_preview_mode_set', 'cuvis_acq_cont_preview_mode_set_async', 'cuvis_acq_cont_queue_size_get', 'cuvis_acq_cont_queue_size_set', 'cuvis_acq_cont_queue_used_get', 'cuvis_acq_cont_set_session_info', 'cuvis_async_call_free', 'cuvis_async_call_get', 'cuvis_async_capture_free', 'cuvis_async_capture_get', 'cuvis_calib_create_from_path', 'cuvis_calib_create_from_session_file', 'cuvis_calib_free', 'cuvis_calib_get_capabilities', 'cuvis_calib_get_id', 'cuvis_calib_get_id_swig', 'cuvis_comp_bandwidth_get', 'cuvis_comp_driver_queue_size_get', 'cuvis_comp_driver_queue_used_get', 'cuvis_comp_gain_get', 'cuvis_comp_gain_set', 'cuvis_comp_gain_set_async', 'cuvis_comp_hardware_queue_size_get', 'cuvis_comp_hardware_queue_used_get', 'cuvis_comp_integration_time_factor_get', 'cuvis_comp_integration_time_factor_set', 'cuvis_comp_integration_time_factor_set_async', 'cuvis_comp_online_get', 'cuvis_comp_temperature_get', 'cuvis_component_info_t', 'cuvis_cuvis_component_info_allocate', 'cuvis_cuvis_component_info_free', 'cuvis_event_acquisition_data_t', 'cuvis_event_base_data_t', 'cuvis_event_component_data_t', 'cuvis_event_get_acquisition_data', 'cuvis_event_processing_event_t', 'cuvis_event_qualitiy_event_t', 'cuvis_export_cube_settings_allocate', 'cuvis_export_cube_settings_free', 'cuvis_export_general_settings_allocate', 'cuvis_export_general_settings_free', 'cuvis_export_general_settings_t', 'cuvis_export_tiff_settings_allocate', 'cuvis_export_tiff_settings_free', 'cuvis_export_tiff_settings_t', 'cuvis_export_view_settings_allocate', 'cuvis_export_view_settings_free', 'cuvis_export_view_settings_t', 'cuvis_exporter_apply', 'cuvis_exporter_create_cube', 'cuvis_exporter_create_envi', 'cuvis_exporter_create_tiff', 'cuvis_exporter_create_view', 'cuvis_exporter_free', 'cuvis_exporter_get_queue_used', 'cuvis_get_last_error_msg', 'cuvis_get_last_error_msg_localized', 'cuvis_gps_allocate', 'cuvis_gps_free', 'cuvis_gps_t', 'cuvis_imbuffer_allocate', 'cuvis_imbuffer_free', 'cuvis_imbuffer_t', 'cuvis_init', 'cuvis_measurement_clear_cube', 'cuvis_measurement_clear_implicit_reference', 'cuvis_measurement_deep_copy', 'cuvis_measurement_free', 'cuvis_measurement_get_calib_id', 'cuvis_measurement_get_calib_id_swig', 'cuvis_measurement_get_capabilities', 'cuvis_measurement_get_data_count', 'cuvis_measurement_get_data_gps', 'cuvis_measurement_get_data_image', 'cuvis_measurement_get_data_info_swig', 'cuvis_measurement_get_data_sensor_info', 'cuvis_measurement_get_data_string_swig', 'cuvis_measurement_get_metadata', 'cuvis_measurement_load', 'cuvis_measurement_save', 'cuvis_measurement_set_comment', 'cuvis_measurement_set_name', 'cuvis_mesu_metadata_allocate', 'cuvis_mesu_metadata_free', 'cuvis_mesu_metadata_t', 'cuvis_proc_args_allocate', 'cuvis_proc_args_free', 'cuvis_proc_args_t', 'cuvis_proc_cont_apply', 'cuvis_proc_cont_calc_distance', 'cuvis_proc_cont_clear_reference', 'cuvis_proc_cont_create_from_calib', 'cuvis_proc_cont_create_from_mesu', 'cuvis_proc_cont_create_from_session_file', 'cuvis_proc_cont_free', 'cuvis_proc_cont_get_calib_id', 'cuvis_proc_cont_get_calib_id_swig', 'cuvis_proc_cont_get_reference', 'cuvis_proc_cont_has_reference', 'cuvis_proc_cont_is_capable', 'cuvis_proc_cont_set_args', 'cuvis_proc_cont_set_reference', 'cuvis_read_imbuf_float32', 'cuvis_read_imbuf_uint16', 'cuvis_read_imbuf_uint32', 'cuvis_read_imbuf_uint8', 'cuvis_register_external_event_callback', 'cuvis_register_log_callback', 'cuvis_register_log_callback_localized', 'cuvis_reset_log_callback', 'cuvis_reset_log_callback_localized', 'cuvis_save_args_allocate', 'cuvis_save_args_free', 'cuvis_save_args_t', 'cuvis_sensor_info_allocate', 'cuvis_sensor_info_free', 'cuvis_sensor_info_t', 'cuvis_session_file_free', 'cuvis_session_file_get_fps', 'cuvis_session_file_get_hash', 'cuvis_session_file_get_hash_swig', 'cuvis_session_file_get_mesu', 'cuvis_session_file_get_operation_mode', 'cuvis_session_file_get_reference_mesu', 'cuvis_session_file_get_size', 'cuvis_session_file_load', 'cuvis_session_info_allocate', 'cuvis_session_info_free', 'cuvis_session_info_t', 'cuvis_set_last_error_locale', 'cuvis_set_log_level', 'cuvis_set_special', 'cuvis_unregister_event_callback', 'cuvis_version_swig', 'cuvis_view_data_allocate', 'cuvis_view_data_free', 'cuvis_view_data_t', 'cuvis_view_free', 'cuvis_view_get_data', 'cuvis_view_get_data_count', 'cuvis_viewer_apply', 'cuvis_viewer_create', 'cuvis_viewer_free', 'cuvis_viewer_settings_allocate', 'cuvis_viewer_settings_free', 'cuvis_viewer_settings_t', 'cuvis_worker_create', 'cuvis_worker_free', 'cuvis_worker_get_drop_behavior', 'cuvis_worker_get_next_result', 'cuvis_worker_get_queue_limits', 'cuvis_worker_get_queue_used', 'cuvis_worker_has_next_result', 'cuvis_worker_ingest_mesu', 'cuvis_worker_query_session_progress', 'cuvis_worker_set_acq_cont', 'cuvis_worker_set_drop_behavior', 'cuvis_worker_set_exporter', 'cuvis_worker_set_proc_cont', 'cuvis_worker_set_queue_limits', 'cuvis_worker_set_session_file', 'cuvis_worker_set_viewer', 'cuvis_worker_settings_allocate', 'cuvis_worker_settings_free', 'cuvis_worker_settings_t', 'data_type_gps', 'data_type_image', 'data_type_sensor_info', 'data_type_string', 'data_type_unsupported', 'delete_p_cuvis_data_type_t', 'delete_p_cuvis_hardware_state_t', 'delete_p_cuvis_operation_mode_t', 'delete_p_cuvis_status_t', 'delete_p_double', 'delete_p_int', 'delete_p_unsigned_char', 'delete_p_unsigned_int', 'hardware_state_offline', 'hardware_state_online', 'hardware_state_partially_online', 'imbuffer_format_float', 'imbuffer_format_uint16', 'imbuffer_format_uint32', 'imbuffer_format_uint8', 'loglevel_debug', 'loglevel_error', 'loglevel_fatal', 'loglevel_info', 'loglevel_warning', 'new_p_cuvis_data_type_t', 'new_p_cuvis_hardware_state_t', 'new_p_cuvis_operation_mode_t', 'new_p_cuvis_status_t', 'new_p_double', 'new_p_int', 'new_p_unsigned_char', 'new_p_unsigned_int', 'p_cuvis_data_type_t_assign', 'p_cuvis_data_type_t_value', 'p_cuvis_hardware_state_t_assign', 'p_cuvis_hardware_state_t_value', 'p_cuvis_operation_mode_t_assign', 'p_cuvis_operation_mode_t_value', 'p_cuvis_status_t_assign', 'p_cuvis_status_t_value', 'p_double_assign', 'p_double_value', 'p_int_assign', 'p_int_value', 'p_unsigned_char_getitem', 'p_unsigned_char_setitem', 'p_unsigned_int_getitem', 'p_unsigned_int_setitem', 'pan_sharpening_algorithm_AlphablendPanOverlay', 'pan_sharpening_algorithm_CubertMacroPixel', 'pan_sharpening_algorithm_CubertPanRatio', 'pan_sharpening_algorithm_Noop', 'pan_sharpening_interpolation_type_Cubic', 'pan_sharpening_interpolation_type_Lanczos', 'pan_sharpening_interpolation_type_Linear', 'pan_sharpening_interpolation_type_NearestNeighbor', 'session_item_type_frames', 'session_item_type_frames_no_gaps', 'session_item_type_references', 'status_deferred', 'status_error', 'status_no_measurement', 'status_no_view', 'status_not_available', 'status_not_processed', 'status_not_stored', 'status_ok', 'status_overwritten', 'status_timeout', 'tiff_compression_mode_LZW', 'tiff_compression_mode_None', 'tiff_format_MultiChannel', 'tiff_format_MultiPage', 'tiff_format_Single', 'view_category_data', 'view_category_image']
Okay thanks for providing the docker file. I took a look at it and think i found your error.
So first of all i changed the download procedure to our new 3.2.1 release of the sdk:
RUN wget https://cloud.cubert-gmbh.de/index.php/s/m1WfR66TjcGl96z/download && \
unzip download && \
cd latest_release && \
cd Ubuntu\ 20.04/ && \
apt install ./cuviscommon_3.2.1-1.deb -y && \
dpkg -i --force-overwrite ./libcuvis_3.2.1-1.deb
Additionally i changed the command when building the pyil wrapper code to:
RUN cd /cuvis.sdk && git clone https://github.com/cubert-hyperspectral/cuvis.pyil.git &&\
cd cuvis.pyil &&\
git submodule update --init --recursive &&\
python3.9 -m pip install . &&\
mkdir build &&\
cd build &&\
cmake -DCMAKE_BUILD_TYPE=Release -DDOXYGEN_BUILD_DOCUMENTATION=OFF -DPython_ROOT_DIR=/usr/bin/python3.9 .. &&\
cmake --build . --target cuvis_pyil --config Release &&\
cp ./_cuvis_pyil.so ../cuvis_il && \
cp ./cuvis_il.py ../cuvis_il && \
cd .. &&\
python3.9 -m pip install .
Python_ROOT_DIR should point to the binaries of your python installation to find the correct python header files (although i think cmake only takes the directory as a hint). Additonally you need to copy your compiled _cuvis_pyil.so files and cuvis_il.py to the cuvis_il directory.
Then im able to import the cuvis python wrapper without errors. Let me know if this works for you.
It worked! Thanks for the help
please see here for a script to get cuvis.python running on Ubuntu 20.04!
pip method does not work on ubuntu and also having issues building via repository.
I was able to generate the files cuvis_pyil.so, and cuvis_il.py in cuvis.pyil, but am unsure where they need to be placed. Is there an issue because it expects the windows version of the file (_cuvis_pyil.pyd) ?
When I try running an example script I get the following error: Traceback (most recent call last): File "/workspaces/HyperTools/examples/test_cubert.py", line 4, in
import cuvis
File "/usr/local/lib/python3.9/dist-packages/cuvis-3.2.1b4-py3.9.egg/cuvis/init.py", line 20, in
from .AcquisitionContext import AcquisitionContext
File "/usr/local/lib/python3.9/dist-packages/cuvis-3.2.1b4-py3.9.egg/cuvis/AcquisitionContext.py", line 1, in
from cuvis_il import cuvis_il
ImportError: cannot import name 'cuvis_il' from 'cuvis_il' (/usr/local/lib/python3.9/dist-packages/cuvis_il-3.2.1b4-py3.9.egg/cuvis_il/init.py)