Skip to content

Vanilla checkout as described in README does not work on Windows #2687

Open
@ralfbiedert

Description

@ralfbiedert

When using the project from another crate like so:

[dependencies]
rustpython = { git="https://github.com/RustPython/RustPython", features = ["freeze-stdlib"] }

it compiles on Windows as expected. However, when following the instructions from the README I get:

❯ git clone https://github.com/RustPython/RustPython/
Cloning into 'RustPython'...
remote: Enumerating objects: 60281, done.
remote: Counting objects: 100% (3247/3247), done.
remote: Compressing objects: 100% (1325/1325), done.
remote: Total 60281 (delta 2299), reused 2742 (delta 1910), pack-reused 57034
Receiving objects: 100% (60281/60281), 41.83 MiB | 7.18 MiB/s, done.
Resolving deltas: 100% (47125/47125), done.

❯ cd RustPython

❯ cargo run --release demo.py
[...]
Compiling rustpython-compiler-core v0.1.2 (D:\Development\Source\_thirdparty\RustPython\compiler)
Compiling rustpython-compiler v0.1.2 (D:\Development\Source\_thirdparty\RustPython\compiler\porcelain)
Compiling rustpython-derive v0.1.2 (D:\Development\Source\_thirdparty\RustPython\derive)
Compiling rustpython v0.1.2 (D:\Development\Source\_thirdparty\RustPython)
Finished release [optimized] target(s) in 1m 40s
Running `target\release\rustpython.exe demo.py`
Error in sys.excepthook:
lost sys.stderr
RuntimeError: lost sys.stderr
Original exception was:
lost sys.stderr
ModuleNotFoundError: No module named 'encodings'

The above exception was the direct cause of the following exception:

RuntimeError: Could not import encodings. Is your RUSTPYTHONPATH set? If you don't have access to a consistent external environment (e.g. if you're embedding rustpython in another application), try enabling the freeze-stdlib feature
thread 'main' panicked at 'initializiation failed; exception backtrace above', vm\src\vm.rs:796:13
stack backtrace:
   0:     0x7ff6c26258ee - std::backtrace_rs::backtrace::dbghelp::trace
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
   1:     0x7ff6c26258ee - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff6c26258ee - std::sys_common::backtrace::_print_fmt
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:67
   3:     0x7ff6c26258ee - std::sys_common::backtrace::_print::{{impl}}::fmt
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:46
   4:     0x7ff6c263fa9c - core::fmt::write
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\core\src\fmt\mod.rs:1092
   5:     0x7ff6c261f6e8 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\io\mod.rs:1572
   6:     0x7ff6c262866d - std::sys_common::backtrace::_print
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:49
   7:     0x7ff6c262866d - std::sys_common::backtrace::print
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:36
   8:     0x7ff6c262866d - std::panicking::default_hook::{{closure}}
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:208
   9:     0x7ff6c2628139 - std::panicking::default_hook
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:225
  10:     0x7ff6c2628d13 - std::panicking::rust_panic_with_hook
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:591
  11:     0x7ff6c26288c1 - std::panicking::begin_panic_handler::{{closure}}
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:497
  12:     0x7ff6c262620f - std::sys_common::backtrace::__rust_end_short_backtrace<closure-0,!>
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\sys_common\backtrace.rs:141
  13:     0x7ff6c2628819 - std::panicking::begin_panic_handler
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:493
  14:     0x7ff6c265de4c - std::panicking::begin_panic_fmt
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:435
  15:     0x7ff6c1eab29d - rustpython_vm::vm::VirtualMachine::_py_panic_failed::hf482eedd9c2df4a8
  16:     0x7ff6c1eab399 - rustpython_vm::vm::VirtualMachine::_py_panic_failed::hf482eedd9c2df4a8
  17:     0x7ff6c1ea64a0 - rustpython_vm::vm::VirtualMachine::initialize::h3c1b010e8fcf5460
  18:     0x7ff6c1c384f4 - rustpython::run::h1589eca2ee14c07a
  19:     0x7ff6c1c32c29 - core::ptr::drop_in_place<rustpython_vm::pyobject::PyLease<rustpython_vm::builtins::pytype::PyType>>::h60119f3c6a2b5bd3
  20:     0x7ff6c1c31c66 - std::sys_common::backtrace::__rust_begin_short_backtrace::h4fa136964e9a80d8
  21:     0x7ff6c1c32c6c - std::rt::lang_start::{{closure}}::h40e656a3d375a977
  22:     0x7ff6c2628ff7 - core::ops::function::impls::{{impl}}::call_once
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\library\core\src\ops\function.rs:280
  23:     0x7ff6c2628ff7 - std::panicking::try::do_call
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:379
  24:     0x7ff6c2628ff7 - std::panicking::try
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:343
  25:     0x7ff6c2628ff7 - std::panic::catch_unwind
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panic.rs:431
  26:     0x7ff6c2628ff7 - std::rt::lang_start_internal
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\rt.rs:51
  27:     0x7ff6c1c32c57 - main
  28:     0x7ff6c264ef2c - invoke_main
                               at d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  29:     0x7ff6c264ef2c - __scrt_common_main_seh
                               at d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  30:     0x7ff8b7727034 - BaseThreadInitThunk
  31:     0x7ff8b78c2651 - RtlUserThreadStart
error: process didn't exit successfully: `target\release\rustpython.exe demo.py` (exit code: 101)

Using:

rustc 1.52.1 (9bc8c42bb 2021-05-09)
binary: rustc
commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
commit-date: 2021-05-09
host: x86_64-pc-windows-msvc
release: 1.52.1
LLVM version: 12.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions