neurogeriatricskiel / KielMAT

Python based toolbox for processing motion data
https://neurogeriatricskiel.github.io/KielMAT/
Other
6 stars 1 forks source link

Virtual environment #13

Closed rmndrs89 closed 11 months ago

rmndrs89 commented 1 year ago

Hi @masoudabedinifar and @hansencl and @JuliusWelzel,

we still need to look at that cross-platform conda or pip environment file. I have just pulled the main branch to update the dataset definitions, and I get the following:

No module named 'pywt'
  File "/home/robbin/Projects/NGMT/ngmt/modules/gsd/GSDA.py", line 7, in <module>
    import pywt
  File "/home/robbin/Projects/NGMT/test.py", line 5, in <module>
    from ngmt.modules.gsd import GSDA
ModuleNotFoundError: No module named 'pywt'

Obviously, I can just intall pip install PyWavelets or conda install pywavelets, but it is also not clear from the environment.yml that this packages is required.

Best, Robbin

JuliusWelzel commented 1 year ago

Thanks for pointing this out you can sign me to resolve the issue

rmndrs89 commented 1 year ago

My suggestion is that this may work:

(ngmt) username@host:~/Projects/NGMT$ conda env export --from-history

but it may need testing :)

JuliusWelzel commented 1 year ago

I gave pipreqs a try which scans the folder and checks all relevant packages used. These are than exported to a requirement.txt file. for a pip install. Is there a reason, we are installing some packages via conda and some via pip? In a venv, I think all can be run through pip. Ideally, we can move to poerty and use pyproject.toml in the future. This is what gaitmap and other recent packages do :) Let's discuss tomorrow

rmndrs89 commented 1 year ago

@JuliusWelzel please have a look at pyproject, then @rmndrs89 will take a look at poetry

rmndrs89 commented 1 year ago

I have looked a bit at poetry, see, e.g.:

Especially, the first source I found very useful, as it also includes writing some test functions. Could be something for @masoudabedinifar to checkout in a lightweight version of the NGMT package? For example, if we create a demo package that only performs the following steps:

  1. resample to 40 Hz
  2. compute the signal norm

With a few commands the package can then be build poetry build and published to PyPI poetry publish.

I am, however, still not sure how this works across Windows, MacOS and Linux operating systems.

JuliusWelzel commented 11 months ago

I was able to easily create an venv using poerty. @rmndrs89 could you, please try for Linux.

Just install poerty, clone the repo and cd to the clone. I updated the install instructions in https://github.com/neurogeriatricskiel/NGMT/commit/0486575b3d9b53d9d9ca5802b58239bd3f7d77dc

rmndrs89 commented 11 months ago

Hi @JuliusWelzel,

apart from some typos in the installation guideline, I have managed to clone the repo and install the environment:

$ git clone https://github.com/neurogeriatricskiel/NGMT.git
$ cd NGMT
$ poetry install

However, when trying to run the example for gait sequence detection in VS Code, I encountered already two missing libraries, ipykernel and matplotlib.

Did you not include these libraries on purpose, or were they omitted when creating the poetry virtual environment?

JuliusWelzel commented 11 months ago

I added the required packages in 94134b0b42f79d5a91b159a4a9d128e49ea87fd3.

Closing now 💯 If you encounter new problems, please open a new issue!