0
$\begingroup$

I'd like to use XGBoost in SciKit-Learn, however, I'm on an Air-Gapped computer and can't install it normally using pip.

How can I install XGBoost on an air-gapped computer?

$\endgroup$

1 Answer 1

0
$\begingroup$

If you're on an air-gapped computer there are a few things to consider.

  1. What version of Python are you using?
  2. What Python packages do you have available to you?
  3. What are your Python package versions?

For example, XGBoost has dependencies, if you don't have any of those dependencies you'll have to repeat the process I detail below for all those packages too. If you follow the process below, and you're missing a package, the pip installer will let you know!

As far as I'm aware, the only packages XGBoost relies on are:

Assuming you have all dependencies

Assuming you're air-gapped computer has all of XGBoost's dependencies, this is what you need to do.

Figure out which of XGBoosts dependencies is the most out of date. To do this you can check the package's version using the pip list on the command line. This will give you output that looks like the following:

pip list output.

Go onto PyPi and search the package's name. On the package's page look for its release history (in the left-hand side bar) and see what date your version was published. E.g. for numpy I can see the most recent release was published on 26/12/2022.

Numpy release history on PyPi

Once you know which of your packages is the oldest, go to the PyPi page for XGBoost, look at its release history, and click on the release that falls closest to your oldest package. Say your oldest package is a version released around January 2022, in the picture below you'd click on XGBoost 1.5.2.

XGBoost release history.

You do this in case later versions of XGBoost rely on improvements to its dependent packages that don't exist in your current versions.

Once you've selected the right release you can go to its download section.

Download options for XGBoost 1.5.2

You're presented with the option to download from source or download a built distribution. The built distributions are .whl (wheel) files, which are Python's way of simplifying package distribution. If you want to know more about wheels, Real Python have a great overview. You don't need to understand the naming scheme, but it does help you select the right distribution.

However, if you don't want to go too deep into wheels, download the amd64 distribution if your air-gapped PC is a windows PC, if you have an air-gapped Linux PC find out your computer's architecture (x86_64 vs aarch64) and download the corresponding manylinux distribution, and if you have an air-gapped MAC download the macosx distribution (newer versions have two options, one for MAC's arm64 chipset, and another for its x86_64 chipset).

Finally, put your .whl file onto a memory stick and transfer it to your air-gapped computer. Load up a terminal, locate your file, and type out the following command:

> pip install your-wheel-distribution-here

This should install the package and you're ready to use XGBoost!

Troubleshooting

If the last part of the process fails try asking questions on Stack Overflow. If you still run into issues you might have to install XGBoost from its source distribution. This process is exactly the same, transfer the source file to the air-gapped machine and use the pip install your-source-distribution-here. This will take longer as pip has to build the wheel file itself, but should still work.

If even that fails, then you're left with building XGBoost from source yourself, which is discussed in the XGBoost documentation (good luck!).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.