FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Usage as a library · Issue #1548 · DeepLabCut/DeepLabCut · GitHub

Repository navigation

Usage as a library #1548

Closed
Closed

Description

Is there an existing issue for this?

  • I have searched the existing issues

Bug description

When importing deeplabcut, many assumptions are made about how it might be used with matplotlib or wx.

https://github.com/DeepLabCut/DeepLabCut/blob/master/deeplabcut/__init__.py#L26

For those that are willing to use deeplabcut as a tools, setting global backends in the main init file is quite invasive.

I'm wondering if you would reconsider these choices.

I'm happy to create the pull requests that would move the backend changes to the gui functionality and avoid setting the backends in the init file.

Let me know.

Operating System

Linux

DeepLabCut version

2.2.0.1

Code of Conduct

Activity

  1. MMathisLab commented on Oct 17, 2021

    Member

    Hi @hmaarrfk our users are typically using this as an full project management software as well as DL based pose estimation; if you want headless you can pip install deeplabcut or use pip install deeplabcut-docker, which might better suit your use cases? https://deeplabcut.github.io/DeepLabCut/docs/docker.html

  2. hmaarrfk commented on Oct 17, 2021

    ContributorAuthor

    Hello. Thanks for the quick reply.

    The pip installation works great! Thank you for making that easy!

    I understand that the "full project management GUI" experience is critical to your users. I do not want to take that away in the slightest (I would also be happy to help on that front too looking into the problems I am facing here I found a few places that could use touchups on the GUI front that I am happy to contribute).

    Unfortunately, as soon as we import deeplabcut into an other workflow that might want to use a different backend for matplotlib (for some interactive plotting), the statements in the __init__.py change which backend is used and causes very strange behavior.

    Please see the attached screenshot where a user may want to use matplotlib in a jupyter notebook, but gets strange behavior as soon as they introduce deeplabcut into their analysis pipeline.

    This leads to rather tricky behavior (bugs or "features") to debug.

    Finally, the try: expect statement to attempt to detect the wx library is also rather difficult to deal with when working in a larger project. It means that the selected backend of the library now might

    I understand that your users are often running deeplabcut with the command:

    python -m deeplabcut
    

    I understand how critical this is.

    I can help ensure that this workflow remains unchanged.

    Most of what it will involve is delaying the calls:

        import wx
    
        mpl.use("WxAgg")
    

    to the desired entry points of the GUI.

    I know this isn't "easy" and there are likely many knock-on effects that I cannot appreciate easily. However, if you are willing to review a few targetted PRs, I would be glad to make them.

    Thank you again for considering.

  3. MMathisLab commented on Oct 17, 2021

    Member

    thanks for the further info!

    However, if you are willing to review a few targetted PRs, I would be glad to make them.

    • great, understood, and def. happy to improve this/ review PRs, thanks for the offer!

    Also just to give you a roadmap, we are dropping wxPython soon (by early Q1 of 2022) - it's been a pain for years, the alpha replacement demo is here, if you want to use (then just use dlc headless) in the meantime: https://github.com/DeepLabCut/napari-DeepLabCut. In short, we will be moving to vispy.

  4. hmaarrfk commented on Oct 17, 2021

    ContributorAuthor

    vispy and qt ate great! i just hope that they survive long enough.

    we have enough trouble migrating to newer versions there too.

    As for making the installation process easier. I think that conda packages for deeplabcut should be available pretty soon.

  5. MMathisLab commented on Oct 17, 2021

    Member

    vispy has a large grant from CZI, I think it will be a good option. Could you elaborate? "I think that conda packages for deeplabcut should be available pretty soon." i.e., we don't want to package DLC on conda actually, we would like to stay with pip....

    and just to reiterate, the docker version might be what you want ultimately

  6. hmaarrfk commented on Oct 17, 2021

    ContributorAuthor

    Yes the CZI has been quite active in moving Vispy and other packages in the scientific python environment forward. I think it will be greatly appreciated.

    My general concern is not so much with vispy development, but more with widespread integration with other packages and larger system dependencies. Qt is quite painful to package, and has, over the years, grown to be larger and larger.

    As for the the conda package. I'm requesting the following package to be merged into conda-forge
    conda-forge/staged-recipes#16559
    Lets discuss that: #1549

  7. MMathisLab commented on Nov 6, 2021

    Member

    https://github.com/DeepLabCut/napari-DeepLabCut here is the new GUI @hmaarrfk - still happy to review a PR moving the import wx mpl.use("WxAgg") is useful in the meantime.

  8. davidmurray commented on Jan 31, 2022

    Hello @MMathisLab and @hmaarrfk
    I am facing the exact issue as well, as I am trying to integrate DeepLabCut in a larger GUI project to do animal tracking.
    Is there any progress on this issue/feature?

    Thank you very much,
    David

  9. hmaarrfk commented on Jan 31, 2022

    ContributorAuthor

    i've mostly just not installed wx with deeplabcut :/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL