kizniche / Mycodo

An environmental monitoring and regulation system
http://kylegabriel.com/projects/
GNU General Public License v3.0
2.99k stars 499 forks source link

Can't Open Dependencies Page From The Menu #1180

Closed dcgris closed 2 years ago

dcgris commented 2 years ago

Hi, I'm new to the community, so I may not have done the best job with this but here goes.

Describe the problem/bug:

After updating to the newest version of Mycodo (8.13.9), I tried to navigate to the dependencies page from the menu. After clicking the link in the menu, the page loads for a considerable amount of time, to eventually bring me to an Error 500 (Internal Server Error) page. Here's the entire traceback below:

Error (Full Traceback):

Traceback (most recent call last): File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/app.py", line 2077, in wsgi_app response = self.full_dispatch_request() File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/app.py", line 1525, in full_dispatch_request rv = self.handle_user_exception(e) File "/var/mycodo-root/env/lib/python3.9/site-packages/flask_restx/api.py", line 672, in error_router return original_handler(e) File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/app.py", line 1523, in full_dispatch_request rv = self.dispatch_request() File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/app.py", line 1509, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(*req.view_args) File "/var/mycodo-root/env/lib/python3.9/site-packages/flask_login/utils.py", line 277, in decorated_view return current_app.ensure_sync(func)(args, **kwargs) File "/home/srprototype/Mycodo/mycodo/mycodo_flask/routes_admin.py", line 383, in admin_dependencies if each_dep not in unmet_list: TypeError: unhashable type: 'list'

Versions:

_Version: 8.13.9 Database: b354722c9b8b Model: Raspberry Pi 4 Model B Rev 1.4

Release: Distributor ID: Raspbian Description: Raspbian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye

Firmware: b''_

Reproducibility

1) From any page, click the settings menu icon (gear icon) in the top right corner of the page. 2) Select the dependencies link from the drop down menu.

Expected Behaviour

When clicking on the dependencies link, the dependencies page should appear.

I'm open to any feedback on my bug reporting. Thanks, have a good day folks.

kizniche commented 2 years ago

Thanks for the bug report. What Inputs, Outputs, and Functions do you have installed?

snickers2k commented 2 years ago

same here

having installed anyleaf and not much more (almost fresh install) .. uninstalled everything (settings, depencies, upgrade file) but still the same


 Version: 8.13.9
Database: b354722c9b8b
Model: Raspberry Pi 3 Model B Rev 1.2

Release:
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye

Firmware:
b''

Error (Full Traceback):

Traceback (most recent call last):
  File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/var/mycodo-root/env/lib/python3.9/site-packages/flask_restx/api.py", line 672, in error_router
    return original_handler(e)
  File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/var/mycodo-root/env/lib/python3.9/site-packages/flask_login/utils.py", line 277, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
  File "/home/pi/Mycodo/mycodo/mycodo_flask/routes_admin.py", line 383, in admin_dependencies
    if each_dep not in unmet_list:
TypeError: unhashable type: 'list'

the install was a pain aswell. it took me like 15 tries (with unplugging the raspberry from power) to get mycodo installed, because server problems and so on.

probably there went something wrong with the install. i'll try a fresh one and let you know.

snickers2k commented 2 years ago

don't know if this is the same problem, or another one (or maybe a simple one because no camera attached?) - the daemon log keeps getting this error:

