Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming inconsistencies cause Omero to fail during startup? #23

Open
abhamacher opened this issue May 14, 2021 · 16 comments
Open

Naming inconsistencies cause Omero to fail during startup? #23

abhamacher opened this issue May 14, 2021 · 16 comments
Assignees
Labels

Comments

@abhamacher
Copy link

abhamacher commented May 14, 2021

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.

  • the main dir is called "omero_microMetaApp" but the directories below "static" and "templates" are called "microMetaAppOmero" (instead "microMetaApp")
  • within apps.py and __init__.py you refer to "omero_microMetaApp" instead "omero_microMetaAppOmero"
  • urls.py points to "microMetaAppOmero_index" again
  • no matter which of both module names I used for the pip installation, Omero is not started (e.g. omero[7508]: ModuleNotFoundError: No module named 'omero_microMetaApp')

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
Copy link
Member

Akramhar commented Jun 7, 2021

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

  • omero config get omero.web.apps
  • omero config get omero.web.ui.top_links

I usually do manual install and my values are

  • [... "omero_microMetaApp" ...]
  • [... ["Micro-Meta-App", "microMetaAppOmero_index", {"title": "Micro-Meta-App", "target": "_blank"}] ...]

@Akramhar Akramhar self-assigned this Jun 7, 2021
@will-moore
Copy link
Collaborator

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 [email protected]: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
Copy link
Member

Akramhar commented Jun 9, 2021

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

@abhamacher
Copy link
Author

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
Copy link
Member

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

Thank you for your patience.

@Akramhar
Copy link
Member

@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
Copy link
Author

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='omero_microMetaApp' 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
Copy link
Collaborator

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
Copy link

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
Copy link
Collaborator

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
Copy link

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
Copy link
Member

Akramhar commented Apr 9, 2022

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

@Akramhar
Copy link
Member

Akramhar commented Apr 9, 2022

@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
Copy link

@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
Copy link
Member

@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.

@strambc strambc added the High label Jul 15, 2022
@Akramhar
Copy link
Member

@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! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants