Skip to content

Unable to read python.rs when installing RustPython from source #4117

Closed

Description

@charliermarsh

Summary

In my Cargo.toml, I have:

[dependencies]
rustpython-parser = { git = "https://github.com/RustPython/RustPython.git", rev = "f1c7aebfad707526602c8162c8094a67129b6731" }

Now, running cargo build on my project yields:

∴ cargo build
   Compiling rustpython-parser v0.1.2 (https://github.com/RustPython/RustPython.git?rev=f1c7aebfad707526602c8162c8094a67129b6731#f1c7aebf)
error: couldn't read /Users/crmarsh/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/f1c7aeb/parser/src/../python.rs: No such file or directory (os error 2)
 --> /Users/crmarsh/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/f1c7aeb/parser/src/python.rs:3:1
  |
3 | include!("../python.rs");
  | ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)

The following warnings were emitted during compilation:

warning: python.rs doesn't exist. regenerate.

error: could not compile `rustpython-parser` due to previous error

Is this a user error? I know this is a recent change as my project built without error on dff916d45c5d13074d21ad329a5ab68a6499426a.

Activity

  1. youknowone commented on Aug 21, 2022

    @youknowone
    Member

    I am sorry, this is my fault. I will fix it soon.

  2. youknowone commented on Aug 21, 2022

    @youknowone
    Member

    I want to make it easier, but it will take time. Could you try this for now?

    [dependencies]
    rustpython-parser = { features=["lalrpop"], git = "https://github.com/RustPython/RustPython.git", rev = "f1c7aebfad707526602c8162c8094a67129b6731" }
    
  3. charliermarsh commented on Aug 21, 2022

    @charliermarsh
    CollaboratorAuthor

    That worked! Thank you.

  4. charliermarsh commented on Aug 21, 2022

    @charliermarsh
    CollaboratorAuthor

    (Feel free to close if you'd like.)

  5. ecpost commented on Aug 23, 2022

    @ecpost
    Contributor

    As of about 2 days ago, I'm also having problems compiling rustpython-parser / python.rs. If I do a fresh git clone https://github.com/RustPython/RustPython.git and in it do cargo build --release, after compiling most of the crates I eventually get:

    The following warnings were emitted during compilation:
    
    warning: python.rs doesn't exist. regenerate.
    
    error: failed to run custom build command for `rustpython-parser v0.1.2 (/home/ecpost/dev/temp/RustPython/compiler/parser)`
    
    Caused by:
      process didn't exit successfully: `/home/ecpost/dev/temp/RustPython/target/release/build/rustpython-parser-acbe8425df4f499f/build-script-build` (exit status: 101)
      --- stdout
      cargo:rerun-if-changed=python.lalrpop
      cargo:warning=python.rs doesn't exist. regenerate.
    
      --- stderr
      thread 'main' panicked at 'try: cargo build --manifest-path=compiler/parser/Cargo.toml --features=lalrpop', compiler/parser/build.rs:80:5
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    I'm getting this in different MacOS and Linux systems, so I don't think it's an issue with my environment.

    BTW, a few days ago I had a different failure that suggested I "please install lalrpop", which I did, and that resolved that issue at the time. But that doesn't seem to be relevant here. (The MacOS system has it installed, the Linux does not, both get the same error.)

    P.S. I had also tried the alternate dependency mentioned above, but it didn't help:
    rustpython-parser = { features=["lalrpop"], git = "https://github.com/RustPython/RustPython.git", rev = "f1c7aebfad707526602c8162c8094a67129b6731" }

  6. charliermarsh commented on Aug 23, 2022

    @charliermarsh
    CollaboratorAuthor

    Does it resolve the issue if you run lalrpop python.lalrpop in ./RustPython/compiler/parser prior to cargo build?

  7. ecpost commented on Aug 23, 2022

    @ecpost
    Contributor

    Yes! (In both my MacOS and, after installing lalrpop, my Linux.)

  8. imotai commented on Sep 8, 2022

    @imotai

    Does it resolve the issue if you run lalrpop python.lalrpop in ./RustPython/compiler/parser prior to cargo build?

    still the same

    cargo build --target wasm32-wasi --no-default-features --features freeze-stdlib,stdlib --release
       Compiling rustpython-parser v0.1.2 (/media/psf/Home/opensource/dvm/RustPython/compiler/parser)
       Compiling rustpython-parser v0.1.2 (https://github.com/RustPython/RustPython.git?rev=f1c7aebfad707526602c8162c8094a67129b6731#f1c7aebf)
    error: failed to run custom build command for `rustpython-parser v0.1.2 (/media/psf/Home/opensource/dvm/RustPython/compiler/parser)`
    
    Caused by:
      process didn't exit successfully: `/media/psf/Home/opensource/dvm/RustPython/target/release/build/rustpython-parser-acbe8425df4f499f/build-script-build` (exit status: 101)
      --- stdout
      cargo:rerun-if-changed=python.lalrpop
    
      --- stderr
      thread 'main' panicked at 'no sha3 line?', compiler/parser/build.rs:34:10
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    warning: build failed, waiting for other jobs to finish...
    error: failed to run custom build command for `rustpython-parser v0.1.2 (/media/psf/Home/opensource/dvm/RustPython/compiler/parser)`
    
    Caused by:
      process didn't exit successfully: `/media/psf/Home/opensource/dvm/RustPython/target/release/build/rustpython-parser-acbe8425df4f499f/build-script-build` (exit status: 101)
      --- stdout
      cargo:rerun-if-changed=python.lalrpop
    
      --- stderr
      thread 'main' panicked at 'no sha3 line?', compiler/parser/build.rs:34:10
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    
  9. youknowone commented on Sep 16, 2022

    @youknowone
    Member

    @imotai Could you please share the head of python.rs file your build generated? The file is compiler/parser/python.rs in RustPython directory.
    If you installed lalrpop binary, lalrpop -v will be also helpful.

  10. youknowone commented on Sep 16, 2022

    @youknowone
    Member

    Maybe still happening when using RustPython as dependency

  11. InnovativeInventor commented on Sep 20, 2022

    @InnovativeInventor

    Installing, then running lalrpop worked for me. FYI, the main branch, as of commit 683e5af does not build.

    Perhaps the build.rs file should be updated/fixed so builds will "just work"?

  12. williamdes commented on Sep 21, 2022

    @williamdes

    I am also affected by this, I wanted to build and install the project today to test it and followed:

    cargo install --git https://github.com/RustPython/RustPython

    But here is the cryptic error message, could not find any ressources on the net to fix it.

    The following warnings were emitted during compilation:
    
    warning: python.rs doesn't exist. regenerate.
    
    error: failed to run custom build command for `rustpython-parser v0.1.2 (/home/williamdes/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/683e5af/compiler/parser)`
    
    Caused by:
      process didn't exit successfully: `/tmp/cargo-installuFeYFo/release/build/rustpython-parser-ad7268f1df42728a/build-script-build` (exit status: 101)
      --- stdout
      cargo:rerun-if-changed=python.lalrpop
      cargo:warning=python.rs doesn't exist. regenerate.
    
      --- stderr
      thread 'main' panicked at 'try: cargo build --manifest-path=compiler/parser/Cargo.toml --features=lalrpop', compiler/parser/build.rs:80:5
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    warning: build failed, waiting for other jobs to finish...
    error: failed to compile `rustpython v0.1.2 (https://github.com/RustPython/RustPython#683e5aff)`, intermediate artifacts can be found at `/tmp/cargo-installuFeYFo`
    
  13. youknowone commented on Oct 6, 2026

    @youknowone
    Member

    The originally missing `parser/src/../python.rs` lalrpop include is gone: RustPython no longer has that parser crate and uses the ruff-based parser. Closing the original install failure.

    — commented by Grok 4.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions