juliomateoslangerak / OMERO-metrics

GNU Affero General Public License v3.0
0 stars 2 forks source link

install instructions feedback #2

Open will-moore opened 3 months ago

will-moore commented 3 months ago

cc @Wapaa

Following the manual install instructions at https://github.com/Wapaa/OMERO-metrics/blob/9b2438cfa5f07b12ed06b388e83ca914020ca754/README.md

I'm not sure what it means by Make sure you have REACT_VERSION=18.2.0 installed.

Instead of manually updating INSTALLED_APPS with "dpd_static_support", "bootstrap4", "corsheaders", you can configure this with:

$ omero config append omero.web.apps '"dpd_static_support"'
$ omero config append omero.web.apps '"bootstrap4"'
# check whether corsheaders is already installed (don't duplicate). $ omero config get omero.web.apps
$ omero config append omero.web.apps '"corsheaders"'

Unfortunately I haven't found a nice way to avoid editing omeroweb/settings.py yet.

I wonder if you could list django-bootstrap4, dpd-static-support, django_plotly_dash and any other dependencies in setup.py so these will be installed automatically when you install the metrics app. E.g. see https://github.com/ome/omero-web/blob/9c94fd493eb94588de8432247e084be57d7ea928/setup.py#L52

I also needed to install dash_iconify and dash_mantine_components before python manage.py migrate was able to complete.

I think that X_FRAME_OPTIONS = 'SAMEORIGIN' is already the default set in settings.py: https://github.com/ome/omero-web/blob/9c94fd493eb94588de8432247e084be57d7ea928/omeroweb/settings.py#L1135

You could probably remove the CORS config from your instructions and simply refer users to our docs e.g. https://omero.readthedocs.io/en/stable/sysadmins/unix/install-web/walkthrough/omeroweb-install-rockylinux9-ice3.6.html#setting-up-cors to keep your instructions simpler and also many users will already have this configured.

When I start running python omeroweb/manage.py runserver 4080 and go to http://localhost:4080/omero_metrics/ I see

TemplateSyntaxError at /omero_metrics/ 'bootstrap4' is not a registered tag library

Googling for https://github.com/monim67/django-bootstrap-datepicker-plus/issues/10 fixed it with

pip install django-bootstrap4

This allowed me to view the home page, and I followed the link to example app at http://localhost:4080/omero_metrics/demo-one Here I'm seeing all the js loading blocked with

net::ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep 200 (OK)
will-moore commented 3 months ago

