You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The workspace fails to build on Windows (and possibly other platforms) due to a path error in crates/pylib/src/lib.rs. The py_freeze! macro is invoked with dir = "../Lib", but since the pylib crate is inside crates/pylib/, this resolves to crates/Lib instead of the repository root's Lib/ directory. This causes the build to fail for the entire workspace.
Steps to Reproduce
Clone the repository on a Windows machine (or any machine where relative path resolution matters).
Run cargo build --workspace (or cargo build -p rustpython-pylib).
Observe the build error related to the py_freeze! macro not finding the Lib directory.
Expected Behavior
The py_freeze! macro should correctly find the Lib/ directory at the repository root, and the build should succeed.
Actual Behavior
Build fails with an error indicating that the directory ../Lib cannot be found or is empty.
Environment
OS: Windows (also likely affects other OSes depending on Cargo's working directory)
Rust version: (output of rustc --version)
RustPython commit: (latest main at the time of reporting)
Possible Solution
Change the path in crates/pylib/src/lib.rs from "../Lib" to "../../Lib" so that it correctly points to the root Lib/ directory. Alternatively, use CARGO_MANIFEST_DIR to construct an absolute path.
Additional Context
This issue was discovered while running a full workspace build on Windows. All other crates reference Lib/ correctly; only pylib seems to have this broken relative path.
@ShaharNaveh I tried the core.symlinks setting, but on Windows creating symlinks requires Developer Mode (it's disabled by default for security reasons), so the build still fails with just that.
I found that simply changing the path in py_freeze! from "../Lib" to "../../Lib" in crates/pylib/src/lib.rs bypasses the symlink entirely and points directly to the root Lib folder. Works fine on Windows now — cargo build -p rustpython-pylib passes.
@ShaharNaveh I tried the core.symlinks setting, but on Windows creating symlinks requires Developer Mode (it's disabled by default for security reasons), so the build still fails with just that.
I found that simply changing the path in py_freeze! from "../Lib" to "../../Lib" in crates/pylib/src/lib.rs bypasses the symlink entirely and points directly to the root Lib folder. Works fine on Windows now — cargo build -p rustpython-pylib passes.
If we can make it relative to the CARGO_MANIFEST_DIR path, it would be great!
@ShaharNaveh Good idea. I can use concat!(env!("CARGO_MANIFEST_DIR"), "/../../Lib") inside py_freeze!. That way the path always resolves from the crate directory, no matter where it's built or whether symlinks work.
Does that approach look fine to you? If yes, I'll open a PR with it.
@ShaharNaveh Good idea. I can use concat!(env!("CARGO_MANIFEST_DIR"), "/../../Lib") inside py_freeze!. That way the path always resolves from the crate directory, no matter where it's built or whether symlinks work.
Does that approach look fine to you? If yes, I'll open a PR with it.
Activity
ShaharNaveh commentedon May 30, 2026
Thanks for the report. Have you ran
git config core.symlinks truebefore running the build?alok-108 commentedon May 30, 2026
@ShaharNaveh I tried the core.symlinks setting, but on Windows creating symlinks requires Developer Mode (it's disabled by default for security reasons), so the build still fails with just that.
I found that simply changing the path in py_freeze! from "../Lib" to "../../Lib" in crates/pylib/src/lib.rs bypasses the symlink entirely and points directly to the root Lib folder. Works fine on Windows now — cargo build -p rustpython-pylib passes.
ShaharNaveh commentedon May 30, 2026
If we can make it relative to the CARGO_MANIFEST_DIR path, it would be great!
alok-108 commentedon May 30, 2026
@ShaharNaveh Good idea. I can use concat!(env!("CARGO_MANIFEST_DIR"), "/../../Lib") inside py_freeze!. That way the path always resolves from the crate directory, no matter where it's built or whether symlinks work.
Does that approach look fine to you? If yes, I'll open a PR with it.
ShaharNaveh commentedon May 30, 2026
sound good to me:)