Skip to content

Commit

Permalink
Add Python 3.10 & Remove prophet dependency (#1023)
Browse files Browse the repository at this point in the history
* Remove prophet dependency

* remove task pip_prophet

* remove prophet from dev-all

* remove Prophet from FFT notebook

* remove Prophet from quickstart notebook

* Add 3.10 to merge workflow matrix
  • Loading branch information
hrzn authored Jun 21, 2022
1 parent 524a28b commit 32d6b93
Show file tree
Hide file tree
Showing 10 changed files with 367 additions and 213 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
python-version: [3.7, 3.8, 3.9]
python-version: [3.8, 3.9, 3.10]
flavour: ['core', 'torch', 'all']

steps:
Expand Down
26 changes: 15 additions & 11 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# Installation Guide

Some of the models depend on `prophet` and `torch`, which have non-Python dependencies.
A Conda environment is thus recommended because it will handle all of those in one go.
Below, we detail how to install Darts using either `conda` or `pip`.

## From conda-forge
Currently only the x86_64 architecture with Python 3.7-3.9
Currently only the x86_64 architecture with Python 3.7-3.10
is fully supported with conda; consider using PyPI if you are running into troubles.

To create a conda environment for Python 3.7
To create a conda environment for Python 3.9
(after installing [conda](https://docs.conda.io/en/latest/miniconda.html)):

conda create --name <env-name> python=3.7
conda create --name <env-name> python=3.9

Don't forget to activate your virtual environment

Expand All @@ -20,24 +19,22 @@ As some models have relatively heavy dependencies, we provide two conda-forge pa

* Install darts with all available models (recommended): `conda install -c conda-forge -c pytorch u8darts-all`.
* Install core + neural networks (PyTorch): `conda install -c conda-forge -c pytorch u8darts-torch`
* Install core only (without neural networks, Prophet or AutoARIMA): `conda install -c conda-forge u8darts`
* Install core only (without neural networks or AutoARIMA): `conda install -c conda-forge u8darts`

For GPU support, please follow the instructions to install CUDA in the [PyTorch installation guide](https://pytorch.org/get-started/locally/).


## From PyPI
Install darts with all available models: `pip install darts`.

If this fails on your platform, please follow the official installation guides for
[prophet](https://facebook.github.io/prophet/docs/installation.html#python)
and [torch](https://pytorch.org/get-started/locally/), then try installing Darts again.
If this fails on your platform, please follow the official installation
guide for [PyTorch](https://pytorch.org/get-started/locally/), then try installing Darts again.

As some models have relatively heavy (or non-Python) dependencies,
As some dependencies are relatively big or involve non-Python dependencies,
we also maintain the `u8darts` package, which provides the following alternate lighter install options:

* Install core only (without neural networks, Prophet or AutoARIMA): `pip install u8darts`
* Install core + neural networks (PyTorch): `pip install "u8darts[torch]"`
* Install core + Facebook Prophet: `pip install "u8darts[prophet]"`
* Install core + AutoARIMA: `pip install "u8darts[pmdarima]"`

### Enabling Support for LightGBM
Expand All @@ -59,6 +56,13 @@ brew unlink libomp
brew install libomp.rb
```

## Enabling support for Facebook Prophet
We removed Facebook Prophet as a dependency of Darts (at least for the time being), due to its dependency
on PyStan and the complex installation this entails. In order to use the `Prophet` model in Darts, we
recommend you follow the [Prophet installation instructions](https://facebook.github.io/prophet/docs/installation.html)
and install the prophet package in your environment (the command
`from darts.models import Prophet` will work once the package is installed).
At the time of writing, this has been tested with `prophet 1.0.1`.

## Running the examples only, without installing:

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ task pipInstall() {
doFirst {
setupPip
}
dependsOn pip_core, pip_dev, pip_prophet, pip_pmdarima, pip_torch, pip_release
dependsOn pip_core, pip_dev, pip_pmdarima, pip_torch, pip_release
}

task lint_black(type: Exec) {
Expand Down
7 changes: 5 additions & 2 deletions darts/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@
try:
from darts.models.forecasting.prophet_model import Prophet
except ModuleNotFoundError:
pass
"""
logger.info(
"Support for Facebook Prophet is not available. "
'To enable it, install "darts", "u8darts[prophet]" or "u8darts[all]" (with pip);'
'or "u8darts-all" (with conda).'
"To enable it, install the prophet package in your environment; see "
"https://facebook.github.io/prophet/docs/installation.html"
)
"""

try:
from darts.models.forecasting.block_rnn_model import BlockRNNModel
Expand Down
519 changes: 337 additions & 182 deletions examples/00-quickstart.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/03-FFT-examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"\n",
"\n",
"from darts import TimeSeries\n",
"from darts.models import FFT, AutoARIMA, ExponentialSmoothing, Prophet, Theta\n",
"from darts.models import FFT, AutoARIMA, ExponentialSmoothing, Theta\n",
"from darts.metrics import mae\n",
"from darts.utils.missing_values import fill_missing_values\n",
"from darts.datasets import TemperatureDataset, AirPassengersDataset, EnergyDataset\n",
Expand Down Expand Up @@ -471,7 +471,7 @@
}
],
"source": [
"models = [AutoARIMA(), Prophet(), ExponentialSmoothing(), Theta(), FFT()]\n",
"models = [AutoARIMA(), ExponentialSmoothing(), Theta(), FFT()]\n",
"\n",
"for model in models:\n",
" model.fit(train)\n",
Expand All @@ -496,7 +496,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down
1 change: 0 additions & 1 deletion requirements/dev-all.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
-r core.txt
-r dev.txt
-r prophet.txt
-r pmdarima.txt
-r release.txt
-r torch.txt
2 changes: 0 additions & 2 deletions requirements/prophet.txt

This file was deleted.

4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ def read_requirements(path):
base_reqs = read_requirements("requirements/core.txt")
pmdarima_reqs = read_requirements("requirements/pmdarima.txt")
torch_reqs = read_requirements("requirements/torch.txt")
prophet_reqs = read_requirements("requirements/prophet.txt")

all_reqs = base_reqs + pmdarima_reqs + torch_reqs + prophet_reqs
all_reqs = base_reqs + pmdarima_reqs + torch_reqs

with open("README.md") as fh:
LONG_DESCRIPTION = fh.read()
Expand Down Expand Up @@ -60,6 +59,7 @@ def read_requirements(path):
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: PyPy",
],
keywords="time series forecasting",
Expand Down
11 changes: 3 additions & 8 deletions setup_u8darts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ def read_requirements(path):
base_reqs = read_requirements("requirements/core.txt")
pmdarima_reqs = read_requirements("requirements/pmdarima.txt")
torch_reqs = read_requirements("requirements/torch.txt")
prophet_reqs = read_requirements("requirements/prophet.txt")

all_reqs = base_reqs + pmdarima_reqs + torch_reqs + prophet_reqs
all_reqs = base_reqs + pmdarima_reqs + torch_reqs

with open("README.md") as fh:
LONG_DESCRIPTION = fh.read()
Expand Down Expand Up @@ -41,12 +40,7 @@ def read_requirements(path):
license="Apache License 2.0",
packages=find_packages(),
install_requires=base_reqs,
extras_require={
"all": all_reqs,
"pmdarima": pmdarima_reqs,
"torch": torch_reqs,
"prophet": prophet_reqs,
},
extras_require={"all": all_reqs, "pmdarima": pmdarima_reqs, "torch": torch_reqs},
package_data={
"darts": ["py.typed"],
},
Expand All @@ -66,6 +60,7 @@ def read_requirements(path):
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: PyPy",
],
keywords="time series forecasting",
Expand Down

0 comments on commit 32d6b93

Please sign in to comment.