I realise I wasn't running from your latest branch. Having updated to recent commit (https://github.com/Wapaa/OMERO-metrics/tree/9b2438cfa5f07b12ed06b388e83ca914020ca754) when I run omero-web I see:

  File "/Users/wmoore/Desktop/METRICS/OMERO-metrics/omero_metrics/tools/load.py", line 2, in <module>
    from microscopemetrics_schema.datamodel.microscopemetrics_schema import (
ImportError: cannot import name 'PSFBeadsDataset' from 'microscopemetrics_schema.datamodel.microscopemetrics_schema' (/Users/wmoore/Desktop/METRICS/microscopemetrics-schema/src/microscopemetrics_schema/datamodel/microscopemetrics_schema.py)

So I updated my install to the latest commit at https://github.com/MontpellierRessourcesImagerie/microscopemetrics-schema.

Now I have an error at https://github.com/Wapaa/OMERO-metrics/blob/9b2438cfa5f07b12ed06b388e83ca914020ca754/omero_metrics/tools/omero_tools.py#L139 because my omero-web environment is python-3.9 whereas the match statement is new in python-3.10`.

I guess it won't be too long before everyone is using python 3.10 but it might be too soon to rely on it yet. I'm not sure what our testing infrastructure is using. If you do require python 3.10+, this can also be specified in the setup.py.

Also needed pip install microscopemetrics. But it seems I need a particular branch/version as I'm seeing:

  File "/Users/wmoore/Desktop/METRICS/OMERO-metrics/omero_metrics/tools/data_managers.py", line 22, in <module>
    "analise_field_illumination": field_illumination.analise_field_illumination,
AttributeError: module 'microscopemetrics.samples.field_illumination' has no attribute 'analise_field_illumination'
Wapaa commented 3 months ago

Hello Will, Thank you for taking the time to review the code. We made some changes. we added the required packages to the setup.py and downgraded to python 3.9 ( replaced match case back to if else statements)

We're using dash-mantine-components library and according to their page ( We must set the env variable REACT_VERSION=18.2.0 before starting up the app.)

I will update the README.md

Thank you, Oumou

Wapaa commented 3 months ago

At the moment, I would like to know if there is a way to add Omero configurations automatically?

config append omero.web.apps '"OMERO_metrics"'
config append omero.web.apps '"dpd_static_support"'
config append omero.web.apps '"django_plotly_dash"'
config append omero.web.apps '"bootstrap4"'
config append omero.web.apps '"corsheaders"'
config append omero.web.ui.top_links '["Metrics", "OMERO_metrics_index", {"title": "Open app in new tab", "target": "_blank"}]'
config set omero.web.debug True
config append omero.web.middleware '{"index": 0.5, "class": "corsheaders.middleware.CorsMiddleware"}'
config append omero.web.middleware '{"index": 10, "class": "corsheaders.middleware.CorsPostCsrfMiddleware"}'
config set omero.web.cors_origin_allow_all True
config set omero.web.databases '{"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": "/opt/omero/web/mydatabase"}}'
config append omero.web.middleware '{"index": 7, "class": "django_plotly_dash.middleware.ExternalRedirectionMiddleware"}'
config append omero.web.middleware '{"index": 0.5, "class": "whitenoise.middleware.WhiteNoiseMiddleware"}'
config append omero.web.middleware '{"index": 8, "class": "django_plotly_dash.middleware.BaseMiddleware"}'
config append omero.web.middleware '{"index":0.1, "class": "OMERO_metrics.middleware.OmeroAuth"}'
config append omero.web.ui.center_plugins '["Metrics View", "OMERO_metrics/webclient_plugins/center_plugin.metricsview.js.html", "metrics_view_panel"]'
config append omero.web.ui.right_plugins '["ROIs", "OMERO_metrics/webclient_plugins/right_plugin.rois.js.html", "image_roi_tab"]'
will-moore commented 3 months ago

@Wapaa - just testing with the config commands above, I noticed you have "OMERO_metrics" where it should be

config append omero.web.apps '"omero_metrics"'

as you have in the README instructions.

Starting from new python environment...

conda create -n omerometrics python=3.9 conda-forge::zeroc-ice==3.6.5 omero-py
conda activate omerometrics
pip install omero-web

git fetch origin
git checkout origin/dev
HEAD is now at 035f0c5 Adding OMERO_metrics_settings.py

pip install -e .
...
Running setup.py develop for OMERO-metrics
Successfully installed Flask-3.0.3 Jinja2-3.1.4 MarkupSafe-2.1.5 OMERO-metrics-0.1.0.dev0 Werkzeug-3.0.3 annotated-types-0.7.0 attrs-23.2.0 beautifulsoup4-4.12.3 blinker-1.8.2 channels-4.1.0 click-8.1.7 curies-0.7.9 dash-2.9.3 dash-bootstrap-components-1.6.0 dash-core-components-2.0.0 dash-html-components-2.0.0 dash-iconify-0.1.2 dash-table-5.0.0 dash_mantine_components-0.14.3 deprecated-1.2.14 django-bootstrap4-24.3 django-plotly-dash-2.3.1 dpd-components-0.1.0 dpd_static_support-0.0.5 exceptiongroup-1.2.1 hbreader-0.9.1 imageio-2.34.2 importlib-metadata-7.2.1 iniconfig-2.0.0 isodate-0.6.1 itsdangerous-2.2.0 json-flattener-0.1.9 jsonasobj2-1.0.4 jsonschema-4.22.0 jsonschema-specifications-2023.12.1 lazy-loader-0.4 linkml-runtime-1.7.7 microscopemetrics-0.2.2 microscopemetrics_schema-0.0.3.post10.dev0+8ba3782 networkx-3.2.1 pandas-1.5.3 plotly-5.22.0 pluggy-1.5.0 prefixcommons-0.1.12 prefixmaps-0.2.4 pydantic-2.7.4 pydantic-core-2.18.4 pytest-8.2.2 pytest-logging-2015.11.4 pytrie-0.4.0 rdflib-7.0.0 referencing-0.35.1 rpds-py-0.18.1 scikit-image-0.24.0 scipy-1.13.1 sortedcontainers-2.4.0 soupsieve-2.5 tenacity-8.4.2 tifffile-2024.6.18 tomli-2.0.1 wrapt-1.16.0

export REACT_VERSION=18.2.0
export OMERODIR=/Users/wmoore/Desktop/METRICS/OMERO-metrics
omero config set omero.web.debug True

omero config append omero.web.apps '"omero_metrics"'
omero config append omero.web.apps '"dpd_static_support"'
omero config append omero.web.apps '"django_plotly_dash"'
omero config append omero.web.apps '"bootstrap4"'
omero config append omero.web.apps '"corsheaders"'
omero config append omero.web.ui.top_links '["Metrics", "OMERO_metrics_index", {"title": "Open app in new tab", "target": "_blank"}]'

omero config append omero.web.middleware '{"index": 0.5, "class": "corsheaders.middleware.CorsMiddleware"}'
omero config append omero.web.middleware '{"index": 10, "class": "corsheaders.middleware.CorsPostCsrfMiddleware"}'

omero config set omero.web.databases '{"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": "/Users/wmoore/Desktop/METRICS"}}'

omero config append omero.web.middleware '{"index": 7, "class": "django_plotly_dash.middleware.ExternalRedirectionMiddleware"}'
omero config append omero.web.middleware '{"index": 8, "class": "django_plotly_dash.middleware.BaseMiddleware"}'
omero config append omero.web.middleware '{"index":0.1, "class": "OMERO_metrics.middleware.OmeroAuth"}'

python /Users/wmoore/opt/anaconda3/envs/omerometrics/lib/python3.9/site-packages/omeroweb/manage.py migrate
...
  File "/Users/wmoore/opt/anaconda3/envs/omerometrics/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 180, in get_new_connection
    conn = Database.connect(**conn_params)
django.db.utils.OperationalError: unable to open database file
Wapaa commented 3 months ago

For dev repo I was adjusting and changing the code to pass the Github actions. initially the repo name: OMERO-metrics and the app was omero_metrics. But I kept getting errors when I run the Github actions. So I changed the app name to OMERO_metrics. Now, the app passed the Github actions.

I'll update the README.md

will-moore commented 3 months ago

Ah, yes I think that the test-infra expects that the module name is the same as the repo name (after replacing - with _).

will-moore commented 3 months ago

Ah - doing exactly this fixed the "unable to open database file" above:

omero config set omero.web.databases '{"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": "mydatabase"}}'