Offline (non-Internet-connected) systems may experience failures on installing Python packages. The package authors may not have CI setup for an offline test case, so they don’t realize it’s an issue. In general, Python packages can use setup.py, setup.cfg and pyproject.toml more effectively in a Python-standard way to overcome these issues.
Install package before setup.py
Instead of telling users to manually install a package such as Numpy that’s required before fully running setup.py, use pyproject.toml instead of setuptools setup_requires. This is because currently, setuptools assumes the computer will be internet-connected and even if the package is already installed, setup.py will fail on an offline system.
good example (most reliable and standard)
To ensure a package like Numpy is installed before setup.py fully runs, for example where
f2py is used,
pyproject.toml file including:
[build-system] requires = ["setuptools", "wheel", "numpy"]
This will auto-install the prereqs before setup.py runs.
When including this pyproject.toml parameter, do not omit “setuptools”, “wheel” or the package may fail to install. PEP517 assumes unless told otherwise:
[build-system] requires = ["setuptools", "wheel"]
such as by omitting them in a pyproject.toml file.
bad example (don’t do this)
These may fail on non-internet-connected systems, even if Numpy is already installed:
[options] setup_requires = numpy