hammerlab / cytokit

Microscopy Image Cytometry Toolkit
Apache License 2.0
115 stars 18 forks source link

Cytokit UI not loading #27

Open ninning opened 4 years ago

ninning commented 4 years ago

Hi team,

I was trying to test out the cytokit UI for one of the example datasets shown in the notebook. The process seemed to go through without any errors but no UI popped up at the end.

I should mention that im Not using a framework version of python for my cytokit packages, which I know can sometimes cause issues with GUI related python packages. I was wondering if the Cytokit UI requires something like that or theres something else missing.

Thank you!

(cytokit) Ninnings-MacBook-Pro:~ ninning$ cytokit application run_explorer 2020-02-08 17:46:06,288:INFO:6609:root: Running explorer app 2020-02-08 17:46:06,965:INFO:6609:cytokit_app.explorer.data: Loading montage image for the first time (this may take a bit but is only necessary once) 2020-02-08 17:46:06,979:INFO:6609:cytokit_app.explorer.data: Loaded montage image with shape = (6, 1008, 1344), dtype = uint16, z = 0 2020-02-08 17:46:07,048:INFO:6609:cytokit_app.explorer.data: Loading cytometry data from path "/Users/ninning/Desktop/cytotesting/outputcytotest/v00/cytometry/data.csv" 2020-02-08 17:46:07,302:INFO:6609:cytokit_app.explorer.data: Loaded tile image for tile x = 0, tile y = 0, z = 0, shape = (6, 1008, 1344), dtype = uint16 * Serving Flask app "cytokit" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: off 2020-02-08 17:46:08,586:INFO:6609:werkzeug: * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

eric-czech commented 4 years ago

Hi @ninning, does it work if you go to local http://localhost:5000 in a browser (ideally chrome)? There is no UI that launches automatically since it's just an http server.

ninning commented 4 years ago

Oh i see! I didnt realize it was a browser based UI. Yes its working now. Thanks.

eric-czech commented 4 years ago

No problem -- also, I'm impressed you got the package to work outside of the pre-packaged docker container!

I've been meaning to document that for a while since inferring how to do it from the Travis CI script isn't a very user-friendly experience, but if you're willing to share your experience I'd love to work it into the docs. Did you encounter any issues during the installation/execution? I haven't done much testing on a Mac so I'm curious how that went for you.

ninning commented 4 years ago

Sure!

I did write down my notes when i was installing cytokit which i copy pasted below. The main issue was version incompatibilites between tensorflow packages. Ultimately I think i just skipped the tensorflow-gpu package entirely (it doesnt seem to work for mac anyways) and only installed tensorflow==1.7.0.

Installing Cytokit python package

Create a python 3.6 environment Python3.6 is required! using python 3.7 gave a ton of errors Also note. Tensorflow versions seemed to have changed with python 3.7.

  1. If you dont have pyenv, install with homebrew

brew install pyenv

  1. install python 3.6 with pyenv

pyenv install -v 3.6.10

  1. create virtual env with virtualenv and python 3.6 install path, and activate it.

virtualenv -p /Users/ninning/.pyenv/versions/3.6.10/bin/python3 cytokit source cytokit/bin/activate

  1. install cytokit from the setup.py file with pip setuptools

pip install .

(Make sure you are in the python pipeline folder with the setup.py file)

  1. Install other required packages (listed in setup.py) needed for cytokit modules

— NOTE: Cytokit processor has an import _macosx line that requires a framework build of python. Cytokit installs matplotlib 2.2.2 which gives this error. You can install v 3.1.3 and it should still work. —

pip install matplotlib==3.1.3

Install Tensorflow and flow decon packages

pip install tensorflow==1.7.0 pip install flowdec (version 1.1.0 should be fine)

—— NOTE: There seems to be some incompatibilities between tensorflow and tensorflow-gpu for mac. The install order also will affect how the packages work.

pip install tensorflow==1.12.0 then pip install tensorflow-gpu will actually create an error where TF will not load on runtime.

Installing tensorflow==1.7.0 or tensorflow==1.5 seems to be fine. TF 1.7.0 or 1.5 also installs extra packages that TF 1.12.0 does not (e.g. bleach, html5lib) which actually fixes the loading error. Ultimately we can just skip the tensorflow-gpu package if only using cpu.

Uninstalling and reinstalling tensorflow 1.7 can sometimes fix the issue as well.

— Cytokit explorer

Install an older version of dash (the newest one has a keyword arg changed “values” vs “value”) pip install dash==0.40.0

Installing cytokit from the setup.py file does not automatically install the cytokit app folder. So manually copy paste the “cytokit_app” folder into your virtual env folder. /Users/ninning/cytotest/lib/python3.6/site-packages

—— running Cytokit on cpu only should not require the tensorflow-gpu package. install this last pip install tensorflow-gpu==1.1.0

If its causing issues, you might have to uninstall the gpu package. uninstall tensorflow, then reinstall tensorflow. —-

####### Install other items in the virtualenv for jupyter notebook

pip install ipython pip install pyqt5 pip install qtconsole