PyPSA / PyPSA/pypsa-usa

Snakemake version 8+ doesn't handle local imports appropriately

Open
#767 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
148
Forks
55
Avg merge
2d 11h
Merged PRs (30d)
18

Description

Version Checks (indicate both or one)
The Issue

Snakemake v8+ changes the way the directory is cached. This causes error messages related to any local imports of the PyPSA-USA scripts directory. This can be fixed 2 ways:

  1. Temp fix: import the directory path to the system $PYTHONPATH in the terminal: export PYTHONPATH="/scratch/htc/oet/044_kinetics/pypsa-usa/workflow/scripts:$PYTHONPATH"

  2. Permanent fix: add the directory path during script execution sys.path.insert(0, os.path.dirname(__file__)) in each affected file

Steps To Reproduce

No response

Error Message

Anything else?

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the affected files under workflow/scripts and checking how their local imports behave with Snakemake v8+ on both the master and develop branches. Reproduce the import error without the PYTHONPATH workaround, then verify that each affected script runs with its local imports resolved during execution without requiring that environment variable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.