8000 Issue on page /notebooks/Training_and_inference_using_Google_Drive.html · Issue #2143 · talmolab/sleap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Issue on page /notebooks/Training_and_inference_using_Google_Drive.html #2143

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

Open
mrnels19 opened this issue Mar 24, 2025 · 7 comments
Open

Comments

@mrnels19
Copy link

Hello,
I have been trying to install SLEAP in Google Colab to run inference on a set of videos. In the past (last year), I have been able to successfully install SLEAP through the following commands:

!pip uninstall -y opencv-python opencv-contrib-python
!pip install sleap==1.3.1

However, I now receive errors when running these commands, as shown below (the Warnings were previously present; only the text beginning with the word "error" is new). I have tried to install different versions of SLEAP and I even ran the Training_and_inference_using_Google_Drive.ipynb file provided on the SLEAP website. In both cases, I still receive an error and cannot import SLEAP or run commands associated with SLEAP later in my code. I am running this Google Colab on a 2019 MacBook Pro. If you could provide some input on what is causing this error, I would appreciate it!

WARNING: Skipping opencv-python as it is not installed.
WARNING: Skipping opencv-contrib-python as it is not installed.
Collecting sleap==1.3.1
Using cached sleap-1.3.1-py3-none-any.whl.metadata (11 kB)
Collecting numpy<1.23.0,>=1.19.5 (from sleap==1.3.1)
Using cached numpy-1.22.4.zip (11.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting attrs<=21.4.0,>=21.2.0 (from sleap==1.3.1)
Using cached attrs-21.4.0-py2.py3-none-any.whl.metadata (9.8 kB)
Collecting cattrs==1.1.1 (from sleap==1.3.1)
Using cached cattrs-1.1.1-py3-none-any.whl.metadata (12 kB)
Collecting jsonpickle==1.2 (from sleap==1.3.1)
Using cached jsonpickle-1.2-py2.py3-none-any.whl.metadata (1.1 kB)
Requirement already satisfied: networkx in /usr/local/lib/python3.11/dist-packages (from sleap==1.3.1) (3.4.2)
Requirement already satisfied: tensorflow-hub in /usr/local/lib/python3.11/dist-packages (from sleap==1.3.1) (0.16.1)
Collecting h5py<=3.7.0,>=3.1.0 (from sleap==1.3.1)
Using cached h5py-3.7.0.tar.gz (392 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting python-rapidjson (from sleap==1.3.1)
Using cached python_rapidjson-1.20-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (22 kB)
Collecting opencv-python<=4.6.0,>=4.2.0 (from sleap==1.3.1)
Using cached opencv_python-4.5.5.64-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (18 kB)
Requirement already satisfied: pandas in /usr/local/lib/python3.11/dist-packages (from sleap==1.3.1) (2.2.2)
Requirement already satisfied: psutil in /usr/local/lib/python3.11/dist-packages (from sleap==1.3.1) (5.9.5)
Collecting qtpy>=2.0.1 (from sleap==1.3.1)
Using cached QtPy-2.4.3-py3-none-any.whl.metadata (12 kB)
Requirement already satisfied: pyzmq in /usr/local/lib/python3.11/dist-packages (from sleap==1.3.1) (24.0.1)
Requirement already satisfied: pyyaml in /usr/local/lib/python3.11/dist-packages (from sleap==1.3.1) (6.0.2)
Collecting pillow<=8.4.0,>=8.3.1 (from sleap==1.3.1)
Using cached Pillow-8.4.0.tar.gz (49.4 MB)
Preparing metadata (setup.py) ... done
Collecting imageio<=2.15.0 (from sleap==1.3.1)
Using cached imageio-2.15.0-py3-none-any.whl.metadata (4.1 kB)
Collecting imgaug==0.4.0 (from sleap==1.3.1)
Using cached imgaug-0.4.0-py2.py3-none-any.whl.metadata (1.8 kB)
Collecting scipy<=1.9.0,>=1.4.1 (from sleap==1.3.1)
Using cached scipy-1.9.0.tar.gz (42.0 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Preparing metadata (pyproject.toml) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

@gitttt-1234
Copy link
Contributor

Hi @mrnels19 !

It appears that Colab recently updated python to v3.11, which has introduced compatibility issues with scipy. Could you please try the suggested fix given here?
Let me know if you have any questions!

Thanks,

Divya

@mrnels19
Copy link
Author

I tried the suggested fix in the conversation you referenced, but I still received an error during the process:

Python 3.11.11
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libpython3.7-minimal libpython3.7-stdlib python3.7-minimal
Suggested packages:
python 8000 3.7-venv binfmt-support
The following NEW packages will be installed:
libpython3.7-minimal libpython3.7-stdlib python3.7 python3.7-minimal
0 upgraded, 4 newly installed, 0 to remove and 29 not upgraded.
Need to get 4,670 kB of archives.
After this operation, 17.7 MB of additional disk space will be used.
Get:1 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy/main amd64 libpython3.7-minimal amd64 3.7.17-1+jammy1 [608 kB]
Get:2 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy/main amd64 python3.7-minimal amd64 3.7.17-1+jammy1 [1,837 kB]
Get:3 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy/main amd64 libpython3.7-stdlib amd64 3.7.17-1+jammy1 [1,864 kB]
Get:4 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy/main amd64 python3.7 amd64 3.7.17-1+jammy1 [362 kB]
Fetched 4,670 kB in 2s (2,188 kB/s)
Selecting previously unselected package libpython3.7-minimal:amd64.
(Reading database ... 126209 files and directories currently installed.)
Preparing to unpack .../libpython3.7-minimal_3.7.17-1+jammy1_amd64.deb ...
Unpacking libpython3.7-minimal:amd64 (3.7.17-1+jammy1) ...
Selecting previously unselected package python3.7-minimal.
Preparing to unpack .../python3.7-minimal_3.7.17-1+jammy1_amd64.deb ...
Unpacking python3.7-minimal (3.7.17-1+jammy1) ...
Selecting previously unselected package libpython3.7-stdlib:amd64.
Preparing to unpack .../libpython3.7-stdlib_3.7.17-1+jammy1_amd64.deb ...
Unpacking libpython3.7-stdlib:amd64 (3.7.17-1+jammy1) ...
Selecting previously unselected package python3.7.
Preparing to unpack .../python3.7_3.7.17-1+jammy1_amd64.deb ...
Unpacking python3.7 (3.7.17-1+jammy1) ...
Setting up libpython3.7-minimal:amd64 (3.7.17-1+jammy1) ...
Setting up python3.7-minimal (3.7.17-1+jammy1) ...
Setting up libpython3.7-stdlib:amd64 (3.7.17-1+jammy1) ...
Setting up python3.7 (3.7.17-1+jammy1) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for man-db (2.10.2-1) ...
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Get:4 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ InRelease [3,632 B]
Get:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]
Get:6 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64 InRelease [1,581 B]
Get:7 https://r2u.stat.illinois.edu/ubuntu jammy InRelease [6,555 B]
Hit:8 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy InRelease
Hit:9 https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu jammy InRelease
Get:10 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [3,813 kB]
Hit:11 https://ppa.launchpadcontent.net/ubuntugis/ppa/ubuntu jammy InRelease
Get:12 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1,238 kB]
Get:13 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [47.7 kB]
Get:14 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [2,698 kB]
Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [4,041 kB]
Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1,538 kB]
Get:17 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [3,041 kB]
Get:18 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [55.7 kB]
Get:19 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [35.2 kB]
Get:20 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64 Packages [1,381 kB]
Get:21 https://r2u.stat.illinois.edu/ubuntu jammy/main amd64 Packages [2,680 kB]
Get:22 https://r2u.stat.illinois.edu/ubuntu jammy/main all Packages [8,772 kB]
Fetched 29.7 MB in 4s (7,379 kB/s)
Reading package lists... Done
W: Skipping acquire of configured file 'main/source/Sources' as repository 'https://r2u.stat.illinois.edu/ubuntu jammy InRelease' does not seem to provide it (sources.list entry misspelt?)
There are 3 choices for the alternative python3 (providing /usr/bin/python3).

