indygreg / indygreg/PyOxidizer

Error building a Static Binary [Linux]

Open
#497 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
6.2k
Forks
256
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm trying to build a static binary on linux following instructions [here ](https://pyoxidizer.readthedocs.io/en/stable/pyoxidizer_packaging_static_linking.html)and it seems to fail. I've dug around old issues, but cound't really find a solution.

```
$ pyoxidizer build --target-triple x86_64-unknown-linux-musl
resolving 1 targets
resolving target install
resolving target exe
resolving Python distribution https://github.com/indygreg/python-build-standalone/releases/download/20211017/cpython-3.9.7-x86_64-unknown-linux-musl-noopt-20211017T1616.tar.zst (sha256=7a040bab9da2dbd52e0fe224d6484e5e1292aa5b2ef573f9eaa3224058ad7735)
Python distribution available at /home/ubuntu/.cache/pyoxidizer/python_distributions/cpython-3.9.7-x86_64-unknown-linux-musl-noopt-20211017T1616.tar.zst
reading data from Python distribution...
pip downloading to /tmp/pyoxidizer-pip-downloadnE6fVT
running python ["-m", "pip", "--disable-pip-version-check", "download", "--dest", "/tmp/pyoxidizer-pip-downloadnE6fVT", "--only-binary=:all:", "--platform=none", "--python-version=3.9.7", "--implementation=cp", "numpy", "scikit-learn", "scipy", "pandas", "networkx"]
ERROR: Could not find a version that satisfies the requirement numpy (from versions: none)
ERROR: No matching distribution found for numpy
error[PYOXIDIZER_PYTHON_EXECUTABLE]: calling pip download

Caused by:
command ["/home/ubuntu/.cache/pyoxidizer/python_distributions/python.7a040bab9da2/python/install/bin/python3.9", "-m", "pip", "--disable-pip-version-check", "download", "--dest", "/tmp/pyoxidizer-pip-downloadnE6fVT", "--only-binary=:all:", "--platform=none", "--python-version=3.9.7", "--implementation=cp", "numpy", "scikit-learn", "scipy", "pandas", "networkx"] exited with code 1
--> ./pyoxidizer.bzl:101:21
|
101 | for resource in exe.pip_download(["numpy", "scikit-learn", "scipy", "pandas", "networkx"]):
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PythonExecutable.pip_download()

error: calling pip download

Caused by:
command ["/home/ubuntu/.cache/pyoxidizer/python_distributions/python.7a040bab9da2/python/install/bin/python3.9", "-m", "pip", "--disable-pip-version-check", "download", "--dest", "/tmp/pyoxidizer-pip-downloadnE6fVT", "--only-binary=:all:", "--platform=none", "--python-version=3.9.7", "--implementation=cp", "numpy", "scikit-learn", "scipy", "pandas", "networkx"] exited with code 1
```

Here's the toolchain:

```
$ rustc --version
rustc 1.58.0 (02072b482 2022-01-11)
$ cargo --version
cargo 1.58.0 (7f08ace4f 2021-11-24)
$ musl-ldd --version
musl libc
Version 1.1.9
```

The dynamic executable builds fine with `pyoxidizer build`

My python code depends on a bunch of external modules (numpy, scipy, etc..) and I'm not sure if statically linking those is even supported.

Any help would be appreciated.

Thanks!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with pyoxidizer.bzl at line 101 and reproduce the `pyoxidizer build --target-triple x86_64-unknown-linux-musl` command using the static-linking documentation. Trace the `pip_download()` failure for numpy and the other listed modules, then establish whether these dependencies are supported for static builds and what the documented outcome should be.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python, rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.