labelme
labelme copied to clipboard
Does not launch after installing with pip on windows11
Provide environment information
(labelme_env) PS C:\Users\irema> python --version
Python 3.12.9
(labelme_env) PS C:\Users\irema> python -m pip list
Package Version
------------------ -----------
annotated-types 0.7.0
beautifulsoup4 4.13.3
certifi 2025.1.31
charset-normalizer 3.4.1
click 8.1.8
colorama 0.4.6
coloredlogs 15.0.1
contourpy 1.3.1
cycler 0.12.1
filelock 3.18.0
flatbuffers 25.2.10
fonttools 4.56.0
gdown 5.2.0
humanfriendly 10.0
idna 3.10
imageio 2.37.0
imgviz 1.7.6
kiwisolver 1.4.8
labelme 5.8.0
lazy_loader 0.4
loguru 0.7.3
matplotlib 3.10.1
mpmath 1.3.0
natsort 8.4.0
networkx 3.4.2
numpy 2.2.4
onnxruntime 1.21.0
onnxruntime-gpu 1.21.0
osam 0.2.3
packaging 24.2
pillow 11.1.0
pip 25.0.1
protobuf 6.30.1
pydantic 2.10.6
pydantic_core 2.27.2
pyparsing 3.2.1
PyQt5 5.15.11
PyQt5-Qt5 5.15.2
PyQt5_sip 12.17.0
pyreadline3 3.5.4
PySocks 1.7.1
python-dateutil 2.9.0.post0
PyYAML 6.0.2
QtPy 2.4.3
requests 2.32.3
scikit-image 0.25.2
scipy 1.15.2
six 1.17.0
soupsieve 2.6
sympy 1.13.3
termcolor 2.5.0
tifffile 2025.3.13
tqdm 4.67.1
typing_extensions 4.12.2
urllib3 2.3.0
win32_setctime 1.2.0
What OS are you using?
Windows 11 Pro 10.0.26100
Describe the Bug
I'm using powershell on windows 11. I do the following:
python -m venv labelme_env
.\labelme_env\Scripts\activate
pip install labelme
python -m labelme
and this is the output:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\irema\labelme_env\Lib\site-packages\labelme\__main__.py", line 15, in <module>
from labelme.app import MainWindow
File "C:\Users\irema\labelme_env\Lib\site-packages\labelme\app.py", line 21, in <module>
from labelme._automation import bbox_from_text
File "C:\Users\irema\labelme_env\Lib\site-packages\labelme\_automation\bbox_from_text.py", line 6, in <module>
import osam
from . import apis # noqa: F401
^^^^^^^^^^^^^^^^^^
File "C:\Users\irema\labelme_env\Lib\site-packages\osam\apis.py", line 5, in <module>
import onnxruntime
File "C:\Users\irema\labelme_env\Lib\site-packages\onnxruntime\__init__.py", line 61, in <module>
raise import_capi_exception
File "C:\Users\irema\labelme_env\Lib\site-packages\onnxruntime\__init__.py", line 24, in <module>
from onnxruntime.capi._pybind_state import (
File "C:\Users\irema\labelme_env\Lib\site-packages\onnxruntime\capi\_pybind_state.py", line 32, in <module>
from .onnxruntime_pybind11_state import * # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: DLL load failed while importing onnxruntime_pybind11_state: A dynamic link library (DLL) initialization routine failed.
Expected Behavior
The GUI to launch.
To Reproduce
No response
I'm also facing the same issue, using the Windows 10 and Python 3.11.9
pip install onnxruntime==1.19.0 works on me.
pip install onnxruntime==1.19.0 worked for me 🥳
I tested on Windows 11 + Anaconda fresh install with pip install labelme==5.8.1:
- ✅ py39: Python 3.9: onnxruntime 1.19.2
- ✅ py310: Python 3.10: onnxruntime 1.21.0
- ✅ py311: Python 3.11: onnxruntime 1.21.0
- ✅ py312: Python 3.12: onnxruntime 1.21.0
But, I reproduced in my Conda base environment, so likely there's some conflicts in dependencies.
- ❌️ base: Python 3.12: onnxruntime 1.21.0
I tested on Windows 11 + Anaconda fresh install with
pip install labelme==5.8.1:
- ✅ py39: Python 3.9: onnxruntime 1.19.2
- ✅ py310: Python 3.10: onnxruntime 1.21.0
- ✅ py311: Python 3.11: onnxruntime 1.21.0
- ✅ py312: Python 3.12: onnxruntime 1.21.0
But, I reproduced in my Conda base environment, so likely there's some conflicts in dependencies.
- ❌️ base: Python 3.12: onnxruntime 1.21.0
maybe its related to https://github.com/microsoft/onnxruntime/pull/21005, but Im not really sure how it plays a role in it.
The PyQt5 would introduce its own msvcp140.dll at .venv\Lib\site-packages\PyQt5\Qt5\bin\msvcp140.dll. Which doesn't work well with onnxruntime.
This would fail
from PyQt5 import QtCore
import onnxruntime
This works
import onnxruntime
from PyQt5 import QtCore
@clouds56 thanks for the share. i'll try if it would also work in my environment.
I locally add import onnxruntime at head of __init__.py and it works.
I got the same error even if I moved the onnxruntime import.
I got the same error even if I moved the onnxruntime import.
🤔 because you've changed __main__.py.
As per the comment, adding the onnxruntime import at the beginning of __init__.py makes it work.
Additionally, adding the onnxruntime import before the line from labelme.label_file import LabelFile works as expected, while adding it after that raises an error.
I tested on Windows 11 + Anaconda fresh install with
pip install labelme==5.8.1:
- ✅ py39: Python 3.9: onnxruntime 1.19.2
- ✅ py310: Python 3.10: onnxruntime 1.21.0
- ✅ py311: Python 3.11: onnxruntime 1.21.0
- ✅ py312: Python 3.12: onnxruntime 1.21.0
But, I reproduced in my Conda base environment, so likely there's some conflicts in dependencies.
- ❌️ base: Python 3.12: onnxruntime 1.21.0
So do I. Python 3.11+ Conda : onnxruntime 1.22.1
@clouds56 thank you for taking the initiative making the PR https://github.com/wkentaro/labelme/pull/1620.
as I find it a bit difficult to reproduce but still issue, I decided to update the docs from Anaconda to uv: https://labelme.io/docs/install-labelme-terminal and update README: https://github.com/wkentaro/labelme/pull/1623 (The old doc is still available https://labelme.io/docs/install-labelme-terminal-conda)
I believe this is the right direction as uv is getting more and more stable and industry standard.
Please check to see if it works on your end when you can.
/cc @sheex2018 @hakiKhuva @S-TE11A @sodiumnitrate
I can confirm reproduce with uv tool install --upgrade labelme
ImportError: DLL load failed while importing onnxruntime_pybind11_state: A dynamic link library (DLL) initialization routine failed.
Resolved 53 packages in 691ms
Prepared 53 packages in 8.14s
Installed 53 packages in 2.80s
+ annotated-types==0.7.0
+ beautifulsoup4==4.13.5
+ certifi==2025.8.3
+ charset-normalizer==3.4.3
+ click==8.2.1
+ colorama==0.4.6
+ coloredlogs==15.0.1
+ contourpy==1.3.3
+ cycler==0.12.1
+ filelock==3.19.1
+ flatbuffers==25.2.10
+ fonttools==4.59.2
+ gdown==5.2.0
+ humanfriendly==10.0
+ idna==3.10
+ imageio==2.37.0
+ imgviz==1.7.6
+ kiwisolver==1.4.9
+ labelme==5.8.3
+ lazy-loader==0.4
+ loguru==0.7.3
+ matplotlib==3.10.6
+ mpmath==1.3.0
+ natsort==8.4.0
+ networkx==3.5
+ numpy==2.3.2
+ onnxruntime==1.22.1
+ osam==0.2.5
+ packaging==25.0
+ pillow==11.3.0
+ protobuf==6.32.0
+ pydantic==2.11.7
+ pydantic-core==2.33.2
+ pyparsing==3.2.3
+ pyqt5==5.15.11
+ pyqt5-qt5==5.15.2
+ pyqt5-sip==12.17.0
+ pyreadline3==3.5.4
+ pysocks==1.7.1
+ python-dateutil==2.9.0.post0
+ pyyaml==6.0.2
+ requests==2.32.5
+ scikit-image==0.25.2
+ scipy==1.16.1
+ six==1.17.0
+ soupsieve==2.8
+ sympy==1.14.0
+ tifffile==2025.8.28
+ tqdm==4.67.1
+ typing-extensions==4.15.0
+ typing-inspection==0.4.1
+ urllib3==2.5.0
+ win32-setctime==1.2.0
Installed 5 executables: labelme.exe, labelme_draw_json.exe, labelme_draw_label_png.exe, labelme_export_json.exe, labelme_on_docker.exe
This is still a issue please reopen it.
I used uv to install labelme and can confirm that running labelme won't launch the GUI because of onnxruntime, both in Python 3.12 and 3.10:
uv venv --python 3.10
.venv\Scripts\activate
uv pip install labelme
labelme
However, it works on Python 3.9, so a workaround would be to set up a new virtual environment using Py 3.9 and launch labelme from there:
uv venv --python 3.9