Skip to content

Install

feu.install

Contain utility functions to install packages.

feu.install.BaseInstaller

Bases: ABC

Define the base class to implement a package installer.

feu.install.BaseInstaller.install abstractmethod

install(version: str) -> None

Install the given package version.

Parameters:

Name Type Description Default
version str

The target version to install.

required

feu.install.DefaultInstaller

Bases: BaseInstaller

Implement a generic package installer.

Parameters:

Name Type Description Default
package str

The name of the package to install.

required

feu.install.JaxInstaller

Bases: BaseInstaller

Implement the jax package installer.

numpy 2.0 support was added in jax 0.4.26.

feu.install.MatplotlibInstaller

Bases: Numpy2Installer

Implement the matplotlib package installer.

numpy 2.0 support was added in matplotlib 3.8.4.

feu.install.Numpy2Installer

Bases: BaseInstaller

Define a package installer to install package that did not pin numpy<2.0 and are not fully compatible with numpy.

https://github.com/numpy/numpy/issues/26191 indicates the packages that are compatible with numpy 2.0.

Parameters:

Name Type Description Default
package str

The name of the package to install.

required
min_version str

The first version that is fully compatible with numpy 2.0.

required

feu.install.PackageInstaller

Implement the main package installer.

feu.install.PackageInstaller.add_installer classmethod

add_installer(
    package: str,
    installer: BaseInstaller,
    exist_ok: bool = False,
) -> None

Add an installer for a given package.

Parameters:

Name Type Description Default
package str

The package name.

required
installer BaseInstaller

The installer used for the given package.

required
exist_ok bool

If False, RuntimeError is raised if the package already exists. This parameter should be set to True to overwrite the installer for a package.

False

Raises:

Type Description
RuntimeError

if an installer is already registered for the package name and exist_ok=False.

Example usage:

>>> from feu.install import PackageInstaller, PandasInstaller
>>> PackageInstaller.add_installer("pandas", PandasInstaller(), exist_ok=True)

feu.install.PackageInstaller.has_installer classmethod

has_installer(package: str) -> bool

Indicate if an installer is registered for the given package.

Parameters:

Name Type Description Default
package str

The package name.

required

Returns:

Type Description
bool

True if an installer is registered, otherwise False.

Example usage:

>>> from feu.install import PackageInstaller
>>> PackageInstaller.has_installer("pandas")

feu.install.PackageInstaller.install classmethod

install(package: str, version: str) -> None

Install a package and associated packages.

Parameters:

Name Type Description Default
package str

The package name e.g. 'pandas'.

required
version str

The target version to install.

required

Example usage:

>>> from feu.install import PackageInstaller
>>> PackageInstaller().install("pandas", "2.2.2")  # doctest: +SKIP

feu.install.PandasInstaller

Bases: Numpy2Installer

Implement the pandas package installer.

numpy 2.0 support was added in pandas 2.2.2.

feu.install.PyarrowInstaller

Bases: Numpy2Installer

Implement the pyarrow package installer.

numpy 2.0 support was added in pyarrow 16.0.

feu.install.ScipyInstaller

Bases: Numpy2Installer

Implement the scipy package installer.

numpy 2.0 support was added in scipy 1.13.0.

feu.install.SklearnInstaller

Bases: Numpy2Installer

Implement the sklearn package installer.

numpy 2.0 support was added in sklearn 1.4.2.

feu.install.TorchInstaller

Bases: Numpy2Installer

Implement the torch package installer.

numpy 2.0 support was added in torch 2.3.0.

feu.install.XarrayInstaller

Bases: Numpy2Installer

Implement the xarray package installer.

numpy 2.0 support was added in xarray 2024.6.0.

feu.install.install_package

install_package(package: str, version: str) -> None

Install a package and associated packages.

Parameters:

Name Type Description Default
package str

The package name e.g. 'pandas'.

required
version str

The target version to install.

required

Example usage:

>>> from feu import install_package
>>> install_package("pandas", "2.2.2")  # doctest: +SKIP

feu.install.run_bash_command

run_bash_command(cmd: str) -> None

Execute a bash command.

Parameters:

Name Type Description Default
cmd str

The command to run.

required