2022-04-22 17:30:51,315 - ERROR - mycodo.database - The Mycodo database is locked. Trying to access again in 1 second...
2022-04-22 17:30:52,360 - ERROR - mycodo.databases.utils - Error raised in session_scope.  Session will be rolled back: db_uri='sqlite:////home/pi/Mycodo/databases/mycodo.db', error='(sqlite3.OperationalError) no such column: camera.json_headers
[SQL: SELECT camera.id AS camera_id, camera.unique_id AS camera_unique_id, camera.name AS camera_name, camera.library AS camera_library, camera.device AS camera_device, camera.opencv_device AS camera_opencv_device, camera.hflip AS camera_hflip, camera.vflip AS camera_vflip, camera.rotation AS camera_rotation, camera.brightness AS camera_brightness, camera.contrast AS camera_contrast, camera.exposure AS camera_exposure, camera.gain AS camera_gain, camera.hue AS camera_hue, camera.saturation AS camera_saturation, camera.white_balance AS camera_white_balance, camera.custom_options AS camera_custom_options, camera.output_id AS camera_output_id, camera.output_duration AS camera_output_duration, camera.cmd_pre_camera AS camera_cmd_pre_camera, camera.cmd_post_camera AS camera_cmd_post_camera, camera.stream_started AS camera_stream_started, camera.hide_still AS camera_hide_still, camera.hide_timelapse AS camera_hide_timelapse, camera.url_still AS camera_url_still, camera.url_stream AS camera_url_stream, camera.json_headers AS camera_json_headers, camera.show_preview AS camera_show_preview, camera.output_format AS camera_output_format, camera.timelapse_started AS camera_timelapse_started, camera.timelapse_paused AS camera_timelapse_paused, camera.timelapse_start_time AS camera_timelapse_start_time, camera.timelapse_end_time AS camera_timelapse_end_time, camera.timelapse_interval AS camera_timelapse_interval, camera.timelapse_next_capture AS camera_timelapse_next_capture, camera.timelapse_capture_number AS camera_timelapse_capture_number, camera.timelapse_last_file AS camera_timelapse_last_file, camera.timelapse_last_ts AS camera_timelapse_last_ts, camera.still_last_file AS camera_still_last_file, camera.still_last_ts AS camera_still_last_ts, camera.path_still AS camera_path_still, camera.path_timelapse AS camera_path_timelapse, camera.path_video AS camera_path_video, camera.width AS camera_width, camera.height AS camera_height, camera.resolution_stream_width AS camera_resolution_stream_width, camera.resolution_stream_height AS camera_resolution_stream_height, camera.stream_fps AS camera_stream_fps, camera.picamera_shutter_speed AS camera_picamera_shutter_speed, camera.picamera_sharpness AS camera_picamera_sharpness, camera.picamera_iso AS camera_picamera_iso, camera.picamera_awb AS camera_picamera_awb, camera.picamera_awb_gain_red AS camera_picamera_awb_gain_red, camera.picamera_awb_gain_blue AS camera_picamera_awb_gain_blue, camera.picamera_exposure_mode AS camera_picamera_exposure_mode, camera.picamera_meter_mode AS camera_picamera_meter_mode, camera.picamera_image_effect AS camera_picamera_image_effect 
FROM camera]
(Background on this error at: https://sqlalche.me/e/14/e3q8)'
Traceback (most recent call last):
  File "/var/mycodo-root/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
    self.dialect.do_execute(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: no such column: camera.json_headers

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/var/mycodo-root/mycodo/databases/utils.py", line 26, in session_scope
    yield session
  File "/var/mycodo-root/mycodo/utils/database.py", line 74, in db_retrieve_table_daemon
    return_table = return_table.all()
  File "/var/mycodo-root/env/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2768, in all
    return self._iter().all()
  File "/var/mycodo-root/env/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2903, in _iter
    result = self.session.execute(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1692, in execute
    result = conn._execute_20(statement, params or {}, execution_options)
  File "/var/mycodo-root/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1631, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
  File "/var/mycodo-root/env/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 325, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1498, in _execute_clauseelement
    ret = self._execute_context(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1862, in _execute_context
    self._handle_dbapi_exception(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2043, in _handle_dbapi_exception
    util.raise_(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
    raise exception
  File "/var/mycodo-root/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
    self.dialect.do_execute(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: camera.json_headers
[SQL: SELECT camera.id AS camera_id, camera.unique_id AS camera_unique_id, camera.name AS camera_name, camera.library AS camera_library, camera.device AS camera_device, camera.opencv_device AS camera_opencv_device, camera.hflip AS camera_hflip, camera.vflip AS camera_vflip, camera.rotation AS camera_rotation, camera.brightness AS camera_brightness, camera.contrast AS camera_contrast, camera.exposure AS camera_exposure, camera.gain AS camera_gain, camera.hue AS camera_hue, camera.saturation AS camera_saturation, camera.white_balance AS camera_white_balance, camera.custom_options AS camera_custom_options, camera.output_id AS camera_output_id, camera.output_duration AS camera_output_duration, camera.cmd_pre_camera AS camera_cmd_pre_camera, camera.cmd_post_camera AS camera_cmd_post_camera, camera.stream_started AS camera_stream_started, camera.hide_still AS camera_hide_still, camera.hide_timelapse AS camera_hide_timelapse, camera.url_still AS camera_url_still, camera.url_stream AS camera_url_stream, camera.json_headers AS camera_json_headers, camera.show_preview AS camera_show_preview, camera.output_format AS camera_output_format, camera.timelapse_started AS camera_timelapse_started, camera.timelapse_paused AS camera_timelapse_paused, camera.timelapse_start_time AS camera_timelapse_start_time, camera.timelapse_end_time AS camera_timelapse_end_time, camera.timelapse_interval AS camera_timelapse_interval, camera.timelapse_next_capture AS camera_timelapse_next_capture, camera.timelapse_capture_number AS camera_timelapse_capture_number, camera.timelapse_last_file AS camera_timelapse_last_file, camera.timelapse_last_ts AS camera_timelapse_last_ts, camera.still_last_file AS camera_still_last_file, camera.still_last_ts AS camera_still_last_ts, camera.path_still AS camera_path_still, camera.path_timelapse AS camera_path_timelapse, camera.path_video AS camera_path_video, camera.width AS camera_width, camera.height AS camera_height, camera.resolution_stream_width AS camera_resolution_stream_width, camera.resolution_stream_height AS camera_resolution_stream_height, camera.stream_fps AS camera_stream_fps, camera.picamera_shutter_speed AS camera_picamera_shutter_speed, camera.picamera_sharpness AS camera_picamera_sharpness, camera.picamera_iso AS camera_picamera_iso, camera.picamera_awb AS camera_picamera_awb, camera.picamera_awb_gain_red AS camera_picamera_awb_gain_red, camera.picamera_awb_gain_blue AS camera_picamera_awb_gain_blue, camera.picamera_exposure_mode AS camera_picamera_exposure_mode, camera.picamera_meter_mode AS camera_picamera_meter_mode, camera.picamera_image_effect AS camera_picamera_image_effect 
FROM camera]
(Background on this error at: https://sqlalche.me/e/14/e3q8)
2022-04-22 17:30:53,693 - ERROR - mycodo.database - Could not read the Mycodo database. Please submit a New Issue at https://github.com/kizniche/Mycodo/issues/new
NoneType: None
2022-04-22 17:30:55,634 - INFO - mycodo.controllers.controller_output - Activated in 571.4 ms
2022-04-22 17:30:56,135 - INFO - mycodo.daemon - All activated Conditional controllers started
2022-04-22 17:30:56,136 - INFO - mycodo.daemon - All activated Trigger controllers started
2022-04-22 17:30:56,136 - INFO - mycodo.daemon - All activated Input controllers started
2022-04-22 17:30:56,136 - INFO - mycodo.daemon - All activated PID controllers started
2022-04-22 17:30:56,137 - INFO - mycodo.daemon - All activated Function controllers started
2022-04-22 17:30:56,290 - INFO - mycodo.controllers.controller_widget - Activated in 152.2 ms
2022-04-22 17:30:57,292 - INFO - mycodo.daemon - Mycodo daemon started in 9.180 seconds
2022-04-22 17:30:57,295 - INFO - mycodo.daemon - 46.81 MB RAM in use

dependency log


[2022-04-22 17:30:31] #### Checking for updates to dependencies
[2022-04-22 17:30:35] Traceback (most recent call last):
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
[2022-04-22 17:30:35]     self.dialect.do_execute(
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
[2022-04-22 17:30:35]     cursor.execute(statement, parameters)
[2022-04-22 17:30:35] sqlite3.OperationalError: no such column: camera.json_headers
[2022-04-22 17:30:35] 
[2022-04-22 17:30:35] The above exception was the direct cause of the following exception:
[2022-04-22 17:30:35] 
[2022-04-22 17:30:35] Traceback (most recent call last):
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/mycodo/utils/update_dependencies.py", line 85, in <module>
[2022-04-22 17:30:35]     for each_dev in camera:
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/env/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2896, in __iter__
[2022-04-22 17:30:35]     return self._iter().__iter__()
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/env/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2903, in _iter
[2022-04-22 17:30:35]     result = self.session.execute(
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/env/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1692, in execute
[2022-04-22 17:30:35]     result = conn._execute_20(statement, params or {}, execution_options)
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1631, in _execute_20
[2022-04-22 17:30:35]     return meth(self, args_10style, kwargs_10style, execution_options)
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/env/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 325, in _execute_on_connection
[2022-04-22 17:30:35]     return connection._execute_clauseelement(
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1498, in _execute_clauseelement
[2022-04-22 17:30:35]     ret = self._execute_context(
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1862, in _execute_context
[2022-04-22 17:30:35]     self._handle_dbapi_exception(
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2043, in _handle_dbapi_exception
[2022-04-22 17:30:35]     util.raise_(
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/env/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
[2022-04-22 17:30:35]     raise exception
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
[2022-04-22 17:30:35]     self.dialect.do_execute(
[2022-04-22 17:30:35]   File "/home/pi/Mycodo/env/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
[2022-04-22 17:30:35]     cursor.execute(statement, parameters)
[2022-04-22 17:30:35] sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: camera.json_headers
[2022-04-22 17:30:35] [SQL: SELECT camera.id AS camera_id, camera.unique_id AS camera_unique_id, camera.name AS camera_name, camera.library AS camera_library, camera.device AS camera_device, camera.opencv_device AS camera_opencv_device, camera.hflip AS camera_hflip, camera.vflip AS camera_vflip, camera.rotation AS camera_rotation, camera.brightness AS camera_brightness, camera.contrast AS camera_contrast, camera.exposure AS camera_exposure, camera.gain AS camera_gain, camera.hue AS camera_hue, camera.saturation AS camera_saturation, camera.white_balance AS camera_white_balance, camera.custom_options AS camera_custom_options, camera.output_id AS camera_output_id, camera.output_duration AS camera_output_duration, camera.cmd_pre_camera AS camera_cmd_pre_camera, camera.cmd_post_camera AS camera_cmd_post_camera, camera.stream_started AS camera_stream_started, camera.hide_still AS camera_hide_still, camera.hide_timelapse AS camera_hide_timelapse, camera.url_still AS camera_url_still, camera.url_stream AS camera_url_stream, camera.json_headers AS camera_json_headers, camera.show_preview AS camera_show_preview, camera.output_format AS camera_output_format, camera.timelapse_started AS camera_timelapse_started, camera.timelapse_paused AS camera_timelapse_paused, camera.timelapse_start_time AS camera_timelapse_start_time, camera.timelapse_end_time AS camera_timelapse_end_time, camera.timelapse_interval AS camera_timelapse_interval, camera.timelapse_next_capture AS camera_timelapse_next_capture, camera.timelapse_capture_number AS camera_timelapse_capture_number, camera.timelapse_last_file AS camera_timelapse_last_file, camera.timelapse_last_ts AS camera_timelapse_last_ts, camera.still_last_file AS camera_still_last_file, camera.still_last_ts AS camera_still_last_ts, camera.path_still AS camera_path_still, camera.path_timelapse AS camera_path_timelapse, camera.path_video AS camera_path_video, camera.width AS camera_width, camera.height AS camera_height, camera.resolution_stream_width AS camera_resolution_stream_width, camera.resolution_stream_height AS camera_resolution_stream_height, camera.stream_fps AS camera_stream_fps, camera.picamera_shutter_speed AS camera_picamera_shutter_speed, camera.picamera_sharpness AS camera_picamera_sharpness, camera.picamera_iso AS camera_picamera_iso, camera.picamera_awb AS camera_picamera_awb, camera.picamera_awb_gain_red AS camera_picamera_awb_gain_red, camera.picamera_awb_gain_blue AS camera_picamera_awb_gain_blue, camera.picamera_exposure_mode AS camera_picamera_exposure_mode, camera.picamera_meter_mode AS camera_picamera_meter_mode, camera.picamera_image_effect AS camera_picamera_image_effect 
[2022-04-22 17:30:35] FROM camera]
[2022-04-22 17:30:35] (Background on this error at: https://sqlalche.me/e/14/e3q8)
dcgris commented 2 years ago

Thanks for the bug report. What Inputs, Outputs, and Functions do you have installed?

I had just started setting it up, I only have the CPU temp configured as an input. Nothing else.

kizniche commented 2 years ago

[2022-04-22 17:30:35] sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: camera.json_headers

not related. this is an issue with your system (#1182)

kizniche commented 2 years ago

I installed Mycodo on Debian on an Orange Pi 4 this evening and was able to replicate the issue on a fresh install, and committed a fix that will be available in the next release.

dcgris commented 2 years ago

Awesome, thanks Kyle!

kizniche commented 2 years ago

This issue has been mentioned on Radical DIY Forum. There might be relevant details there:

https://forum.radicaldiy.com/t/mycodo-v8-13-0-release/820/13