-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Python bindings fail to build without internet connection #5979
Comments
Thanks for the report! I actually just experienced the same as well two days ago, trying to build while on a plane. I'll put up a PR momentarily to allow optionally passing through To make progress without waiting for that, you could patch your copy of this project's --- a/build-python.sh
+++ b/build-python.sh
@@ -179,7 +179,7 @@ while [ $# -gt 0 ]; do
shift
done
-pip install --prefer-binary 'build>=0.10.0'
+# pip install --prefer-binary 'build>=0.10.0'
# create a new directory that just contains the files needed
# to build the Python package
@@ -344,6 +344,7 @@ if test "${BUILD_WHEEL}" = true; then
echo "--- building wheel ---"
rm -f ../dist/*.whl || true
python -m build \
+ --no-isolation \
--wheel \
--outdir ../dist \
${BUILD_ARGS} \ And then build as mentioned in #5977 (comment) sh build-python.sh bdist_wheel |
And thanks for coming to the repo to report these things, and for helping to make LightGBM usable by more people! We did not know that there were these FreeBSD ports of |
With this PR it still creates venv and fails because it can't download packages:
It should not create any isolated environment. Somehow virtually all other Python packages don't have such problem. |
What command did you run? I did not see that running the following in an environment without internet access. sh build-python.sh bdist_wheel --no-isolation
LightGBM is not just a Python package... it's a single source tree used to build a CLI, C++ shared library, Python package, R package, Java jar, and more... and as such, it's build system is different than pure-python projects |
It runs:
|
That's not what I'm asking for. What command did you run? To be as explicit as possible, here's what I just did to test this.
docker run \
--rm \
-it python:3.9 \
bash
apt-get update -y
apt-get install -y \
cmake
pip install --no-cache-dir \
build \
ninja \
pathspec \
pyproject_metadata \
scikit-build-core \
wheel
git clone \
--recursive \
--branch python/no-internet \
https://github.com/microsoft/LightGBM.git
cd ./LightGBM
sh ./build-python.sh bdist_wheel --no-isolation For me, that succeeded and did not print any logs about "creating venv isolated environment":
In an environment without access to the internet, and it built the wheel successfully. |
I build the FreeBSD port The way how I test it without internet access - is running in a virtual machine. Under the hood |
As of v4.0.0 of the project, LightGBM's Python package cannot just by built by If you want to build a custom wheel from sources in this repo, invoke the shell script at the root of the repo exactly as I did at #5979 (comment).
I'm sorry that the design decisions we've made have made it difficult for you to build FreeBSD ports. I can try to explain in greater detail why this project's build system is as it currently is. In response to changes outside of our control in upstream tools like You can read about the history of those changes in the following places (and all the other places linked from them):
I'm happy to help and to try to accommodate less-common use cases we hadn't considered with changes to the interface like #6042, but to be clear we have no plans to support My top priority is ensuring that LightGBM publishes correct, highly-portable source distributions and wheels of its Python package to package repositories like PyPI and conda-forge, so that for the majority of users running If you have a specific suggestion for how to do that in a way that reintroduces the ability to |
This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
Description
They build with the connection, but not in an isolated VM:
scikit-build-core-0.4.7 is already installed, which should be sufficient.
All packages are built in isolated VMs in most distros. For security reasons downloads aren't allowed.
How can we build Python bindings without internet connection?
Environment info
LightGBM version or commit hash: 4.0.0
Python-3.9
FreeBSD 13.2
The text was updated successfully, but these errors were encountered: