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

109 macos installer #164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/build_installers.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: build_installers

on:
workflow_dispatch:
push:
branches:
- "**"
tags:
- '**'

Expand Down Expand Up @@ -72,14 +75,13 @@ jobs:
run: |
cd deployment
micromamba activate base
micromamba install -y -c conda-forge python=3.10
micromamba install -y -c conda-forge constructor
micromamba install -y -c conda-forge ruamel.yaml
micromamba install -y -c conda-forge mamba
mamba env create --file=env.yaml
python version_getter.py
mkdir ./${{ matrix.os }}_x86_64
constructor --conda-exe=$(which mamba) --output-dir ./${{ matrix.os }}_x86_64 .
micromamba activate __MICROSAM_BUILD_ENV__
mamba install -y -c conda-forge pyinstaller
source ./build_pyinstaller_app.sh
mv ./dist/annotator ./${{ matrix.os }}_x86_64


- name: upload installer
uses: actions/upload-artifact@v3
Expand Down
43 changes: 43 additions & 0 deletions deployment/build_pyinstaller_app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
rm -rf dist
rm -f annotator.py
echo "from micro_sam.sam_annotator.annotator import main" >> annotator.py
echo "main()" >> annotator.py
PYTHON_SITE=$(python -c "import site; print(''.join(site.getsitepackages()))")
echo $PYTHON_SITE
ls $PYTHON_SITE
pyinstaller --log-level=DEBUG \
--hidden-import=napari_svg \
--hidden-import=napari_plugin_engine \
--hidden-import=napari_console \
--hidden-import=napari_builtins \
--hidden-import=napari._event_loop \
--hidden-import=vispy.app.backends._pyqt5 \
--hidden-import=fontconfig \
--hidden-import=magicgui.backends._qtpy \
--hidden-import=imagecodecs._shared \
--hidden-import=torchvision.io \
--hidden-import=pytorch.jit \
--hidden-import=torchtriton \
--hidden-import=imagecodecs._imcd \
--hidden-import=jpeg \
--hidden-import=libnvjpeg \
--hidden-import=openjpeg \
--hidden-import=libpng \
--hidden-import=micro_sam \
--add-data "${PYTHON_SITE}/napari/resources/icons:napari/resources/icons" \
--add-data "${PYTHON_SITE}/napari/_qt/qt_resources/styles:napari/_qt/qt_resources/styles" \
--add-data "${PYTHON_SITE}/vispy/io/_data:vispy/io/_data" \
--add-data "${PYTHON_SITE}/vispy/util/fonts/data:vispy/util/fonts/data" \
--add-data "${PYTHON_SITE}/napari_builtins:napari_builtins" \
--add-data "${PYTHON_SITE}/PIL:PIL" \
--add-data "${PYTHON_SITE}/torchvision:torchvision" \
--add-data "${PYTHON_SITE}/torch:torch" \
--add-data "${PYTHON_SITE}/numpy:numpy" \
--add-data "${PYTHON_SITE}/vispy/glsl:vispy/glsl" annotator.py

mkdir ./dist/annotator/lib
ls ./dist/annotator
#cp ./dist/annotator/libiomp5.dylib ./dist/annotator/lib
cd ./dist/annotator
./annotator
3 changes: 2 additions & 1 deletion micro_sam/sam_annotator/annotator_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def _autosegment_widget(
if AMG is None:
AMG = instance_segmentation.get_amg(PREDICTOR, is_tiled)

print("initializing autosegment")
if not AMG.is_initialized:
AMG.initialize(v.layers["raw"].data, image_embeddings=IMAGE_EMBEDDINGS, verbose=True)

Expand Down Expand Up @@ -92,7 +93,7 @@ def _initialize_viewer(raw, segmentation_result, tile_shape, show_embeddings):
# initialize the viewer and add layers
#

v.add_image(raw)
v.add_image(raw, name="raw")
shape = _get_shape(raw)

v.add_labels(data=np.zeros(shape, dtype="uint32"), name="auto_segmentation")
Expand Down
2 changes: 1 addition & 1 deletion micro_sam/sam_annotator/annotator_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def annotator_3d(

v = Viewer()

v.add_image(raw)
v.add_image(raw, name="raw")
if segmentation_result is None:
v.add_labels(data=np.zeros(raw.shape, dtype="uint32"), name="committed_objects")
else:
Expand Down
2 changes: 1 addition & 1 deletion micro_sam/sam_annotator/annotator_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def annotator_tracking(

v = Viewer()

v.add_image(raw)
v.add_image(raw, name="raw")
if tracking_result is None:
v.add_labels(data=np.zeros(raw.shape, dtype="uint32"), name="committed_tracks")
else:
Expand Down