Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running SLEAP headless #1926

Closed
agosztolai opened this issue Aug 28, 2024 · 4 comments
Closed

Running SLEAP headless #1926

agosztolai opened this issue Aug 28, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@agosztolai
Copy link

Hello,

I am trying to run SLEAP on a remote server that does not have displays installed.

I can install SLEAP without issues using conda. However, when I want to import sleap in python I get the following error.

>>> import sleap
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/msc/home/agoszt25/sleap/sleap/__init__.py", line 10, in <module>
    from sleap.io.dataset import Labels, load_file
  File "/msc/home/agoszt25/sleap/sleap/io/dataset.py", line 83, in <module>
    from sleap.gui.dialogs.missingfiles import MissingFilesDialog
  File "/msc/home/agoszt25/sleap/sleap/gui/dialogs/missingfiles.py", line 10, in <module>
    from qtpy import QtWidgets, QtCore, QtGui
  File "/msc/home/agoszt25/miniconda3/envs/sleap/lib/python3.7/site-packages/qtpy/QtWidgets.py", line 111, in <module>
    from PySide2.QtWidgets import *
  File "/msc/home/agoszt25/miniconda3/envs/sleap/lib/python3.7/site-packages/shiboken2/files.dir/shibokensupport/feature.py", line 139, in _import
    return original_import(name, *args, **kwargs)
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

Do you know how to resolve this issue? Can SLEAP be run in 'headless' mode?

@agosztolai agosztolai added the bug Something isn't working label Aug 28, 2024
@roomrys
Copy link
Collaborator

roomrys commented Aug 28, 2024

Hi @agosztolai,

We have run into this ourselves recently due to this change in the opencv package being pulled in:
conda-forge/opencv-feedstock#401
which no longer comes shipped with required GUI libraries. This causes issues on Linux machines, but there is a quick fix.

The SLEAP package is very intertwined with it's GUI code (hence why we are slowly but surely modularizing parts into their own packages - see sleap-io and sleap-nn). Even if you do not need the GUI, you will need to install the following packages:

sudo apt-get update
sudo apt-get install libglapi-mesa libegl-mesa0 libegl1 libopengl0 libgl1-mesa-glx

Let us know if you run into any trouble.

Thanks,
Liezl

@agosztolai
Copy link
Author

agosztolai commented Aug 29, 2024 via email

@roomrys
Copy link
Collaborator

roomrys commented Aug 29, 2024

Hi Adam,

I have two suggestions below and would try them one at a time starting with the first suggestion.


The believed issue/cause

I also want to note that the problem seem to be not only with CV2, but Qt too. For example, installing pip install opencv-python-headless solves the issue with opencv. But the Qt is still looking for the libel.so.1 library, which I am not able to resolve.

The opencv and Qt packages are closely intertwined. The issue we are facing comes from this conda-forge issue:

where they basically released newer builds of the same version of opencv that include qt6-main as a dependency which means they also added OpenGL libraries to the opencv package which seem to conflict with the packages that are needed with qt2 (which is what we are using). The previous build of SLEAP was released before they started adding these "breaking" opencv packages and hence we do not have a constrain on the newer opencvs yet, but are working on our new release in:


Pre-suggestions

I have tried finding these packages compatible with conda environments, installed them, namely https://anaconda.org/anaconda/mesa-libegl-devel-cos6-x86_64 https://anaconda.org/conda-forge/mesa-libglapi-cos7-x86_64 https://anaconda.org/conda-forge/mesalib https://anaconda.org/conda-forge/libopengl However, this didn’t help.

Oof, ok, there is possibility that our environment might be a little wonky with these extras installed - would you be ok with recreating the environment first before trying new suggestions?


Suggestion 1

Unfortunately, I do not have sudo access on the server so I cannot run the commands that you suggest.

Sorry! I should have suggested the following first as "with great power comes great responsibility". Can you run

apt-get install libglapi-mesa libegl-mesa0 libegl1 libopengl0 libgl1-mesa-glx

without the sudo?


Suggestion 2

Are you able to list the environment info with conda list while you are in your sleap environment. I am curious which opencv is being used. I wonder if this can be resolved by uninstalling opencv in your sleap environment

conda uninstall opencv

and then reinstalling (constraining to a version of opencv before the addition of the qt6-main dependency)

conda install -c conda-forge "opencv<=4.8.1"

Sorry for the trouble. Please let us know how it goes.

Thanks,
Liezl

@roomrys
Copy link
Collaborator

roomrys commented Sep 3, 2024

Hi @agosztolai,

We have released SLEAP 1.3.4 (off #1927) which adds additional dependency constraints to prevent this from happening.

If you are able, please upgrade to v1.3.4 and let us know if it solves your issue.

I am closing this for now, but if the problem persists, I will reopen the issue.

Thanks,
Liezl

@roomrys roomrys closed this as completed Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants