Skip to content

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

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

Open
charliermarsh opened this issue Aug 21, 2022 · 12 comments
Open

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

charliermarsh opened this issue Aug 21, 2022 · 12 comments

Comments

@charliermarsh
Copy link
Collaborator

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.

@youknowone
Copy link
Member

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

@youknowone
Copy link
Member

youknowone commented Aug 21, 2022

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" }

@charliermarsh
Copy link
Collaborator Author

That worked! Thank you.

@charliermarsh
Copy link
Collaborator Author

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

@ecpost
Copy link
Contributor

ecpost commented Aug 23, 2022

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" }

@charliermarsh
Copy link
Collaborator Author

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

@ecpost
Copy link
Contributor

ecpost commented Aug 23, 2022

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

@imotai
Copy link

imotai commented Sep 8, 2022

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

@youknowone
Copy link
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.

@youknowone
Copy link
Member

Maybe still happening when using RustPython as dependency

@InnovativeInventor
Copy link

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"?

@williamdes
Copy link

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`

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.

6 participants