elapid is accessible from pypi:
pip install elapid
It's also accessible from conda:
conda install -c conda-forge elapid
This should suffice for most linux/mac users, as there are builds available for most of the dependencies (
You can avoid both of them by using Windows Subsystem for Linux, which creates a linux environment on your Windows machine. If you're using an older version of Windows, see the options below.
Resolving geospatial dependencies¶
If you have
conda installed, use that to install elapid's dependencies:
conda create -n elapid python=3.8 -y conda activate elapid # or just `activate elapid` on windows conda install -y -c conda-forge geopandas rasterio rtree scikit-learn tqdm pip install elapid
Installing on Windows without conda¶
You can get Windows builds of several key geospatial packages using
pipwin, which installs wheels from an unofficial source:
pip install wheel pipwin pipwin install numpy pipwin install pandas pipwin install shapely pipwin install gdal pipwin install fiona pipwin install pyproj pipwin install six pipwin install rtree pip install geopandas pip install elapid
glmnet needs to be manually installed on Windows. But technically it's not required.
elapid was written to try and match the modeling framework of the R version of Maxent, maxnet.
maxnet uses an inhomogeneous Poisson process model, which fits penalized maximum likelihood models, and is handled by the package glmnet.
There is a python wrapper for glmnet, which is used by
elapid. But it has no Windows build, so it has to compile some fortran code on install. This means you need to have a fortran compiler running (like MinGW-w64 or Cygwin) if you want to install it (
pip install glmnet).
You can also checkout this GitHub issue to read about other people's solutions or contribute a better solution.
An important consideration¶
To simplify installing and working with
elapid, you can install the package and fit Maxent models with or without
glmnet. This is handled by fitting the maximum likelihood model with either
glmnet or with
The results are similar, but not the same. This is largely because of differences in how regularization is handled.
glmnet can handle arrays of regularization terms, which allows fine-scale control over the potential importance of different features. There are a series of calibrated defaults used by
elapid, which were originally defined in maxnet but have been updated in opinionated ways.
You can typically just assign a single value for regularization scores with
The differences are relatively small. When comparing models fit in
elapid models, the level of agreement was
r2 = 0.91 for glmnet models,
r2 = 0.85 for sklearn models.
Still, I recommend users try their best to install
glmnet if you're interested in maintaining fidelity to the other family of Maxent tools.