GarminDB icon indicating copy to clipboard operation
GarminDB copied to clipboard

Building from Source - Fails on importing fitfile module

Open delize opened this issue 11 months ago • 8 comments

Describe the bug Unable to make setup from source

To Reproduce Steps to reproduce the behavior:

  1. Clone Github Repo
  2. Run make setup
  3. Receive Error

Expected behavior Expected to have make setup complete successfully.

Logs

~/Documents/github/GarminDB master
$ make setup                                                                                                [10:31:53]
$PROJECT_BASE is [/Users/username/Documents/github/GarminDB]
$PLATFORM is [Darwin]
$SHELL is [/bin/sh]
$PIP_PATH is [/opt/homebrew/bin/pip3]
python3 -m venv --upgrade-deps /Users/username/Documents/github/GarminDB/.venv
git submodule init
Submodule 'Fit' (https://github.com/tcgoetz/Fit.git) registered for path 'Fit'
Submodule 'Plugins' (https://github.com/tcgoetz/GarminDbPlugins.git) registered for path 'Plugins'
Submodule 'Tcx' (https://github.com/tcgoetz/Tcx.git) registered for path 'Tcx'
Submodule 'utilities' (https://github.com/tcgoetz/utilities.git) registered for path 'utilities'
git submodule update
Cloning into '/Users/username/Documents/github/GarminDB/Fit'...
Cloning into '/Users/username/Documents/github/GarminDB/Plugins'...
Cloning into '/Users/username/Documents/github/GarminDB/Tcx'...
Cloning into '/Users/username/Documents/github/GarminDB/utilities'...
Submodule path 'Fit': checked out '306ad50288a1ead8dec9502708560d410ac69306'
Submodule path 'Plugins': checked out '82bd3faba1de9bbd9eb7e2bf82687b62d7458c7a'
Submodule path 'Tcx': checked out '277b2748d01df47e3d696e876c8a0947997e6162'
Submodule path 'utilities': checked out '5ce3f712f34818cddf5327cd827a480989ff6940'
python -c 'import sys; import garmindb.version; garmindb.version.python_dev_version_check(sys.argv[0])'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import sys; import garmindb.version; garmindb.version.python_dev_version_check(sys.argv[0])
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Documents/github/GarminDB/garmindb/__init__.py", line 15, in <module>
    from .activity_fit_file_processor import ActivityFitFileProcessor
  File "/Users/username/Documents/github/GarminDB/garmindb/activity_fit_file_processor.py", line 10, in <module>
    import fitfile
ModuleNotFoundError: No module named 'fitfile'
make: *** [version_check] Error 1

Additional context

$ python --version                                                                                          [10:32:02]
Python 3.13.1

$ command -v python                                                                                         [10:34:25]
/opt/homebrew/opt/python@3/libexec/bin/python

$ system_profiler SPSoftwareDataType                                                                        [10:37:23]
Software:

    System Software Overview:

      System Version: macOS 15.2 (24C101)
      Kernel Version: Darwin 24.2.0

delize avatar Jan 04 '25 09:01 delize

Running the pip module does work fine.

delize avatar Jan 04 '25 09:01 delize

I encounter the same issue and tried digging a bit deeper. The order of execution is: make setup -> Target setup_install -> target version_check -> Call to

python -c 'import sys; import garmindb.version; garmindb.version.python_dev_version_check(sys.argv[0])'

This is failing because import garmindb.version is executing garmindb.__init__.py which in turn tries importing fitfile which is not available in a fresh environment. Here, I'm not sure what the intended behavior is. Maybe the fitfile module should've been taken from the Fit submodule in which case setting up the PYTHONPATH is missing, however garmindb.__init__.py als includes completely external dependencies like sqlalchemy that would need installation.

Or maybe the idea is to use the internally created venv and have all dependencies install first before doing the version check. In this case I'm wondering why Fit, Tcx and utilities are git submodules if fitfile, tcxfile and idbutils are installed via pip/pypi for the venv?

@tcgoetz - Any suggestion which way is inteded? I'll happily work towards a fix.

P.S. Small sidenote: The execution will still fail, because garmindb.version.python_dev_version_check() is calling idbutils.version.python_version_check() with verbose=True but the function does not accept this parameter.

CRMemory avatar Feb 03 '25 12:02 CRMemory

I am having the same issue. @delize - did you ever figure out a work-around?

apelakh avatar May 16 '25 17:05 apelakh

yeah, just ran into this issue today

neightdog avatar Jun 11 '25 20:06 neightdog

For local testing, I usually do: make clean reinstall_all all test

but that's not a first time install.

tcgoetz avatar Jun 11 '25 21:06 tcgoetz

See https://github.com/tcgoetz/GarminDB/pull/281 for removing of version arg failing the initial install.

maxo99 avatar Jul 13 '25 18:07 maxo99

I'm having this issue as well; make setup fails with same error as shown in OP.

Interestingly, I also got a similar/same error when trying to spin up using the Releases method (ie pip install garmindb > garmindb_cli.py --all --download --import --analyze --latest:

➜  garmindb_cli.py --all --download --import --analyze --latest
Traceback (most recent call last):
  File "/Users/*****/.local/share/virtualenvs/corazone-SeZAWtEJ/bin/garmindb_cli.py", line 22, in <module>
    from garmindb import python_version_check, log_version, format_version
  File "/Users/*****/.local/share/virtualenvs/corazone-SeZAWtEJ/lib/python3.11/site-packages/garmindb/__init__.py", line 15, in <module>
    from .activity_fit_file_processor import ActivityFitFileProcessor
  File "/Users/*****/.local/share/virtualenvs/corazone-SeZAWtEJ/lib/python3.11/site-packages/garmindb/activity_fit_file_processor.py", line 10, in <module>
    import fitfile
ModuleNotFoundError: No module named 'fitfile'

welew204 avatar Aug 25 '25 03:08 welew204

I'm having this issue as well; make setup fails with same error as shown in OP. ...

Update here is that I was able to get thru this issue by simply ensuring: a.) the venv was based in the actual cloned tree (and not a parent directory) b.) the python version had to be 3.13 for running this way (as specified in dev_python_required in GarminDB/garmindb/version_info.py) b.) I ran pipenv -r install requirements.txt after (and in addition to) pipenv install -> this made sure the fitfile module was installed before it was needed (by the script pointed at by make setup).

welew204 avatar Aug 26 '25 07:08 welew204