Skip to content
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

Long file path prevents installation in environments on Windows #31

Closed
asparke2 opened this issue Oct 19, 2023 · 0 comments · Fixed by #32
Closed

Long file path prevents installation in environments on Windows #31

asparke2 opened this issue Oct 19, 2023 · 0 comments · Fixed by #32
Assignees

Comments

@asparke2
Copy link
Member

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]

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

Successfully merging a pull request may close this issue.

2 participants