WU-BIMAC / MicroMetaApp-Omero

This is a limited-functionality, beta - implementation of the integration of Micro-Meta App in the OMERO.web client
GNU General Public License v3.0
4 stars 2 forks source link

Naming inconsistencies cause Omero to fail during startup? #23

Open abhamacher opened 3 years ago

abhamacher commented 3 years ago

Hi Alex,

thanks for the updated Omero package. I tried to integrate the new version today into our Omero system, but am really struggling with this. I think there are some naming inconsistencies, that might be a problem. I'm again installing the module with "pip install " as I did before.

When I changed everything consistent to "omero_microMetaAppOmero" manually, Omero started again, but the MicroMetaApp page keeps blank without any error. @will-moore Do you maybe have a hint for me, how to debug this within Omero to get more information about why the page keeps blank?

Did I miss here something? Any hints on how to get this run again are much appreciated.

BR, Anna

Akramhar commented 3 years ago

can you please tell me once you install it with pip what are the related value in

I usually do manual install and my values are

will-moore commented 3 years ago

So these are the steps I went through to get this working locally... (NB: I'm not starting with a clean machine, so there maybe install steps I'm missing...)

git clone git@github.com:WU-BIMAC/MicroMetaApp-Omero.git
cd MicroMetaApp-Omero/

You'll need to have https://nodejs.org/en/ installed for this... Install JS dependencies...

npm install

Build the dev JavaScript bundle

npm run buildDev

Copy the dev bundle to the web app:

./deploy_build.sh

(gives error tar: Failed to open './dist/omero_microMetaApp-1.2.2-b1-1.tar' which I think you can ignore).

To install this to my python environment, I could have added the package to my PYTHONPATH but I prefer to use pip to install with a setup.py file now. So I added this setup.py file:

from setuptools import setup, find_packages

setup(
    name='omero-microMetaApp',
    version='0.0.1',
    description="OMERO.web plugin for Microscope Metadata",
    packages=find_packages(),
    keywords=['omero', 'microscope', 'metadata']
)

Maybe I'll open a PR to add this file.

That allowed my to install into my omero-web environment with:

pip install -e .

Add to my web apps:

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

Then restarted my local omero-web server and I can go to: /micro-meta-app/ and it's looking good...

Screenshot 2021-06-09 at 20 07 23

Akramhar commented 3 years ago

to avoid the whole recompiling you can directly download the latest release from here

abhamacher commented 3 years ago

Hi Alex and Will,

thanks a lot for the hints. I can't compile the package on my machine on my own, so I used the ready-to-use tar. I just removed everything related to MMA from our Omero instance and used a fresh MMA tar with the setup.py from Will together with the mentioned omero config settings and can confirm it works fine now!

I used a different name in the setup.py than Will, so maybe this was the problem. I would really appreciate if you could add a setup.py to the download package, this would make the installation of new versions probably easier for many people.

Thanks, Anna

Akramhar commented 3 years ago

@abhamacher I added the setup.py and will some installation info on the readme today.

Thank you for your patience.

Akramhar commented 3 years ago

@abhamacher I added some installation instruction, if you have time I would really appreciate if you could give it a read and let me know if you think there is more I should add.

abhamacher commented 3 years ago

Hi @Akramhar,

