NREL / buildstock-query

BuildStockQuery is a python library for querying datasets generated by ResStock™ and ComStock™.
https://nrel.github.io/buildstock-query/
BSD 3-Clause "New" or "Revised" License
9 stars 1 forks source link

Long file path prevents installation in environments on Windows #31

Closed asparke2 closed 11 months ago

asparke2 commented 11 months ago

Issue overview

On Windows, when I include buildstock_query in an environment via inclusion in a setup.py file for another project, the long file names in the repo prevent the file from being checked out because they exceed the Windows 256 character max file path length.

Current Behavior

Add buildstock_query to setup.py via clone from github:

install_requires=[
    'buildstock_query @ git+https://github.com/NREL/buildstock-query'
],

Instead of a successful checkout and installation into the environment, we get this error:

(comstockpostproc_bsquery) C:\GitRepos\ComStock\postprocessing>pip install -e .[dev]
Obtaining file:///C:/GitRepos/ComStock/postprocessing
  Preparing metadata (setup.py) ... done
Collecting buildstock_query@ git+https://github.com/NREL/buildstock-query
  Cloning https://github.com/NREL/buildstock-query to c:\users\aparker\appdata\local\temp\1\pip-install-zsepkhz9\buildstock-query_4223d444187d422281d02d17f8702ab4
  Running command git clone --filter=blob:none --quiet https://github.com/NREL/buildstock-query 'C:\Users\aparker\AppData\Local\Temp\1\pip-install-zsepkhz9\buildstock-query_4223d444187d422281d02d17f8702ab4'
  error: unable to create file tests/reference_files/('small_run_baseline_20230810_100_baseline', 'small_run_category_1_20230616_timeseries', 'small_run_category_1_20230616_upgrades')_query_cache.pkl: Filename too long
  fatal: unable to checkout working tree
  warning: Clone succeeded, but checkout failed.
  You can inspect what was checked out with 'git status'
  and retry the checkout with 'git checkout -f HEAD'

Expected Behavior

Successful checkout and installation into the environment.

Possible Solution

Make the committed filenames shorter. The max filepath length on Windows is 256 characters.

The temporary root directory created by pip install is 108 characters long:

c:\users\aparker\appdata\local\temp\1\pip-install-zsepkhz9\buildstock-query_4223d444187d422281d02d17f8702ab4

This leaves 256 - 108 = 148 characters for the repo to use in file paths.

The file path below is the longest in the repo at 168 characters, which exceeds the 148 character limit:

tests\reference_files\('small_run_baseline_20230810_100_baseline', 'small_run_category_1_20230616_timeseries', 'small_run_category_1_20230616_upgrades')_query_cache.pkl

The next-longest filepaths are only 90 characters, so they are ok because they are below the 148 character limit:

tests\reference_files\largeee_test_runs_small_run_category_1_20230616_upgrades_1.parquet

Environment

Windows, installing into a Conda environment via pip install -e .[dev]