Cannot install
Opened this issue · 8 comments
Have tried pip which has this issue with tensorflow-metal
(sk_311) koya@Koyas-MacBook-Pro % pipx install sleepkit
Fatal error from pip prevented installation. Full pip output in file:
/Users/koya/.local/pipx/logs/cmd_2024-10-01_21.35.49_pip_errors.log
pip seemed to fail to build package:
tensorflow<3.0.0,>=2.17.0
Some possibly relevant errors from pip install:
ERROR: Ignored the following versions that require a different python version: 0.3.0 Requires-Python <3.12,>=3.11; 0.4.0 Requires-Python <3.12,>=3.11; 0.5.0 Requires-Python <3.12,>=3.11; 1.10.0 Requires-Python <3.12,>=3.8; 1.10.0rc1 Requires-Python <3.12,>=3.8; 1.10.0rc2 Requires-Python <3.12,>=3.8; 1.10.1 Requires-Python <3.12,>=3.8; 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11; 1.6.2 Requires-Python >=3.7,<3.10; 1.6.3 Requires-Python >=3.7,<3.10; 1.7.0 Requires-Python >=3.7,<3.10; 1.7.1 Requires-Python >=3.7,<3.10; 1.7.2 Requires-Python >=3.7,<3.11; 1.7.3 Requires-Python >=3.7,<3.11; 1.8.0 Requires-Python >=3.8,<3.11; 1.8.0rc1 Requires-Python >=3.8,<3.11; 1.8.0rc2 Requires-Python >=3.8,<3.11; 1.8.0rc3 Requires-Python >=3.8,<3.11; 1.8.0rc4 Requires-Python >=3.8,<3.11; 1.8.1 Requires-Python >=3.8,<3.11; 1.9.0 Requires-Python >=3.8,<3.12; 1.9.0rc1 Requires-Python >=3.8,<3.12; 1.9.0rc2 Requires-Python >=3.8,<3.12; 1.9.0rc3 Requires-Python >=3.8,<3.12; 1.9.1 Requires-Python >=3.8,<3.12
ERROR: Could not find a version that satisfies the requirement tensorflow-metal<2.0.0,>=1.1.0; sys_platform == "darwin" (from sleepkit) (from versions: none)
ERROR: No matching distribution found for tensorflow-metal<2.0.0,>=1.1.0; sys_platform == "darwin"
Error installing sleepkit.
(sk_311) koya@Koyas-MacBook-Pro % python --version
Python 3.11.9
update: tried installing using poetry and a conda environment with python 3.11.9. this worked.
now however am getting the following error when trying to run the demo from the guide https://ambiqai.github.io/sleepkit/guides/train-detect-model/
(sk_311) koya@Koyas-MacBook-Pro % python sleepkit_test.py
Traceback (most recent call last):
File "/Users/koya/Development2/sleepkit_test.py", line 42, in <module>
ds = sk.DatasetFactory.create(
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ItemFactory' object has no attribute 'create'
Hi @KoyaS,
Thanks for reporting these issues. I will investigate the issue installing on MacOS- tensor flow-metal has not been updated in a while.
As for the guide example, I need to update this as the code base has changed a bit. I should have this fixed by end of day.
I've released a new version of SleepKit (0.7.0). You should be able to install via pip or poetry without issue on MacOS.
I've also updated the basic sleep detect example. I will be working on adding couple more end-to-end examples in coming weeks.
hey, @apage224. thanks for the quick update.
unfortunately the code will still not run - i got farther this time though.
task.download(params=params)
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[10], [line 1](vscode-notebook-cell:?execution_count=10&line=1)
----> [1](vscode-notebook-cell:?execution_count=10&line=1) task.download(params=params)
File /opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:32, in Task.download(params)
[30](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:30) logger.debug(f"Downloading dataset: {ds.name}")
[31](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:31) ds: Dataset = DatasetFactory.get(ds.name)(**ds.params)
---> [32](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:32) ds.download(
[33](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:33) num_workers=params.num_workers,
[34](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:34) force=params.force_download,
[35](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:35) )
File /opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:442, in MesaDataset.download(self, num_workers, force)
[434](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:434) def download(self, num_workers: int | None = None, force: bool = False):
[435](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:435) """Download STAGES dataset from the NSRR website.
[436](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:436)
[437](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:437) Args:
[438](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:438) num_workers (int | None, optional): # parallel workers. Defaults to None.
[439](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:439) force (bool, optional): Force redownload. Defaults to False.
[440](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:440) """
--> [442](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:442) download_nsrr(
[443](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:443) db_slug=self.path.stem,
[444](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:444) subfolder="",
[445](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:445) pattern="*",
...
[54](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/nsrr.py:54) _nsrr_token = token
[55](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/nsrr.py:55) return _nsrr_token
---> [57](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/nsrr.py:57) raise RuntimeError("Authentication at sleepdata.org failed, verify token!")
RuntimeError: Authentication at sleepdata.org failed, verify token!
which i was able to solve by
from sleepkit.datasets.nsrr import authenticate_nsrr
authenticate_nsrr('********')
Authenticated at sleepdata.org as koya
but then
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[14], [line 1](vscode-notebook-cell:?execution_count=14&line=1)
----> [1](vscode-notebook-cell:?execution_count=14&line=1) task.download(params=params)
File /opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:32, in Task.download(params)
[30](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:30) logger.debug(f"Downloading dataset: {ds.name}")
[31](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:31) ds: Dataset = DatasetFactory.get(ds.name)(**ds.params)
---> [32](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:32) ds.download(
[33](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:33) num_workers=params.num_workers,
[34](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:34) force=params.force_download,
[35](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/tasks/task.py:35) )
File /opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:442, in MesaDataset.download(self, num_workers, force)
[434](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:434) def download(self, num_workers: int | None = None, force: bool = False):
[435](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:435) """Download STAGES dataset from the NSRR website.
[436](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:436)
[437](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:437) Args:
[438](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:438) num_workers (int | None, optional): # parallel workers. Defaults to None.
[439](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:439) force (bool, optional): Force redownload. Defaults to False.
[440](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:440) """
--> [442](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:442) download_nsrr(
[443](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:443) db_slug=self.path.stem,
[444](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:444) subfolder="",
[445](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/mesa.py:445) pattern="*",
...
[137](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/nsrr.py:137) # files overview page. The response is an HTML-page which doesn't have a
[138](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/nsrr.py:138) # "content-disposition" header.
[139](https://file+.vscode-resource.vscode-cdn.net/opt/miniconda3/envs/sk_3112/lib/python3.11/site-packages/sleepkit/datasets/nsrr.py:139) response = requests.get(url, stream=True, timeout=30)
TypeError: download_file() got an unexpected keyword argument 'checksum'
my current version of sleepkit is 0.7.0
Looks like there is a bit of regression. I just pushed changes to fix arguments. Looks like NSRR also changed their API- I adjusted to fix this as well. A new release should be available in next hour.
As a note, you can either call authenticate_nsrr or set env var NSRR_TOKEN
to authenticate login to NSRR.
Couple questions:
- What dataset(s) are you looking to use?
- What's your target application / use case ?
- Are you installing from git repo or PyPi ?
sure, i'm looking to do the following 3-stage task:
load feature set fs_w_pa_14
load model SS-3-TCN-SM
and continue training it using my own data (i have raw ppg / raw accelerometer data that i will preprocess and feed to the model)
I'm indifferent about the dataset that I run this model on, I just wanted to verify the performance of the model before continuing training with my own data. I have been looking at MESA to do this.
Understood. Did you get access to mesa or mesa-commercial-use?
I'd recommend using ss-3-tcn-sm.json as a starting point.
To quickly get results, you can use sleepkit as cli tool. Assuming you download above json locally, you can run the following with python environment activated.
Download dataset (this will use mesa-commercial-use)
sleepkit -m download -t stage -c ./ss-3-tcn-sm.json
Generate features
sleepkit -m feature -t stage -c ./ss-3-tcn-sm.json
Train model
sleepkit -m train -t stage -c ./ss-3-tcn-sm.json
Evaluate model
sleepkit -m evaluate -t stage -c ./ss-3-tcn-sm.json
Demo model on entire subject
sleepkit -m demo -t stage -c ./ss-3-tcn-sm.json
If you have the non-commercial version of mesa, then inside the config set the following:
datasets[0]["params"]["commercial"] = false
hmmm. good callout. I don't have access to MESA. I can submit for access but in the meantime are there any workarounds / other datasets I could use?