Skip to content

Commit

Permalink
SLEAP 1.3.3 (#1505)
Browse files Browse the repository at this point in the history
* Do not try to remove item if already deleted (#1498)

* Set `LD_LIBRARY_PATH` on `mamba activate` (#1496)

* Add version restrictions to tensorflow for pypi (#1485)

* Remove `imageio` pin (#1501)

* Reset LD_LIBRARY_PATH on deactivate (#1502)

* Brown bag bump to 1.3.3 (#1484)
  • Loading branch information
roomrys authored Sep 15, 2023
1 parent e4fca4f commit f77af11
Show file tree
Hide file tree
Showing 18 changed files with 100 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .conda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ This folder defines the conda package build for Linux and Windows. There are run
To build, first go to the base repo directory and install the build environment:

```
conda env create -f environment_build.yml -n sleap_build && conda activate sleap_build
mamba env create -f environment_build.yml -n sleap_build && conda activate sleap_build
```

And finally, run the build command pointing to this directory:
Expand All @@ -15,7 +15,7 @@ conda build .conda --output-folder build -c conda-forge -c nvidia -c https://con
To install the local package:

```
conda create -n sleap_0 -c conda-forge -c nvidia -c ./build -c https://conda.anaconda.org/sleap/ -c anaconda sleap=x.x.x
mamba create -n sleap_0 -c conda-forge -c nvidia -c ./build -c https://conda.anaconda.org/sleap/ -c anaconda sleap=x.x.x
```

replacing x.x.x with the version of SLEAP that you just built.
10 changes: 9 additions & 1 deletion .conda/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ pip install --no-cache-dir -r ./requirements.txt

# Install sleap itself. This does not install the requirements, but will list which
# requirements are missing (see "install_requires") when user attempts to install.
python setup.py install --single-version-externally-managed --record=record.txt
python setup.py install --single-version-externally-managed --record=record.txt

# Copy the activate scripts to $PREFIX/etc/conda/activate.d.
# This will allow them to be run on environment activation.
for CHANGE in "activate" "deactivate"
do
mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d"
cp "${RECIPE_DIR}/${PKG_NAME}_${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.sh"
done
6 changes: 6 additions & 0 deletions .conda/sleap_activate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

# Remember the old library path for when we deactivate
export SLEAP_OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
# Help CUDA find GPUs!
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH
4 changes: 4 additions & 0 deletions .conda/sleap_deactivate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

# Reset to the old library path for when deactivating the environment
export LD_LIBRARY_PATH=$SLEAP_OLD_LD_LIBRARY_PATH
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Please include information about how you installed.
- OS:
<!-- [e.g. ubuntu 20.04, macOS 11.0] -->
- Version(s):
<!-- e.g. [SLEAP v1.3.2, python 3.8] --->
<!-- e.g. [SLEAP v1.3.3, python 3.8] --->
- SLEAP installation method (listed [here](https://sleap.ai/installation.html#)):
- [ ] [Conda from package](https://sleap.ai/installation.html#conda-package)
- [ ] [Conda from source](https://sleap.ai/installation.html#conda-from-source)
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
copyright = f"2019–{date.today().year}, Talmo Lab"

# The short X.Y version
version = "1.3.2"
version = "1.3.3"

# Get the sleap version
# with open("../sleap/version.py") as f:
# version_file = f.read()
# version = re.search("\d.+(?=['\"])", version_file).group(0)

# Release should be the full branch name
release = "v1.3.2"
release = "v1.3.3"

html_title = f"SLEAP ({release})"
html_short_title = "SLEAP"
Expand Down
39 changes: 37 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Although you do not need Mambaforge installed to perform a `pip install`, we rec
3. Finally, we can perform the `pip install`:
```bash
pip install sleap[pypi]==1.3.2
pip install sleap[pypi]==1.3.3
```
This works on **any OS except Apple silicon** and on **Google Colab**.
Expand Down Expand Up @@ -343,10 +343,45 @@ python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU')
````{warning}
TensorFlow 2.7+ is currently failing to detect CUDA Toolkit and CuDNN on some systems (see [Issue thread](https://github.com/tensorflow/tensorflow/issues/52988)).
If you run into issues, try downgrading the TensorFlow 2.6:
If you run into issues, either try downgrading the TensorFlow 2.6:
```bash
pip install tensorflow==2.6.3
```
or follow the note below.
````
````{note}
If you are on Linux, have a NVIDIA GPU, but cannot detect your GPU:
```bash
W tensorflow/stream_executor/platform/default/dso_loader.cc:64 Could not load dynamic
library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object
file: No such file or directory
```
then activate the environment:
```bash
mamba activate sleap
```
and run the commands:
```bash
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
echo '#!/bin/sh' >> $CONDA_PREFIX/etc/conda/activate.d/sleap_activate.sh
echo 'export SLEAP_OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH' >> $CONDA_PREFIX/etc/conda/activate.d/sleap_activate.sh
echo 'export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH' >> $CONDA_PREFIX/etc/conda/activate.d/sleap_activate.sh
source $CONDA_PREFIX/etc/conda/activate.d/sleap_activate.sh
```
This will set the environment variable `LD_LIBRARY_PATH` each time the environment is activated. The environment variable will remain set in the current terminal even if we deactivate the environment. Although not strictly necessary, if you would also like the environment variable to be reset to the original value when deactivating the environment, we can run the following commands:
```bash
mkdir -p $CONDA_PREFIX/etc/conda/deactivate.d
echo '#!/bin/sh' >> $CONDA_PREFIX/etc/conda/deactivate.d/sleap_deactivate.sh
echo 'export LD_LIBRARY_PATH=$SLEAP_OLD_LD_LIBRARY_PATH' >> $CONDA_PREFIX/etc/conda/deactivate.d/sleap_deactivate.sh
```
These commands only need to be run once and will subsequently run automatically upon [de]activating your `sleap` environment.
````
## Upgrading and uninstalling
Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks/Data_structures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"source": [
"# This should take care of all the dependencies on colab:\n",
"!pip uninstall -qqq -y opencv-python opencv-contrib-python\n",
"!pip install -qqq sleap==1.3.1111\n",
"!pip install -qqq \"sleap[pypi]>=1.3.3\"\n",
"\n",
"# But to do it locally, we'd recommend the conda package (available on Windows + Linux):\n",
"# conda create -n sleap -c sleap -c conda-forge -c nvidia sleap"
Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks/Interactive_and_realtime_inference.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"source": [
"# This should take care of all the dependencies on colab:\n",
"!pip uninstall -qqq -y opencv-python opencv-contrib-python\n",
"!pip install -qqq sleap==1.3.1\n",
"!pip install -qqq \"sleap[pypi]>=1.3.3\"\n",
"\n",
"\n",
"# But to do it locally, we'd recommend the conda package (available on Windows + Linux):\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks/Interactive_and_resumable_training.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"source": [
"# This should take care of all the dependencies on colab:\n",
"!pip uninstall -qqq -y opencv-python opencv-contrib-python\n",
"!pip install -qqq sleap==1.3.1\n",
"!pip install -qqq \"sleap[pypi]>=1.3.3\"\n",
"\n",
"\n",
"# But to do it locally, we'd recommend the conda package (available on Windows + Linux):\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks/Model_evaluation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
],
"source": [
"!pip uninstall -qqq -y opencv-python opencv-contrib-python\n",
"!pip install -qqq sleap==1.3.1\n",
"!pip install -qqq \"sleap[pypi]>=1.3.3\"\n",
"!apt -qq install tree\n",
"!wget -q https://storage.googleapis.com/sleap-data/reference/flies13/td_fast.210505_012601.centered_instance.n%3D1800.zip\n",
"!unzip -qq -o -d \"td_fast.210505_012601.centered_instance.n=1800\" \"td_fast.210505_012601.centered_instance.n=1800.zip\""
Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks/Post_inference_tracking.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"source": [
"# This should take care of all the dependencies on colab:\n",
"!pip uninstall -qqq -y opencv-python opencv-contrib-python\n",
"!pip install -qqq sleap==1.3.1\n",
"!pip install -qqq \"sleap[pypi]>=1.3.3\"\n",
"\n",
"# But to do it locally, we'd recommend the conda package (available on Windows + Linux):\n",
"# conda create -n sleap -c sleap -c conda-forge -c nvidia sleap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
],
"source": [
"!pip uninstall -qqq -y opencv-python opencv-contrib-python\n",
"!pip install -qqq sleap==1.3.1"
"!pip install -qqq \"sleap[pypi]>=1.3.3\""
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
],
"source": [
"!pip uninstall -qqq -y opencv-python opencv-contrib-python\n",
"!pip install -qqq sleap==1.3.1"
"!pip install -qqq \"sleap[pypi]>=1.3.3\""
]
},
{
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ dependencies:

- pip:
- "--editable=.[conda_dev]"

20 changes: 15 additions & 5 deletions pypi_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,34 @@ jsonpickle==1.2
networkx
numpy>=1.19.5,<1.23.0
opencv-python>=4.2.0,<=4.6.0
# opencv-python-headless>=4.2.0.34,<=4.5.5.62
pandas
pillow>=8.3.1,<=8.4.0
psutil
pykalman==0.9.5
PySide2>=5.13.2,<=5.14.1; platform_machine != 'arm64'
PySide6; sys_platform == 'darwin' and platform_machine == 'arm64'
python-rapidjson
# Otherwise error: Microsoft Visual C++ 14.0 is required.
python-rapidjson <=1.10; sys_platform == 'win32'
python-rapidjson; sys_platform != 'win32'
pyyaml
pyzmq
qtpy>=2.0.1
rich==10.16.1
imageio<=2.15.0
imgaug==0.4.0
scipy>=1.4.1,<=1.9.0
scikit-image
scikit-learn ==1.0.*
scikit-video
seaborn
tensorflow
tensorflow-hub
tensorflow>=2.6.3,<2.9; platform_machine != 'arm64'
tensorflow-hub<=0.14.0
# These dependencies are untested since we do not offer a wheel for apple silicon atm.
tensorflow-macos==2.9.2; sys_platform == 'darwin' and platform_machine == 'arm64'
tensorflow-metal==0.5.0; sys_platform == 'darwin' and platform_machine == 'arm64'

# Dependencies of dependencies
# google-auth 2.23.0 has requirement urllib3<2.0
urllib3<2.0 # Not a 'noticed' runtime-dependency
# tensorboard 2.11.2 has requirement protobuf<4,>=3.9.2
# tensorflow 2.11.0 has requirement protobuf<3.20,>=3.9.2
protobuf<3.20 # Makes GUI work in windows
20 changes: 15 additions & 5 deletions sleap/gui/overlays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@
so that current frame must be redrawn).
"""

from qtpy import QtWidgets

import attr
import abc
import numpy as np
import logging
from typing import Sequence, Union, Optional, List

import attr
import numpy as np
from qtpy import QtWidgets
from qtpy.QtWidgets import QGraphicsItem

from sleap import Labels, Video
from sleap.gui.widgets.video import QtVideoPlayer
from sleap.nn.data.providers import VideoReader
from sleap.nn.inference import VisualPredictor

logger = logging.getLogger(__name__)


@attr.s(auto_attribs=True)
class BaseOverlay(abc.ABC):
Expand Down Expand Up @@ -64,7 +66,15 @@ def remove_from_scene(self):
if self.items is None:
return
for item in self.items:
self.player.scene.removeItem(item)
try:
self.player.scene.removeItem(item)

except RuntimeError as e: # Internal C++ object (PySide2.QtWidgets.QGraphicsPathItem) already deleted.
logger.debug(e)
pass

# Stop tracking the items after they been removed from the scene
self.items = []

def redraw(self, video, frame_idx, *args, **kwargs):
"""Remove all items from the scene before adding new items to the scene.
Expand Down
2 changes: 1 addition & 1 deletion sleap/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"""


__version__ = "1.3.2"
__version__ = "1.3.3"


def versions():
Expand Down

0 comments on commit f77af11

Please sign in to comment.