Selection Path Priority Status

  • 0 /usr/bin/python3.11 2 auto mode
    1 /usr/bin/python3.10 1 manual mode
    2 /usr/bin/python3.11 2 manual mode
    3 /usr/bin/python3.7 1 manual mode

Press to keep the current choice[*], or type selection number: ^C
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
python3-setuptools python3-wheel
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
python3-pip python3-setuptools python3-wheel
0 upgraded, 3 newly installed, 0 to remove and 35 not upgraded.
Need to get 1,677 kB of archives.
After this operation, 8,968 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 python3-setuptools all 59.6.0-1.2ubuntu0.22.04.2 [340 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 python3-wheel all 0.37.1-2ubuntu0.22.04.1 [32.0 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 python3-pip all 22.0.2+dfsg-1ubuntu0.5 [1,306 kB]
Fetched 1,677 kB in 1s (1,871 kB/s)
Selecting previously unselected package python3-setuptools.
(Reading database ... 126829 files and directories currently installed.)
Preparing to unpack .../python3-setuptools_59.6.0-1.2ubuntu0.22.04.2_all.deb ...
Unpacking python3-setuptools (59.6.0-1.2ubuntu0.22.04.2) ...
Selecting previously unselected package python3-wheel.
Preparing to unpack .../python3-wheel_0.37.1-2ubuntu0.22.04.1_all.deb ...
Unpacking python3-wheel (0.37.1-2ubuntu0.22.04.1) ...
Selecting previously unselected package python3-pip.
Preparing to unpack .../python3-pip_22.0.2+dfsg-1ubuntu0.5_all.deb ...
Unpacking python3-pip (22.0.2+dfsg-1ubuntu0.5) ...
Setting up python3-setuptools (59.6.0-1.2ubuntu0.22.04.2) ...
Setting up python3-wheel (0.37.1-2ubuntu0.22.04.1) ...
Setting up python3-pip (22.0.2+dfsg-1ubuntu0.5) ...
Processing triggers for man-db (2.10.2-1) ...
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
python3.7-lib2to3
The following NEW packages will be installed:
python3.7-distutils python3.7-lib2to3
0 upgraded, 2 newly installed, 0 to remove and 35 not upgraded.
Need to get 313 kB of archives.
After this operation, 1,229 kB of additional disk space will be used.
Get:1 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy/main amd64 python3.7-lib2to3 all 3.7.17-1+jammy1 [124 kB]
Get:2 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy/main amd64 python3.7-distutils all 3.7.17-1+jammy1 [189 kB]
Fetched 313 kB in 1s (383 kB/s)
Selecting previously unselected package python3.7-lib2to3.
(Reading database ... 127691 files and directories currently installed.)
Preparing to unpack .../python3.7-lib2to3_3.7.17-1+jammy1_all.deb ...
Unpacking python3.7-lib2to3 (3.7.17-1+jammy1) ...
Selecting previously unselected package python3.7-distutils.
Preparing to unpack .../python3.7-distutils_3.7.17-1+jammy1_all.deb ...
Unpacking python3.7-distutils (3.7.17-1+jammy1) ...
Setting up python3.7-lib2to3 (3.7.17-1+jammy1) ...
Setting up python3.7-distutils (3.7.17-1+jammy1) ...
Python 3.11.11
Collecting python-rapidjson<=1.10
Downloading python_rapidjson-1.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (20 kB)
Downloading python_rapidjson-1.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 36.4 MB/s eta 0:00:00
Installing collected packages: python-rapidjson
Successfully installed python-rapidjson-1.10
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 28.8/28.8 MB 40.1 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Preparing metadata (setup.py) ... done
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.5/11.5 MB 61.3 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.4/49.4 MB 14.0 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 228.9/228.9 kB 15.6 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42.0/42.0 MB 17.0 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

@gitttt-1234
Copy link
Contributor

Hi @mrnels19 !

Selection Path Priority Status
0 /usr/bin/python3.11 2 auto mode
1 /usr/bin/python3.10 1 manual mode
2 /usr/bin/python3.11 2 manual mode
3 /usr/bin/python3.7 1 manual mode
Press to keep the current choice[*], or type selection number: ^C
Reading package lists... Done

Could you please choose 3 when prompted for the choice? This ensures that python3.7 is used.

Thanks,

Divya

@mrnels19
Copy link
Author
mrnels19 commented Mar 28, 2025

Hi @gitttt-1234 ! Thank you for your reply! I chose 3 and then hit enter when prompted. I ran the installation code multiple times, but I could not seem to import sleap later in my code. Below is the response I got after running the installation code, followed by the code to import sleap and the response there.

Response to Installation Code:

Python 3.7.17
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3.7 is already the newest version (3.7.17-1+jammy1).
0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.
Hit:1 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ InRelease
Hit:2 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64 InRelease
Get:3 ht 8000 tp://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Hit:4 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:5 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Hit:6 https://r2u.stat.illinois.edu/ubuntu jammy InRelease
Hit:7 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy InRelease
Hit:8 https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu jammy InRelease
Hit:9 https://ppa.launchpadcontent.net/ubuntugis/ppa/ubuntu jammy InRelease
Get:10 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]
Fetched 384 kB in 4s (93.6 kB/s)
Reading package lists... Done
W: Skipping acquire of configured file 'main/source/Sources' as repository 'https://r2u.stat.illinois.edu/ubuntu jammy InRelease' does not seem to provide it (sources.list entry misspelt?)
There are 3 choices for the alternative python3 (providing /usr/bin/python3).

Selection Path Priority Status

0 /usr/bin/python3.11 2 auto mode
1 /usr/bin/python3.10 1 manual mode
2 /usr/bin/python3.11 2 manual mode

  • 3 /usr/bin/python3.7 1 manual mode

Press to keep the current choice[*], or type selection number: 3
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-pip is already the newest version (22.0.2+dfsg-1ubuntu0.5).
0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3.7-distutils is already the newest version (3.7.17-1+jammy1).
0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.
Python 3.7.17
Requirement already satisfied: python-rapidjson<=1.10 in /usr/local/lib/python3.7/dist-packages (1.10)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: Skipping opencv-contrib-python as it is not installed.
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Code (start and end are marked with **) to import sleap and my response:

**import sleap
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns

mpl.style.use("seaborn-deep")
sleap.versions()**


ModuleNotFoundError Traceback (most recent call last)
in <cell line: 0>()
----> 1 import sleap
2 import numpy as np
3 import pandas as pd
4 import matplotlib as mpl
5 import matplotlib.pyplot as plt

ModuleNotFoundError: No module named 'sleap'


NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

@mrnels19
Copy link
Author
mrnels19 commented Apr 7, 2025

Hi, I just wanted to follow up on my previous post (I think the varying font sizes that occurred when I pasted my text made it hard to read), but I still cannot import or load SLEAP in a Google Colab file. I used the code referenced in this issue to install SLEAP, and I chose the number 3 when prompted. However, when I import sleap I get the following error: ModuleNotFoundError: No module named 'sleap'
Similarly, if I type help(sleap.load_metrics) I get an error saying NameError: name 'sleap' is not defined

Is there another way to load SLEAP into Google Colab, or a way to evaluate a SLEAP model without using the Google Colab script? Thank you!

@gitttt-1234
Copy link
Contributor
gitttt-1234 commented Apr 8, 2025

Hi @mrnels19,

We're looking into this, trying to resolve the dependency conflicts. Do you want to run inference with a .slp model? You could create a conda env and install sleap in your local machine and run the model evaluation code in your local directly.

Let me know if you have any questions!

Thanks,

Divya

@mrnels19
Copy link
Author
mrnels19 commented Apr 9, 2025

Great, please let me know when the dependency conflict is resolved. I am looking to run inference and model evaluation, and I will let you know if I have any more questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0