Skip to content

python3-sys build error on #110

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

Closed
Peter-Noble opened this issue Aug 6, 2017 · 6 comments
Closed

python3-sys build error on #110

Peter-Noble opened this issue Aug 6, 2017 · 6 comments

Comments

@Peter-Noble
Copy link

Hey, we're trying to build rust-cpython on windows and running into the following error:

C:\Users\johnr\Documents\CrowdMaster\rust\channel_world>cargo build Compiling utf8-ranges v0.1.3 Compiling winapi-build v0.1.1 Compiling winapi v0.2.8 Compiling cpython v0.1.0 (https://github.com/dgrunwald/rust-cpython.git#5395cd41) Compiling regex-syntax v0.3.9 Compiling memchr v0.1.11 Compiling kernel32-sys v0.2.2 Compiling aho-corasick v0.5.3 Compiling thread-id v2.0.0 Compiling thread_local v0.2.7 Compiling regex v0.1.80 Compiling python3-sys v0.1.3 (https://github.com/dgrunwald/rust-cpython.git#5395cd41) error: failed to run custom build command for python3-sys v0.1.3 (https://github.com/dgrunwald/rust-cpython.git#5395cd41)`
process didn't exit successfully: C:\Users\johnr\Documents\CrowdMaster\rust\target\debug\build\python3-sys-26c0bb845f0b7d10\b uild-script-build (exit code: 101)
--- stderr
thread 'main' panicked at 'called Result::unwrap() on an Err value: "failed to run python interpreter \"python3\" \"-c\" \"import sys; import sysconfig; print(sys.version_info[0:2]); print(sysconfig.get_config_var(\\\'LIBDIR\\\')); print(sysconfig .get_config_var(\\\'Py_ENABLE_SHARED\\\')); print(sysconfig.get_config_var(\\\'LDVERSION\\\') or \\\'%s%s\\\' % (sysconfig.get _config_var(\\\'py_version_short\\\'), sysconfig.get_config_var(\\\'DEBUG_EXT\\\') or \\\'\\\')); print(sys.exec_prefix);\":
The system cannot find the file specified. (os error 2)"', src\libcore\result.rs:860
note: Run with RUST_BACKTRACE=1 for a backtrace.`

Cargo.toml looks like this:
`[package]
name = "channel_world"
version = "0.1.0"
authors = ["Peter-Noble [email protected]"]

[lib]
name = "channel_world"
crate-type = ["cdylib"]

[dependencies.cpython]
version = "0.1.0"
default-features = false
features = ["python3-sys"]
git = "https://github.com/dgrunwald/rust-cpython.git"`

The same project builds correctly on Linux. Any help would be greatly appreciated.

@ssokolow
Copy link

ssokolow commented Aug 6, 2017

"failed to run python interpreter \"python3\" \"-c\" \"import sys; import sysconfig; print(sys.version_info[0:2]); print(sysconfig.get_config_var(\\\'LIBDIR\\\')); print(sysconfig .get_config_var(\\\'Py_ENABLE_SHARED\\\')); print(sysconfig.get_config_var(\\\'LDVERSION\\\') or \\\'%s%s\\\' % (sysconfig.get _config_var(\\\'py_version_short\\\'), sysconfig.get_config_var(\\\'DEBUG_EXT\\\') or \\\'\\\')); print(sys.exec_prefix);\":
The system cannot find the file specified. (os error 2)"

My first suspicion is that there's no python3.exe in the PATH on your machine.

What happens if you type python3 in a cmd.exe window?

@Peter-Noble
Copy link
Author

python3 works on cmd. It wasn't adding python3 to the path from the python installer (possibly because the executable is called python.exe rather than python3.exe?) so we had to add a file called python3.cmd to a directory in PATH which contains:
<path to python 3 executable> %*

@ssokolow
Copy link

ssokolow commented Aug 7, 2017

That's probably the source of your problem.

It's probably using Rust's Command::spawn, and, on Windows, that uses the CreateProcess API. The only thing it'll look for when given python3 is python3.exe.

(As I understand it, the behaviour you see in cmd.exe is provided by a higher-level API called ShellExecuteEx.)

Try making a copy of python.exe and naming it python3.exe to see if that works around the problem.

@Peter-Noble
Copy link
Author

Hey, sorry for the delay replying. Duplicating python.exe and renaming worked perfectly. Thanks for your help!

@zorbanaut
Copy link

python3.exe is not provided by python installer.
For me, prepending C:\Python36 to PATH has helped.

@theoctober19th
Copy link

I'm on macOS 13.2.1 (arm64) and just aliasing python to python3 worked for me.

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

No branches or pull requests

4 participants