In [1]: import deeplabcut
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-cfa4f159dfc5> in <module>
----> 1 import deeplabcut
~/.local/lib/python3.7/site-packages/deeplabcut/__init__.py in <module>
28 else:
29 mpl.use('Agg')
---> 30 from deeplabcut import generate_training_dataset
31 from deeplabcut import refine_training_dataset
32 from deeplabcut.generate_training_dataset import label_frames, dropannotationfileentriesduetodeletedimages, comparevideolistsanddatafolders, dropimagesduetolackofannotation
~/.local/lib/python3.7/site-packages/deeplabcut/generate_training_dataset/__init__.py in <module>
16 pass
17 else:
---> 18 from deeplabcut.generate_training_dataset.auxfun_drag_label import *
19 from deeplabcut.generate_training_dataset.labeling_toolbox import *
20 from deeplabcut.generate_training_dataset.multiple_individuals_labeling_toolbox import *
~/.local/lib/python3.7/site-packages/deeplabcut/generate_training_dataset/auxfun_drag_label.py in <module>
17
18 import numpy as np
---> 19 import wx
20
21 class DraggablePoint:
ModuleNotFoundError: No module named 'wx'
You can create an environment variable, and then you do not require wxpython (of course GUIs are then not supported).
Linux (in terminal)
export DLClight=True
Windows:
set DLClight=True
We could of course automatically check if wxpython is installed.
We will make another pypi installation of dlc, one that is with GUI support, and one without (ie core functions only; the equivalent of “dlc light mode”) Thanks for the issue @emmanuelle!
This is also currently true for tensorflow as well, so I would suggest:
pip install deeplabcut is all packages (dlc, wx, + tf for cpu use).
pip install deeplabcut-gpu is dlc, wx, plus tf for GPUs).
pip install deeplabcut —light-cpu is no wx, but cpu tf
pip install deeplabcut —light-gpu is no wx, but gpu tf
Comments welcomed from the community...
As a systems administrator, getting people set up with a headless/non-GUI version of DeepLabCut on our SLURM batch cluster has been a bit of a pain point, in large part due to errors like this (OpenCV also has similar issues; see here).
From my perspective, I'd like to see these errors eliminated by decoupling the GUI from the core functionality completely. This sort of bottom-up approach (which is associated with the Unix philosophy; see here) would have one package, deeplabcut, which would essentially be the light mode that currently is toggled on using an environment variable. Another package, deeplabcut-gui, would contain wx and any other graphical components particular to DLC. deeplabcut-gui would have deeplabcut as a dependency, and deeplabcut would be able to be installed independently without deeplabcut-gui.
The bottom-up approach stands in contrast to top-down GUI-centric development (more in line with the Microsoft/Windows way of doing things), which seems to be the current operating philosophy that is being used in this project. Such a GUI-centric approach has its merits, but also has some severe limitations. In addition to making batch processing hard, a GUI-centric approach to software development also means that it's harder to transition from one interface to another.
As an example, in a past life I did tech support for a package called C-PAC that had a wx GUI tightly-coupled with its core functionality. Such tight coupling gave the benefit of making a friendly user interface a first-class component, but also prevented us from switching to a web-based interface and locked us down into the wx ecosystem. Having wx live alongside the core functionality also meant that it was harder to enforce a separation of concerns, as bugs with core functionality and bugs with the GUI started to blur together. Eventually, it seems as though the wx dependency was painstakingly excised from C-PAC some time after I left, but not after a significant time investment.
One last point about modularization- having the GUI live in its own package opens the door for new interfaces to DeepLabCut across a variety of platforms (some of which you may not even need to support!). I personally would be interested in seeing a version of the DeepLabCut GUI that exists as a Jupyter notebook / JupyterLab module.
_edit:_ More concisely, my point is that I think that it would be worthwhile to have the DeepLabCut GUI be its own independent project separate from the core DLC functionality (i.e., the light mode), living in its own separate Github repository. I think that there can be design decisions made here beyond how packaging is done.
Dear @jpellman absolutely agree. In the very near future we will have exactly this, deeplabcut will be core.
We are also working to integrate dlc with other tools like @napari, ie so the guis could be more independent if one wants.
Also a webApp for labeling @emmanuelle started at a hackathon (see repo: https://github.com/DeepLabCut/DeepLabCut-WebApp and we’d actively like help)
To note, there will be then an ever lighter mode for a deeplabcut-liveversion.
I am having the same issue.
Is there a current headless GPU version that can be installed from PyPI?
Here is what I see with pip search deeplabcut
deeplabcut (2.1.7.1) - Markerless pose-estimation of user-defined features with deep learning
deeplabcut-gpu (0.0b0) - abc
deeplabcut-core (0.0b0) - abc
deeplabcut-live (0.0b0) - abc
deeplabcut-pytorch (0.0b0) - abc
deeplabcut-webapp (0.0b0) - abc
dlc-gui (0.6.1) - Labeling GUI for DeepLabCut
Note: I am also working on a SLURM cluster.
@suntzuisafterU just run this first and it’s headless
https://github.com/AlexEMG/DeepLabCut/issues/597#issuecomment-591729702
we will otherwise make deeplabcut-core the headless version soon
Here is an experimental (but tested) headless DeepLabCut: https://github.com/DeepLabCut/DeepLabCut-core
Please let us know what you think. Happy to put it on pypi...
Please pip install deeplabcutcore For the headless version!
pip install deeplabcutcore did the trick. Thanks!
Actually, just realized it only works when we export DLClight=True.
deeplabcutcore fails when it can't find tkinter.
strange! It's working in the docker container here: https://github.com/DeepLabCut/Docker4DeepLabCut2.0
can you provide me the full traceback so I can check what's up?
Yeah for sure, here it is.
Python 3.7.4 (default, Jul 18 2019, 19:34:02)
[GCC 5.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import deeplabcutcore as dlc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/adt150/DLC-GPU-VENV/lib/python3.7/site-packages/deeplabcutcore/__init__.py", line 20, in <module>
from deeplabcutcore.create_project import create_new_project, create_new_project_3d, add_new_videos, load_demo_data
File "/home/adt150/DLC-GPU-VENV/lib/python3.7/site-packages/deeplabcutcore/create_project/__init__.py", line 4, in <module>
from deeplabcutcore.create_project.demo_data import load_demo_data
File "/home/adt150/DLC-GPU-VENV/lib/python3.7/site-packages/deeplabcutcore/create_project/demo_data.py", line 14, in <module>
from deeplabcutcore.utils import auxiliaryfunctions
File "/home/adt150/DLC-GPU-VENV/lib/python3.7/site-packages/deeplabcutcore/utils/__init__.py", line 1, in <module>
from deeplabcutcore.utils.make_labeled_video import *
File "/home/adt150/DLC-GPU-VENV/lib/python3.7/site-packages/deeplabcutcore/utils/make_labeled_video.py", line 34, in <module>
mpl.use('TkAgg')
File "/home/adt150/DLC-GPU-VENV/lib/python3.7/site-packages/matplotlib/__init__.py", line 1391, in use
switch_backend(name)
File "/home/adt150/DLC-GPU-VENV/lib/python3.7/site-packages/matplotlib/pyplot.py", line 222, in switch_backend
newbackend, required_framework, current_framework))
ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running
Please
pip install deeplabcutcoreFor the headless version!
@MMathisLab
I am having the same issue as @suntzuisafterU on SLURM, but using deeplabcutcore didn't solve it in my case even after running export DLClight=True.
In [1]: import deeplabcutcore
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-5cd872217571> in <module>
----> 1 import deeplabcutcore
~/.conda/envs/DLC-GPU/lib/python3.7/site-packages/deeplabcutcore/__init__.py in <module>
18
19
---> 20 from deeplabcutcore.create_project import create_new_project, create_new_project_3d, add_new_videos, load_demo_data
21 from deeplabcutcore.create_project import create_pretrained_project, create_pretrained_human_project
22 from deeplabcutcore.generate_training_dataset import extract_frames, select_cropping_area
~/.conda/envs/DLC-GPU/lib/python3.7/site-packages/deeplabcutcore/create_project/__init__.py in <module>
2 from deeplabcutcore.create_project.new_3d import create_new_project_3d
3 from deeplabcutcore.create_project.add import add_new_videos
----> 4 from deeplabcutcore.create_project.demo_data import load_demo_data
5 from deeplabcutcore.create_project.modelzoo import create_pretrained_human_project, create_pretrained_project
~/.conda/envs/DLC-GPU/lib/python3.7/site-packages/deeplabcutcore/create_project/demo_data.py in <module>
12 from pathlib import Path
13 import deeplabcutcore
---> 14 from deeplabcutcore.utils import auxiliaryfunctions
15
16 def load_demo_data(config,createtrainingset=True):
~/.conda/envs/DLC-GPU/lib/python3.7/site-packages/deeplabcutcore/utils/__init__.py in <module>
----> 1 from deeplabcutcore.utils.make_labeled_video import *
2 from deeplabcutcore.utils.auxiliaryfunctions import *
3 from deeplabcutcore.utils.video_processor import *
4 from deeplabcutcore.utils.plotting import *
5
~/.conda/envs/DLC-GPU/lib/python3.7/site-packages/deeplabcutcore/utils/make_labeled_video.py in <module>
32 mpl.use('WxAgg') #TkAgg
33 else:
---> 34 mpl.use('TkAgg')
35 import matplotlib.pyplot as plt
36
~/.local/lib/python3.7/site-packages/matplotlib/__init__.py in use(arg, warn, force)
1389 if force:
1390 from matplotlib.pyplot import switch_backend
-> 1391 switch_backend(name)
1392 # Finally if pyplot is not imported update both rcParams and
1393 # rcDefaults so restoring the defaults later with rcdefaults
~/.local/lib/python3.7/site-packages/matplotlib/pyplot.py in switch_backend(newbackend)
220 "Cannot load backend {!r} which requires the {!r} interactive "
221 "framework, as {!r} is currently running".format(
--> 222 newbackend, required_framework, current_framework))
223
224 rcParams['backend'] = rcParamsDefault['backend'] = newbackend
ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running
tkagg is required currently but this will be removed in an update of deeplabcutcore
From: fcatus notifications@github.com
Sent: Friday, June 5, 2020 12:50:46 AM
To: DeepLabCut/DeepLabCut DeepLabCut@noreply.github.com
Cc: Mathis, Alexander Thomas amathis@fas.harvard.edu; State change state_change@noreply.github.com
Subject: Re: [DeepLabCut/DeepLabCut] wxpython not a dependency, but error thrown if wx not installed (#597)
Please pip install deeplabcutcore For the headless version!
I am having the same issue on SLURM. Using deeplabcutcore didn't solve it.
ImportError Traceback (most recent call last)
----> 1 import deeplabcutcore
~/.conda/envs/DLC-GPU/lib/python3.7/site-packages/deeplabcutcore/__init__.py in
18
19
---> 20 from deeplabcutcore.create_project import create_new_project, create_new_project_3d, add_new_videos, load_demo_data
21 from deeplabcutcore.create_project import create_pretrained_project, create_pretrained_human_project
22 from deeplabcutcore.generate_training_dataset import extract_frames, select_cropping_area
~/.conda/envs/DLC-GPU/lib/python3.7/site-packages/deeplabcutcore/create_project/__init__.py in
2 from deeplabcutcore.create_project.new_3d import create_new_project_3d
3 from deeplabcutcore.create_project.add import add_new_videos
----> 4 from deeplabcutcore.create_project.demo_data import load_demo_data
5 from deeplabcutcore.create_project.modelzoo import create_pretrained_human_project, create_pretrained_project
~/.conda/envs/DLC-GPU/lib/python3.7/site-packages/deeplabcutcore/create_project/demo_data.py in
12 from pathlib import Path
13 import deeplabcutcore
---> 14 from deeplabcutcore.utils import auxiliaryfunctions
15
16 def load_demo_data(config,createtrainingset=True):
~/.conda/envs/DLC-GPU/lib/python3.7/site-packages/deeplabcutcore/utils/__init__.py in
----> 1 from deeplabcutcore.utils.make_labeled_video import *
2 from deeplabcutcore.utils.auxiliaryfunctions import *
3 from deeplabcutcore.utils.video_processor import *
4 from deeplabcutcore.utils.plotting import *
5
~/.conda/envs/DLC-GPU/lib/python3.7/site-packages/deeplabcutcore/utils/make_labeled_video.py in
32 mpl.use('WxAgg') #TkAgg
33 else:
---> 34 mpl.use('TkAgg')
35 import matplotlib.pyplot as plt
36
~/.local/lib/python3.7/site-packages/matplotlib/__init__.py in use(arg, warn, force)
1389 if force:
1390 from matplotlib.pyplot import switch_backend
-> 1391 switch_backend(name)
1392 # Finally if pyplot is not imported update both rcParams and
1393 # rcDefaults so restoring the defaults later with rcdefaults
~/.local/lib/python3.7/site-packages/matplotlib/pyplot.py in switch_backend(newbackend)
220 "Cannot load backend {!r} which requires the {!r} interactive "
221 "framework, as {!r} is currently running".format(
--> 222 newbackend, required_framework, current_framework))
223
224 rcParams['backend'] = rcParamsDefault['backend'] = newbackend
ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_DeepLabCut_DeepLabCut_issues_597-23issuecomment-2D639256920&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=11wEEDBv3Ke3n3b8dICjuQC5vgZ23dfGPax018VOZ2g&m=Y3x1WiMNI_ZW2o2Ab-aLosy0LCkjCq7_D-fQqfwXA5U&s=aV_s27e0VykIdQWW1-7Ed7LY8CP1lE8MD5pfm0CYpjU&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AE7CMXRQ3H6PRKUJFLVZDWDRVB2SNANCNFSM4K4RNHEQ&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=11wEEDBv3Ke3n3b8dICjuQC5vgZ23dfGPax018VOZ2g&m=Y3x1WiMNI_ZW2o2Ab-aLosy0LCkjCq7_D-fQqfwXA5U&s=oVeJAt-QSgxPvmnEl_7i5VPtpuyglQTAFTT39GWLUCQ&e=.
I believe this can be closed as the headless version is now up on pypi, and issues resolved. I would suggest we move further related issues to there? https://github.com/DeepLabCut/DeepLabCut-core
This page https://pypi.org/project/deeplabcut-pytorch/ tells there is a deeplabcut-pytorch package however the link in that page gives 404 error. Is there a guide for using DLC PyTorch you could share? https://github.com/DeepLabCut/deeplabcut-pytorch
$ pip install deeplabcut-pytorch
@monajalal - no, it is not public
Most helpful comment
As a systems administrator, getting people set up with a headless/non-GUI version of DeepLabCut on our SLURM batch cluster has been a bit of a pain point, in large part due to errors like this (OpenCV also has similar issues; see here).
From my perspective, I'd like to see these errors eliminated by decoupling the GUI from the core functionality completely. This sort of bottom-up approach (which is associated with the Unix philosophy; see here) would have one package,
deeplabcut, which would essentially be the light mode that currently is toggled on using an environment variable. Another package,deeplabcut-gui, would contain wx and any other graphical components particular to DLC.deeplabcut-guiwould havedeeplabcutas a dependency, anddeeplabcutwould be able to be installed independently withoutdeeplabcut-gui.The bottom-up approach stands in contrast to top-down GUI-centric development (more in line with the Microsoft/Windows way of doing things), which seems to be the current operating philosophy that is being used in this project. Such a GUI-centric approach has its merits, but also has some severe limitations. In addition to making batch processing hard, a GUI-centric approach to software development also means that it's harder to transition from one interface to another.
As an example, in a past life I did tech support for a package called C-PAC that had a
wxGUI tightly-coupled with its core functionality. Such tight coupling gave the benefit of making a friendly user interface a first-class component, but also prevented us from switching to a web-based interface and locked us down into thewxecosystem. Havingwxlive alongside the core functionality also meant that it was harder to enforce a separation of concerns, as bugs with core functionality and bugs with the GUI started to blur together. Eventually, it seems as though thewxdependency was painstakingly excised from C-PAC some time after I left, but not after a significant time investment.One last point about modularization- having the GUI live in its own package opens the door for new interfaces to DeepLabCut across a variety of platforms (some of which you may not even need to support!). I personally would be interested in seeing a version of the DeepLabCut GUI that exists as a Jupyter notebook / JupyterLab module.
_edit:_ More concisely, my point is that I think that it would be worthwhile to have the DeepLabCut GUI be its own independent project separate from the core DLC functionality (i.e., the light mode), living in its own separate Github repository. I think that there can be design decisions made here beyond how packaging is done.