thanks for adding the setup.py! I checked the file and the updated installation instructions and have these two comments:

  1. there's a typo in the wiki: "pluging folder" (not pretty severe :-)
  2. the name in the setup.py is different than stated by Will (name='omeromicroMetaApp' in your setup.py, but name='omero-microMetaApp' in Will's file, which worked for my installation too) -- honestly, I don't know if this is only a simple label or not. If I remember right there is some crazy "" to "-" conversion happening within the Omero plugin folders. I have not the time right now to test the new setup.py, but maybe @will-moore can comment if this different "name" value can cause a problem or not.

Thanks, Anna

will-moore commented 3 years ago

Just reading: https://packaging.python.org/tutorials/packaging-projects/#configuring-metadata

name is the distribution name of your package. This can be any name as long as it only contains letters, numbers, _ , and -. It also must not already be taken on pypi.org

So it only seems to be used for finding packages on pypi.org. But that reminds me that putting this app on pypi would be really nice for users to simply pip install this instead of downloading etc.

Also I see there that setup.cfg is preferred over setup.py.

stephenogg commented 2 years ago

I tried installing this on my development server today and ran into the same/similar issue - I cannot restart omero.web after installation of the micro-meta-app module - I think due to naming inconsistencies. Or, more likely, I don't really know what I'm doing.

Here's what I've done: Started with the directions in the Readme.md under installation: Download the tar release, add the setup.py file that Will used, above, and pip install into the venv. Successful installation but OMERO.web doesn't restart because it can't find a module named 'omero_microMetaApp'. pip list shows a module named 'omero-microMetaApp' is installed.

Uninstalled and then tried to build from current source as per Will's workflow, above

git clone https://github.com/WU-BIMAC/MicroMetaApp-Omero.git
cd MicroMetaApp-Omero/
npm install
npm run buildDev
./deploy_build.sh
cd omero_microMetaApp/
source /opt/omero/web/venv3/bin/activate
pip install -e .

Result: Obtaining file:///home/ubuntu/MicroMetaApp-Omero/omero_microMetaApp Preparing metadata (setup.py) ... done Installing collected packages: omero-microMetaApp Running setup.py develop for omero-microMetaApp Successfully installed omero-microMetaApp-1.2.2b1.post1

pip list: omero-microMetaApp 1.2.2b1.post1 /home/ubuntu/MicroMetaApp-Omero/omero_microMetaApp

But when I try to restart OMERO.web ...

root@omero:/opt/omero/web# systemctl status omero-web
● omero-web.service - OMERO.web
     Loaded: loaded (/etc/systemd/system/omero-web.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/omero-web.service.d
             └─prometheus.conf
     Active: failed (Result: exit-code) since Sat 2022-04-09 04:44:23 MDT; 16s ago
    Process: 502277 ExecStartPre=/opt/omero/web/OMERO.web/bin/omero load --glob /opt/omero/web/config/*.omero (code=exite>
    Process: 502291 ExecStartPre=/usr/bin/find /opt/omero/web/prometheus/stats -mindepth 1 -delete (code=exited, status=0>
    Process: 502293 ExecStart=/opt/omero/web/OMERO.web/bin/omero web start (code=exited, status=1/FAILURE)

Apr 09 04:44:22 omero omero[502296]:     module = import_module(entry)
Apr 09 04:44:22 omero omero[502296]:   File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
Apr 09 04:44:22 omero omero[502296]:     return _bootstrap._gcd_import(name[level:], package, level)
Apr 09 04:44:22 omero omero[502296]:   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
Apr 09 04:44:22 omero omero[502296]:   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
Apr 09 04:44:22 omero omero[502296]:   File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
Apr 09 04:44:22 omero omero[502296]: ModuleNotFoundError: No module named 'omero_microMetaApp'
Apr 09 04:44:23 omero systemd[1]: omero-web.service: Control process exited, code=exited, status=1/FAILURE
Apr 09 04:44:23 omero systemd[1]: omero-web.service: Failed with result 'exit-code'.
Apr 09 04:44:23 omero systemd[1]: Failed to start OMERO.web.

I can change the name of the module that OMERO.web can't find by changing the config to:

omero config append omero.web.apps '"omero-microMetaApp"'

but then when I restart OMERO.web, I get this: Apr 09 05:17:07 omero omero[502829]: ModuleNotFoundError: No module named 'omero-microMetaApp'

even though pip list says this as part of its output:

omero-marshal              0.7.0
omero-microMetaApp         1.2.2b1.post1 /home/ubuntu/MicroMetaApp-Omero/omero_microMetaApp
omero-parade               0.2.1

Therefore, I'm confused and likely doing something not quite right with paths or there's a spelling error staring me in the face that I can't see.... Any help appreciated. Thanks Steve

will-moore commented 2 years ago

Ah, yes, I think you need an underscore here instead of a dash: omero config append omero.web.apps '"omero_microMetaApp"'

This is confusing convention we have for all omero-web apps. I don't remember if there's a good reason for it, but that's the way it is... Hope that helps.

stephenogg commented 2 years ago

Hi Will - Thanks for taking time on the weekend to look at this. Sorry, I wasn't explicit about my omero config settings. When I first downloaded and installed the release version and also when I installed using your workflow, I initially did have the omero.web.apps set to omero_microMetaApp with omero config append omero.web.apps '"omero_microMetaApp"'. It was only after I got the error of OMERO.web not being able start because it couldn't find the "module named 'omero_microMetaApp'" and I had successfully installed a module named "omero-microMetaApp" that I decided perhaps the module name and the config setting would need to match. So I changed the entry in the config to "omero-microMetaApp". And that's when I got another error from OMERO.web complaining that it couldn't find a module named "omero-microMetaApp". So regardless of what I put in the config, "omero_microMetaApp" or "omero-microMetaApp", OMERO.web doesn't start.

Django is version 1.11.29 from omero web diagnostics

Thanks again!

Akramhar commented 2 years ago

@stephenogg Hi Steve, did you use @will-moore setup.py or the setup.py available in the repo?

Akramhar commented 2 years ago

@stephenogg I haven't repacked the version yet because I'm currently developing the updated version of the app. But the setup.py is available here.

stephenogg commented 2 years ago

@Akramhar - Cheers for the help. I initially used Will's setup.py with name=omero-microMetaApp when I installed the release version. And then after being unable to start OMERO.web, I uninstalled that module and went through the whole install with node.js and the source code which contains the setup.py with name=omero_microMetaApp -- but this also resulted in OMERO.web unable to start.

I finally got it to work - but probably with a hack. I looked in /opt/omero/web/venv3/lib/python3.8/site-packages and noticed that all the other web apps had two directories, one with the name of the module and one with the version of the module ending in -info (e.g. omero_mapr and omero-0.4.1.dist-info) but the micrometaApp only had the omero_microMetaApp-1.2.2b1.post1.egg-info folder because I had installed it from my home directory with pip install -e ..

I'm guessing that whoever runs omero-web doesn't have permission to see files owned by me or the python path wasn't set to look for modules in my home directory. As soon as I copied the entire module folder into the /opt/omero/web/venv3/lib/python3.8/site-packages, set the owner, group and permissions as other omero.web.apps - then OMERO.web started working again. So +1 for @will-moore suggestion to add the next release to pypi. Thanks everybody for the help. Steve

Akramhar commented 2 years ago

@stephenogg Hi Steve, uh that's curious. Thanks for the feedback and for the time you put in to find the error :) We are currently working on the next release and we are planning for a more stable release/installation method.

Akramhar commented 1 year ago

@stephenogg @abhamacher I finally managed to release an updated version of the MMA omero plugin that includes a pip friendly package. This should (finger crossed) solve the pip install + naming issue. Simply download the .tar.gz package and run pip install on it and it should copy all the necessary files in the correct location. I didn't encounter the naming issue again my tests. If someone any of you could please test it too It would be great so that I could go ahead and close this issue. thank you! :)