Skip to content

Commit b91cee8

Browse files
Merge pull request #815 from computational-cell-analytics/dev
Merge dev into master
2 parents eb0def4 + ad73eb3 commit b91cee8

24 files changed

+606
-143
lines changed

.github/doc_env.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
channels:
2-
- pytorch
32
- conda-forge
43
name:
54
sam

.github/workflows/build_installers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
RUN_SCRIPT: |
2525
python version_getter.py
2626
mkdir ./${{ matrix.os }}_x86_64
27-
constructor --output-dir ./${{ matrix.os }}_x86_64 --config-filename construct_${{ matrix.os }}.yaml .
27+
constructor --output-dir ./${{ matrix.os }}_x86_64 --config-filename construct_${{ matrix.os }}.yaml .
2828
2929
steps:
3030
- name: checkout

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Setup micromamba
3232
uses: mamba-org/setup-micromamba@v1
3333
with:
34-
environment-file: environment_cpu.yaml
34+
environment-file: ${{ runner.os == 'Windows' && 'environment_cpu_win.yaml' || 'environment.yaml' }}
3535
create-args: >-
3636
python=${{ matrix.python-version }}
3737

doc/annotation_tools.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ You can find additional information on the annotation tools [in the FAQ section]
2222
HINT: If you would like to start napari to use `micro-sam` from the plugin menu, you must start it by activating the environment where `micro-sam` has been installed using:
2323

2424
```bash
25-
$ mamba activate <ENVIRONMENT_NAME>
26-
$ napari
25+
conda activate <ENVIRONMENT_NAME>
26+
napari
2727
```
2828

2929

