conda install -c conda-forge micro_sam
from micro_sam.automatic_segmentation import get_predictor_and_segmenter, automatic_instance_segmentation
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[3], line 1
----> 1 from micro_sam.automatic_segmentation import get_predictor_and_segmenter, automatic_instance_segmentation
2 from skimage.io import imread
3 import stackview
File [~\miniforge3\envs\bob\Lib\site-packages\micro_sam\automatic_segmentation.py:12](file:///C:/Users/haase/miniforge3/envs/bob/Lib/site-packages/micro_sam/automatic_segmentation.py#line=11)
9 import numpy as np
10 import imageio.v3 as imageio
---> 12 from torch_em.data.datasets.util import split_kwargs
14 from . import util
15 from .instance_segmentation import (
16 get_instance_segmentation_generator, get_decoder, AMGBase,
17 AutomaticMaskGenerator, TiledAutomaticMaskGenerator,
(...) 20 DEFAULT_SEGMENTATION_MODE_WITH_DECODER,
21 )
File [~\miniforge3\envs\bob\Lib\site-packages\torch_em\__init__.py:5](file:///C:/Users/haase/miniforge3/envs/bob/Lib/site-packages/torch_em/__init__.py#line=4)
1 """
2 .. include:: ../doc/start_page.md
3 .. include:: ../doc/datasets_and_dataloaders.md
4 """
----> 5 from .segmentation import (
6 default_segmentation_dataset,
7 default_segmentation_loader,
8 default_segmentation_trainer,
9 get_data_loader,
10 )
11 from .__version__ import __version__
File [~\miniforge3\envs\bob\Lib\site-packages\torch_em\segmentation.py:6](file:///C:/Users/haase/miniforge3/envs/bob/Lib/site-packages/torch_em/segmentation.py#line=5)
3 from typing import Any, Dict, Optional, Union, Tuple, List, Callable
5 import numpy as np
----> 6 import torch
7 import torch.utils.data
8 from torch.utils.data import DataLoader
File [~\miniforge3\envs\bob\Lib\site-packages\torch\__init__.py:2296](file:///C:/Users/haase/miniforge3/envs/bob/Lib/site-packages/torch/__init__.py#line=2295)
2293 _C._init_names(list(_storage_classes))
2295 # attach docstrings to torch and tensor functions
-> 2296 from torch import _size_docs, _storage_docs, _tensor_docs, _torch_docs
2299 del _torch_docs, _tensor_docs, _storage_docs, _size_docs
2302 def compiled_with_cxx11_abi() -> builtins.bool:
File [~\miniforge3\envs\bob\Lib\site-packages\torch\_tensor_docs.py:511](file:///C:/Users/haase/miniforge3/envs/bob/Lib/site-packages/torch/_tensor_docs.py#line=510)
493 add_docstr_all(
494 "addr",
495 r"""
(...) 499 """,
500 )
502 add_docstr_all(
503 "addr_",
504 r"""
(...) 508 """,
509 )
--> 511 add_docstr_all(
512 "align_as",
513 r"""
514 align_as(other) -> Tensor
515
516 Permutes the dimensions of the :attr:`self` tensor to match the dimension order
517 in the :attr:`other` tensor, adding size-one dims for any new names.
518
519 This operation is useful for explicit broadcasting by names (see examples).
520
521 All of the dims of :attr:`self` must be named in order to use this method.
522 The resulting tensor is a view on the original tensor.
523
524 All dimension names of :attr:`self` must be present in ``other.names``.
525 :attr:`other` may contain named dimensions that are not in ``self.names``;
526 the output tensor has a size-one dimension for each of those new names.
527
528 To align a tensor to a specific order, use :meth:`~Tensor.align_to`.
529
530 Examples::
531
532 # Example 1: Applying a mask
533 >>> mask = torch.randint(2, [127, 128], dtype=torch.bool).refine_names('W', 'H')
534 >>> imgs = torch.randn(32, 128, 127, 3, names=('N', 'H', 'W', 'C'))
535 >>> imgs.masked_fill_(mask.align_as(imgs), 0)
536
537
538 # Example 2: Applying a per-channel-scale
539 >>> def scale_channels(input, scale):
540 >>> scale = scale.refine_names('C')
541 >>> return input * scale.align_as(input)
542
543 >>> num_channels = 3
544 >>> scale = torch.randn(num_channels, names=('C',))
545 >>> imgs = torch.rand(32, 128, 128, num_channels, names=('N', 'H', 'W', 'C'))
546 >>> more_imgs = torch.rand(32, num_channels, 128, 128, names=('N', 'C', 'H', 'W'))
547 >>> videos = torch.randn(3, num_channels, 128, 128, 128, names=('N', 'C', 'H', 'W', 'D'))
548
549 # scale_channels is agnostic to the dimension order of the input
550 >>> scale_channels(imgs, scale)
551 >>> scale_channels(more_imgs, scale)
552 >>> scale_channels(videos, scale)
553
554 .. warning::
555 The named tensor API is experimental and subject to change.
556
557 """,
558 )
560 add_docstr_all(
561 "all",
562 r"""
(...) 566 """,
567 )
569 add_docstr_all(
570 "allclose",
571 r"""
(...) 575 """,
576 )
File [~\miniforge3\envs\bob\Lib\site-packages\torch\_tensor_docs.py:10](file:///C:/Users/haase/miniforge3/envs/bob/Lib/site-packages/torch/_tensor_docs.py#line=9), in add_docstr_all(method, docstr)
9 def add_docstr_all(method: str, docstr: str) -> None:
---> 10 add_docstr(getattr(torch._C.TensorBase, method), docstr)
AttributeError: type object 'torch._C.TensorBase' has no attribute 'align_as'
pip list
Package Version Editable project location
---------------------------------- ----------- ---------------------------------
absl-py 2.5.0
acvl_utils 0.2.6
aiohappyeyeballs 2.7.1
aiohttp 3.14.3
aiosignal 1.4.0
annotated-doc 0.0.5
annotated-types 0.8.0
anthropic 0.120.2
anyio 4.14.2
apoc 0.14.0 C:\structure\code\apoc
app-model 0.5.1
argon2-cffi 25.1.0
argon2-cffi-bindings 25.1.0
arrow 1.4.0
asttokens 3.0.2
async-lru 2.3.0
attrs 26.1.0
azure-ai-inference 1.0.0b9
azure-core 1.41.0
babel 2.18.0
backports.zstd 1.6.0
batchgenerators 0.25.3
batchgeneratorsv2 0.3.5
beautifulsoup4 4.15.0
benchmark-cache 0.1.0 C:\structure\code\benchmark-cache
bermuda 0.1.7
bia-bob 0.36.0 C:\structure\code\bia-bob
bioimage-cpp 0.8.0
bioimageio.core 0.11.0
bioimageio.spec 0.5.12.0
bleach 6.4.0
blinker 1.9.0
blosc2 4.10.0
bokeh 3.9.2
Brotli 1.2.0
build 1.5.0
cached-property 1.5.2
cachey 0.2.1
certifi 2026.7.22
cffi 2.1.0
chardet 7.4.3
charset-normalizer 3.4.9
click 8.4.2
cloudpickle 3.1.2
colorama 0.4.6
comm 0.2.3
connected-components-3d 4.0.0
contourpy 1.3.3
cramjam 2.11.0
cycler 0.12.1
cytoolz 1.1.0
dask 2026.7.1
debugpy 1.8.21
defusedxml 0.7.1
Deprecated 1.3.1
distributed 2026.7.1
distro 1.9.0
dnspython 2.8.0
docker 7.2.0
docstring_parser 0.18.0
donfig 0.8.1.post1
dynamic_network_architectures 0.4.4
edt 3.1.2
einops 0.8.2
email-validator 2.3.0
et_xmlfile 2.0.0
eval_type_backport 0.4.0
exceptiongroup 1.3.1
executing 2.2.1
fastjsonschema 2.22.1
fastparquet 2026.5.0
filelock 3.32.2
Flask 3.1.3
flexcache 0.3
flexparser 0.4
fonttools 4.63.0
fqdn 1.5.1
freetype-py 2.5.1
frozenlist 1.8.0
fsspec 2026.7.0
future 1.0.0
geff 1.3.0.1.2
geff-spec 1.2.0
genericache 0.5.2
google-crc32c 1.8.0
graphviz 0.21
grpcio 1.78.1
h11 0.16.0
h2 4.4.1
h5py 3.16.0
HeapDict 1.0.1
hf-xet 1.5.2
hpack 4.2.0
hsluv 5.0.4
httpcore 1.0.9
httpx 0.28.1
huggingface_hub 1.26.0
hyperframe 6.1.0
idna 3.18
ilpy 0.6.0
imagecodecs 2026.1.14
imageio 2.37.0
importlib_metadata 8.7.1
in-n-out 0.2.1
ipycanvas 0.14.3
ipyevents 2.0.4
ipykernel 6.31.0
ipylab 1.1.0
ipympl 0.10.0
ipynbname 2025.8.0.0
ipython 9.16.0
ipython_pygments_lexers 1.1.1
ipywidgets 8.1.8
isodate 0.7.2
isoduration 20.11.0
itables 2.9.1
itsdangerous 2.2.0
jedi 0.20.0
Jinja2 3.1.6
jiter 0.16.0
joblib 1.5.3
json5 0.15.0
jsonpath-python 1.1.6
jsonpointer 3.1.1
jsonschema 4.26.0
jsonschema-specifications 2025.9.1
jupyter_builder 1.2.0
jupyter_client 8.9.1
jupyter_core 5.9.1
jupyter-events 0.12.1
jupyter-lsp 2.3.1
jupyter_server 2.20.0
jupyter_server_terminals 0.5.4
jupyter-vibe-coding 0.1.4
jupyterlab 4.6.2
jupyterlab_pygments 0.3.0
jupyterlab_server 2.28.0
jupyterlab_widgets 3.0.16
jupytext 1.19.5
kiwisolver 1.5.0
kornia 0.8.2
kornia_rs 0.1.10
lark 1.3.1
lazy-loader 0.5
linecache2 1.0.0
llvmlite 0.48.0
locket 1.0.0
loguru 0.7.3
lxml 6.1.1
lz4 4.4.5
magicgui 0.10.2
Markdown 3.10.3
markdown-it-py 4.2.0
MarkupSafe 3.0.3
matplotlib 3.11.1
matplotlib-inline 0.2.2
mdit-py-plugins 0.6.1
mdurl 0.1.2
metakernel 1.0.0
micro_sam 1.8.8
mistralai 2.8.0
mistune 3.3.4
motile 1.0.1
mpmath 1.3.0
mrcfile 1.5.4
msgpack 1.2.1
multidict 6.7.1
munkres 1.1.4
napari 0.8.0
napari-console 0.1.4
napari-metadata 0.4.0
napari-plugin-engine 0.2.1
napari-plugin-manager 0.1.11
napari-svg 0.2.1
narwhals 2.24.0
natsort 8.4.0
nbclient 0.11.0
nbconvert 7.17.1
nbformat 5.10.4
ndindex 1.10.1
nest_asyncio 1.6.0
nest-asyncio2 1.7.2
networkx 3.6.1
nibabel 5.4.2
nnunetv2 2.8.1
notebook_shim 0.2.4
npe2 0.8.3
numba 0.66.0
numcodecs 0.16.5
numexpr 2.14.2
numpy 2.4.6
openai 2.51.0
openpyxl 3.1.5
opentelemetry-api 1.39.1
opentelemetry-semantic-conventions 0.60b1
optree 0.19.1
packaging 26.2
pandas 3.0.5
pandocfilters 1.5.1
parso 0.8.7
partd 1.4.2
PartSegCore_compiled_backend 0.15.14
pexpect 4.9.0
pillow 12.3.0
Pint 0.25.3
pip 26.2
platformdirs 4.11.0
ply 3.11
pooch 1.9.0
prometheus_client 0.26.0
prompt_toolkit 3.0.53
propcache 0.5.2
protobuf 6.33.5
psutil 7.2.2
psygnal 0.15.0
ptyprocess 0.7.0
pure_eval 0.2.3
pyarrow 23.0.1
pybind11 3.0.1
pybind11-global 3.0.1
pyclesperanto-opencl 0.22.0
pyclesperanto_prototype 0.24.4
pyconify 0.2.1
pycparser 3.0
pydantic 2.13.4
pydantic-compat 0.1.2
pydantic_core 2.46.4
pydantic-extra-types 2.11.1
pydantic-settings 2.14.2
Pygments 2.20.0
pyopencl 2026.1.2
PyOpenGL 3.1.10
pyparsing 3.3.2
pyproject_hooks 1.2.0
PyQt6 6.8.1
PyQt6_sip 13.10.0
PySCIPOpt 6.2.1
PySocks 1.7.1
python-dateutil 2.9.0.post0
python-docx 1.2.0
python-dotenv 1.2.2
python-elf 0.9.2
python-json-logger 4.1.0
pytools 2026.1.1
pywin32 312
pywinpty 3.0.5
PyYAML 6.0.3
pyzmq 27.1.0
qtconsole 5.7.2
QtPy 2.4.3
referencing 0.37.0
requests 2.34.2
reviewer3 0.1.2 C:\structure\code\reviewer3
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rfc3987-syntax 1.1.0
rich 15.0.0
roifile 2026.7.30
rpds-py 2026.6.3
ruyaml 0.0.0
safetensors 0.8.0
sand-bob 0.2.0 C:\structure\code\sand-bob
scikit-image 0.26.0
scikit-learn 1.9.0
scipy 1.17.1
seaborn 0.13.2
segment-anything-py 1.0
Send2Trash 2.1.0
setuptools 83.0.0
shellingham 1.5.4
simpleitk 2.5.6
sip 6.10.0
siphash24 1.8
six 1.17.0
skan 0.13.1
sniffio 1.3.1
sortedcontainers 2.4.0
soupsieve 2.9.1
stack_data 0.6.3
stackview 0.19.2 C:\structure\code\stackview
structsvm 0.2.0
superqt 0.8.2
sympy 1.14.0
tblib 3.2.2
tensorboard 2.20.0
tensorboard_data_server 0.7.0
terminado 0.18.1
threadpoolctl 3.6.0
tifffile 2026.3.3
timm 1.0.22
tinycss2 1.5.1
toml 0.10.2
tomli 2.4.1
tomli_w 1.2.0
toolz 1.1.0
torch 2.10.0
torch_em 0.10.1
torchvision 0.26.0
tornado 6.5.7
tqdm 4.70.0
traceback2 1.4.0
trackastra 0.5.4
traitlets 5.15.1
transforms3d 0.4.2
typer 0.27.1
typing_extensions 4.16.0
typing-inspection 0.4.2
tzdata 2026.3
unicodedata2 17.0.1
unittest2 1.1.0
uri-template 1.3.0
urllib3 2.7.0
vision-embedding-space-travelling 0.2.2 C:\structure\code\vest
vispy 0.16.2
wcwidth 0.8.2
webcolors 25.10.0
webencodings 0.5.1
websocket-client 1.9.0
Werkzeug 3.1.8
wheel 0.47.0
widgetsnbextension 4.0.15
win_inet_pton 1.1.0
win32_setctime 1.2.0
wordcloud 1.9.6
wrapt 2.3.0
xarray 2026.7.0
xxhash 3.7.0
xyzservices 2026.3.0
yacs 0.1.8
yarl 1.24.5
z5py 3.0.2
zarr 3.3.0
zict 3.0.0
zipp 4.1.0
I guess, I have to use a different version of pytorch? If so, which? Any hints are welcome!
Hi all,
I was just trying to install micro-sam as explained here.
After installing using this command:
I get an error when importing micro-sam:
Error:
that's my pip list:
I guess, I have to use a different version of pytorch? If so, which? Any hints are welcome!
Thanks!