doc/contributing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ We use [conda](https://docs.conda.io/en/latest/) to [manage our environments](ht
3737

3838
Now you can create the environment, install user and developer dependencies, and micro-sam as an editable installation:
3939
```bash
40-
$ mamba env create environment_gpu.yaml
41-
$ mamba activate sam
42-
$ python -m pip install requirements-dev.txt
43-
$ python -m pip install -e .
40+
conda env create environment.yaml
41+
conda activate sam
42+
python -m pip install requirements-dev.txt
43+
python -m pip install -e .
4444
```
4545

4646
### Make your changes

doc/faq.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ If you encounter a problem or question not addressed here feel free to [open an
77

88

99
### 1. How to install `micro_sam`?
10-
The [installation](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#installation) for `micro_sam` is supported in three ways: [from mamba](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#from-mamba) (recommended), [from source](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#from-source) and [from installers](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#from-installer). Check out our [tutorial video](https://youtu.be/gcv0fa84mCc) to get started with `micro_sam`, briefly walking you through the installation process and how to start the tool.
10+
The [installation](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#installation) for `micro_sam` is supported in three ways: [from conda](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#from-conda) (recommended), [from source](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#from-source) and [from installers](https://computational-cell-analytics.github.io/micro-sam/micro_sam.html#from-installer). Check out our [tutorial video](https://youtu.be/gcv0fa84mCc) to get started with `micro_sam`, briefly walking you through the installation process and how to start the tool.
1111

1212

1313
### 2. I cannot install `micro_sam` using the installer, I am getting some errors.
1414
The installer should work out-of-the-box on Windows and Linux platforms. Please open an issue to report the error you encounter.
15-
>NOTE: The installers enable using `micro_sam` without mamba or conda. However, we recommend the installation from mamba / from source to use all its features seamlessly. Specifically, the installers currently only support the CPU and won't enable you to use the GPU (if you have one).
15+
>NOTE: The installers enable using `micro_sam` without conda. However, we recommend the installation from conda or from source to use all its features seamlessly. Specifically, the installers currently only support the CPU and won't enable you to use the GPU (if you have one).
1616
1717

1818
### 3. What is the minimum system requirement for `micro_sam`?
@@ -40,7 +40,7 @@ Having a GPU will significantly speed up the annotation tools and especially the
4040

4141

4242
### 5. I am missing a few packages (eg. `ModuleNotFoundError: No module named 'elf.io`). What should I do?
43-
With the latest release 1.0.0, the installation from mamba and source should take care of this and install all the relevant packages for you.
43+
With the latest release 1.0.0, the installation from conda and source should take care of this and install all the relevant packages for you.
4444
So please reinstall `micro_sam`, following [the installation guide](#installation).
4545

4646
### 6. Can I install `micro_sam` using pip?
@@ -132,7 +132,7 @@ We want to remove these errors, so we would be very grateful if you can [open an
132132

133133

134134
### 10. The objects are not segmented in my 3d data using the interactive annotation tool.
135-
The first thing to check is: a) make sure you are using the latest version of `micro_sam` (pull the latest commit from master if your installation is from source, or update the installation from conda / mamba using `mamba update micro_sam`), and b) try out the steps from the [3d annotation tutorial video](https://youtu.be/nqpyNQSyu74) to verify if this shows the same behaviour (or the same errors) as you faced. For 3d images, it's important to pass the inputs in the python axis convention, ZYX.
135+
The first thing to check is: a) make sure you are using the latest version of `micro_sam` (pull the latest commit from master if your installation is from source, or update the installation from conda using `conda update micro_sam`), and b) try out the steps from the [3d annotation tutorial video](https://youtu.be/nqpyNQSyu74) to verify if this shows the same behaviour (or the same errors) as you faced. For 3d images, it's important to pass the inputs in the python axis convention, ZYX.
136136
c) try using a different model and change the projection mode for 3d segmentation. This is also explained in the video.
137137

138138

doc/installation.md

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,87 @@
11
# Installation
22

33
There are three ways to install `micro_sam`:
4-
- [From mamba](#from-mamba) is the recommended way if you want to use all functionality.
4+
- [From conda](#from-conda) is the recommended way if you want to use all functionality.
55
- [From source](#from-source) for setting up a development environment to use the latest version and to change and contribute to our software.
6-
- [From installer](#from-installer) to install it without having to use mamba (supported platforms: Windows and Linux, supports only CPU).
6+
- [From installer](#from-installer) to install it without having to use conda (supported platforms: Windows and Linux, supports only CPU).
77

88
You can find more information on the installation and how to troubleshoot it in [the FAQ section](#installation-questions).
99

10-
We do **not** recommend installing `micro-sam` with pip.
10+
We do **not support** installing `micro_sam` with pip.
1111

12-
## From mamba
12+
## From conda
1313

14-
[mamba](https://mamba.readthedocs.io/en/latest/) is a drop-in replacement for conda, but much faster.
15-
The steps below may also work with `conda`, but we recommend using `mamba`, especially if the installation does not work with `conda`.
16-
You can follow the instructions [here](https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html) to install `mamba`.
14+
`conda` is a python package manager. If you don't have it installed yet you can follow the instructions [here](https://conda-forge.org/download/) to set it up on your system.
15+
Please make sure that you are using an up-to-date version of conda to install `micro_sam`.
16+
You can also use [mamba](https://mamba.readthedocs.io/en/latest/), which is a drop-in replacement for conda, to install it. In this case, just replace the `conda` command below with `mamba`.
1717

18-
**IMPORTANT**: Make sure to avoid installing anything in the base environment.
18+
**IMPORTANT**: Do not install `micro_sam` in the base conda environment.
19+
20+
**Installation on Linux and Mac OS:**
1921

2022
`micro_sam` can be installed in an existing environment via:
2123
```bash
22-
$ mamba install -c pytorch -c conda-forge micro_sam
24+
conda install -c conda-forge micro_sam
2325
```
24-
or you can create a new environment (here called `micro-sam`) via:
25-
26+
or you can create a new environment with it (here called `micro-sam`) via:
2627
```bash
27-
$ mamba create -c pytorch -c conda-forge -n micro-sam micro_sam
28+
conda create -c conda-forge -n micro-sam micro_sam
2829
```
29-
30-
if you want to use the GPU you need to install PyTorch from the `pytorch` channel instead of `conda-forge`. For example:
31-
30+
and then activate it via
3231
```bash
33-
$ mamba create -c pytorch -c nvidia -c conda-forge -n micro-sam micro_sam pytorch pytorch-cuda=12.1
32+
conda activate micro-sam
3433
```
3534

36-
NOTE: If you create a new enviroment (eg. here called `micro-sam`), you must activate the environment using
37-
35+
This will also install `pytorch` from the `conda-forge` channel. If you have a recent enough operating system, it will automatically install the best suitable `pytorch` version on your system.
36+
This means it will install the CPU version if you don't have a nVidia GPU, and will install a GPU version if you have.
37+
However, if you have an older operating system, or a CUDA version older than 12, than it may not install the correct version. In this case you will have to specify you're CUDA version, for example for CUDA 11, like this:
3838
```bash
39-
$ mamba activate micro-sam
39+
conda install -c conda-forge micro_sam "libtorch=*=cuda11*"
4040
```
4141

42-
You may need to change this command to install the correct CUDA version for your system, see [https://pytorch.org/](https://pytorch.org/) for details.
42+
**Installation on Windows:**
4343

44+
`pytorch` is currently not available on conda-forge for windows. Thus, you have to install it from the `pytorch` conda channel. In addition, you have to specify two specific dependencies to avoid incompatibilities.
45+
This can be done with the following commands:
46+
```bash
47+
conda install -c pytorch -c conda-forge micro_sam "nifty=1.2.1=*_4" "protobuf<5"
48+
```
49+
to install `micro_sam` in an existing environment and
50+
```bash
51+
conda create -c conda-forge -n micro-sam micro_sam "nifty=1.2.1=*_4" "protobuf<5"
52+
```
4453

4554
## From source
4655

4756
To install `micro_sam` from source, we recommend to first set up an environment with the necessary requirements:
48-
- [environment_gpu.yaml](https://github.com/computational-cell-analytics/micro-sam/blob/master/environment_gpu.yaml): sets up an environment with GPU support.
49-
- [environment_cpu.yaml](https://github.com/computational-cell-analytics/micro-sam/blob/master/environment_cpu.yaml): sets up an environment with CPU support.
57+
- [environment.yaml](https://github.com/computational-cell-analytics/micro-sam/blob/master/environment.yaml): to set up an environment on Linux or Mac OS.
58+
- [environment_cpu_win.yaml](https://github.com/computational-cell-analytics/micro-sam/blob/master/environment_cpu_win.yaml): to set up an environment on windows with CPU support.
59+
- [environment_gpu_win.yaml](https://github.com/computational-cell-analytics/micro-sam/blob/master/environment_gpu_win.yaml): to set up an environment on windows with GPU support.
5060

5161
To create one of these environments and install `micro_sam` into it follow these steps
5262

5363
1. Clone the repository:
5464

5565
```bash
56-
$ git clone https://github.com/computational-cell-analytics/micro-sam
66+
git clone https://github.com/computational-cell-analytics/micro-sam
5767
```
5868

5969
2. Enter it:
6070

6171
```bash
62-
$ cd micro-sam
72+
cd micro-sam
6373
```
6474

65-
3. Create the GPU or CPU environment:
75+
3. Create the respective environment:
6676

6777
```bash
68-
$ mamba env create -f <ENV_FILE>.yaml
78+
conda env create -f <ENV_FILE>.yaml
6979
```
7080

7181
4. Activate the environment:
7282

7383
```bash
74-
$ mamba activate sam
84+
conda activate sam
7585
```
7686

7787
5. Install `micro_sam`:
@@ -89,7 +99,7 @@ We also provide installers for Linux and Windows:
8999
- [Mac](https://owncloud.gwdg.de/index.php/s/7YupGgACw9SHy2P)
90100
-->
91101

92-
The installers will not enable you to use a GPU, so if you have one then please consider installing `micro_sam` via [mamba](#from-mamba) instead. They will also not enable using the python library.
102+
The installers will not enable you to use a GPU, so if you have one then please consider installing `micro_sam` via [conda](#from-conda) instead. They will also not enable using the python library.
93103

94104
### Linux Installer:
95105

doc/start_page.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ If you run into any problems or have questions please [open an issue](https://gi
2121

2222
## Quickstart
2323

24-
You can install `micro_sam` via mamba:
24+
You can install `micro_sam` via conda:
2525
```bash
26-
$ mamba install -c conda-forge micro_sam
26+
conda install -c conda-forge micro_sam
2727
```
2828
We also provide installers for Windows and Linux. For more details on the available installation options, check out [the installation section](#installation).
2929

environment.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: sam
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- nifty >=1.2.1
6+
- imagecodecs
7+
- magicgui
8+
- napari >=0.5.0
9+
- natsort
10+
- pip
11+
- pooch
12+
- pyqt
13+
- python-xxhash
14+
- python-elf >=0.4.8
15+
# Note: installing the pytorch package from conda-forge will generally
16+
# give you the most optmized version for your system, if you have a modern
17+
# enough OS and CUDA version (CUDA >= 12). For older versions, you can
18+
# specify the CUDA version by pinning libtorch.
19+
# For example, add this line for a CUDA 11 version:
20+
# - libtorch=*=cuda11*
21+
# or, to enforce a CPU installation, change to
22+
# - "pytorch=*=cpu*"
23+
- pytorch >=2.4
24+
- segment-anything
25+
- torchvision
26+
- torch_em >=0.7.0
27+
- tqdm
28+
- timm
29+
- pip:
30+
- git+https://github.com/ChaoningZhang/MobileSAM.git

0 commit comments

Comments
 (0)