business-science / modeltime.gluonts

GluonTS Deep Learning with Modeltime
https://business-science.github.io/modeltime.gluonts/
Other
39 stars 9 forks source link

Win: installation issue: ERROR: Cannot install because these package versions have conflicting dependencies. #32

Closed VladPerervenko closed 3 years ago

VladPerervenko commented 3 years ago
  1. [Option 1 - Use a Pre-Configured Environment]: Use install_gluonts() to install GluonTS Python Dependencies into a conda environment named r-gluonts. modeltime.gluonts::install_gluonts(fresh_install = TRUE, include_pytorch = TRUE) i Removing conda envr-gluonts` to setup for fresh install...

Package Plan

environment location: C:\Users\User\AppData\Local\R-MINI~1\envs\r-gluonts

The following packages will be REMOVED:

certifi-2021.5.30-py37haa95532_0 pip-21.1.3-pyhd8ed1ab_0 python-3.7.1-h9460c21_1003 python_abi-3.7-2_cp37m setuptools-49.6.0-py37h03978a9_3 ucrt-10.0.20348.0-h57928b3_0 vc-14.2-hb210afc_5 vs2015_runtime-14.29.30037-h902a5da_5 wheel-0.36.2-pyhd3deb0d_0 wincertstore-0.2-py37h03978a9_1006

Preparing transaction: ...working... done Verifying transaction: ...working... done Executing transaction: ...working... done

Remove all packages in environment C:\Users\User\AppData\Local\R-MINI~1\envs\r-gluonts:

i Installing gluonts python dependencies...

Collecting package metadata (current_repodata.json): ...working... done Solving environment: ...working... failed with repodata from current_repodata.json, will retry with next repodata source. Collecting package metadata (repodata.json): ...working... done Solving environment: ...working... done

Package Plan

environment location: C:\Users\User\AppData\Local\R-MINI~1\envs\r-gluonts

added / updated specs:

The following NEW packages will be INSTALLED:

certifi conda-forge/win-64::certifi-2021.5.30-py37h03978a9_0 pip conda-forge/noarch::pip-21.1.3-pyhd8ed1ab_0 python conda-forge/win-64::python-3.7.1-h9460c21_1003 python_abi conda-forge/win-64::python_abi-3.7-2_cp37m setuptools conda-forge/win-64::setuptools-49.6.0-py37h03978a9_3 ucrt conda-forge/win-64::ucrt-10.0.20348.0-h57928b3_0 vc conda-forge/win-64::vc-14.2-hb210afc_5 vs2015_runtime conda-forge/win-64::vs2015_runtime-14.29.30037-h902a5da_5 wheel conda-forge/noarch::wheel-0.36.2-pyhd3deb0d_0 wincertstore conda-forge/win-64::wincertstore-0.2-py37h03978a9_1006

Preparing transaction: ...working... done Verifying transaction: ...working... done Executing transaction: ...working... done #

Collecting package metadata (current_repodata.json): ...working... done Solving environment: ...working... done

Package Plan

environment location: C:\Users\User\AppData\Local\R-MINI~1\envs\r-gluonts

added / updated specs:

The following packages will be SUPERSEDED by a higher-priority channel:

certifi conda-forge::certifi-2021.5.30-py37h0~ --> pkgs/main::certifi-2021.5.30-py37haa95532_0

Preparing transaction: ...working... done Verifying transaction: ...working... done Executing transaction: ...working... done Collecting mxnet>=1.7 Using cached mxnet-1.7.0.post2-py2.py3-none-win_amd64.whl (33.1 MB) Collecting gluonts==0.8.0 Using cached gluonts-0.8.0-py3-none-any.whl (2.1 MB) Collecting numpy==1.17.2 Using cached numpy-1.17.2-cp37-cp37m-win_amd64.whl (12.8 MB) Collecting pandas==1.0.5 Using cached pandas-1.0.5-cp37-cp37m-win_amd64.whl (8.7 MB) Collecting pathlib==1.0.1 Using cached pathlib-1.0.1.tar.gz (49 kB) Collecting ujson Using cached ujson-4.0.2-cp37-cp37m-win_amd64.whl (43 kB) Collecting torch==1.9.0 Downloading torch-1.9.0-cp37-cp37m-win_amd64.whl (222.0 MB) Collecting pytorch-lightning==1.3.8 Downloading pytorch_lightning-1.3.8-py3-none-any.whl (813 kB) Collecting pydantic~=1.1 Using cached pydantic-1.8.2-cp37-cp37m-win_amd64.whl (1.9 MB) Collecting holidays>=0.9 Using cached holidays-0.11.2-py3-none-any.whl (142 kB) Collecting tqdm~=4.23 Using cached tqdm-4.61.2-py2.py3-none-any.whl (76 kB) Collecting toolz~=0.10 Using cached toolz-0.11.1-py3-none-any.whl (55 kB) Collecting matplotlib~=3.0 Using cached matplotlib-3.4.2-cp37-cp37m-win_amd64.whl (7.1 MB) Collecting typing-extensions~=3.10.0.0 Using cached typing_extensions-3.10.0.0-py3-none-any.whl (26 kB) Collecting python-dateutil>=2.6.1 Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB) Collecting pytz>=2017.2 Using cached pytz-2021.1-py2.py3-none-any.whl (510 kB) Collecting torchmetrics>=0.2.0 Downloading torchmetrics-0.4.1-py3-none-any.whl (234 kB) Collecting tensorboard!=2.5.0,>=2.2.0 Downloading tensorboard-2.4.1-py3-none-any.whl (10.6 MB) Collecting PyYAML<=5.4.1,>=5.1 Downloading PyYAML-5.4.1-cp37-cp37m-win_amd64.whl (210 kB) Collecting pillow!=8.3.0 Using cached Pillow-8.3.1-1-cp37-cp37m-win_amd64.whl (3.2 MB) Collecting pyDeprecate==0.3.0 Downloading pyDeprecate-0.3.0-py3-none-any.whl (10 kB) Collecting future>=0.17.1 Using cached future-0.18.2.tar.gz (829 kB) Collecting fsspec[http]!=2021.06.0,>=2021.05.0 Downloading fsspec-2021.7.0-py3-none-any.whl (118 kB) Collecting packaging>=17.0 Downloading packaging-21.0-py3-none-any.whl (40 kB) Collecting requests<2.19.0,>=2.18.4 Using cached requests-2.18.4-py2.py3-none-any.whl (88 kB) Collecting graphviz<0.9.0,>=0.8.1 Using cached graphviz-0.8.4-py2.py3-none-any.whl (16 kB) Collecting mxnet>=1.7 Using cached mxnet-1.7.0.post1-py2.py3-none-win_amd64.whl (33.0 MB) INFO: pip is looking at multiple versions of pydeprecate to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of pytorch-lightning to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of torch to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of pathlib to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of pandas to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of numpy to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of gluonts to determine which version is compatible with other requirements. This could take a while. ERROR: Cannot install gluonts==0.8.0, mxnet==1.7.0.post1, mxnet==1.7.0.post2, numpy==1.17.2, pandas==1.0.5 and pytorch-lightning==1.3.8 because these package versions have conflicting dependencies.

The conflict is caused by: The user requested numpy==1.17.2 gluonts 0.8.0 depends on numpy~=1.16 pandas 1.0.5 depends on numpy>=1.13.3 pytorch-lightning 1.3.8 depends on numpy>=1.17.2 mxnet 1.7.0.post2 depends on numpy<1.17.0 and >=1.8.2 The user requested numpy==1.17.2 gluonts 0.8.0 depends on numpy~=1.16 pandas 1.0.5 depends on numpy>=1.13.3 pytorch-lightning 1.3.8 depends on numpy>=1.17.2 mxnet 1.7.0.post1 depends on numpy<1.17.0 and >=1.8.2

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies Error: Error installing package(s): "mxnet>=1.7", "gluonts==0.8.0", "numpy==1.17.2", "pandas==1.0.5", "pathlib==1.0.1", "ujson", "torch==1.9.0", "pytorch-lightning==1.3.8" x Installing gluonts python dependencies... ... failed`

-----------------------------------------------------------------

sysname release version
"Windows" "10 x64" "build 19043" R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"

-------------------------------------------------------------------

how to fix the installation?

mdancho84 commented 3 years ago

Windows installs can be challenging. Can you try installing an environment manually?

You can use:


reticulate::py_install(
    envname  = "r-gluonts",
    python_version = "3.7",
    packages = c(
        "mxnet",
        "gluonts==0.8.0",
        "pandas",
        "numpy",
        "pathlib"
    ),
    method = "conda",
    pip = TRUE
)
VladPerervenko commented 3 years ago

So did not pass. Installed like this: `(base) C:\Users\User>conda create -n r-gluonts1 python==3.7

environment location: C:\Users\User\AppData\Local\R-MINI~1\envs\r-gluonts1

(base) C:\Users\User>conda activate r-gluonts1 (r-gluonts1) C:\Users\User>pip install --upgrade mxnet~=1.7 gluonts

Successfully installed chardet-3.0.4 colorama-0.4.4 convertdate-2.3.2 cycler-0.10.0 gluonts-0.8.0 graphviz-0.8.4 hijri-converter-2.1.3 holidays-0.11.2 idna-2.6 kiwisolver-1.3.1 korean-lunar-calendar-0.2.1 matplotlib-3.4.2 mxnet-1.7.0.post2 numpy-1.16.6 pandas-1.1.5 pillow-8.3.1 pydantic-1.8.2 pymeeus-0.5.11 pyparsing-2.4.7 python-dateutil-2.8.2 pytz-2021.1 requests-2.18.4 six-1.16.0 toolz-0.11.1 tqdm-4.61.2 typing-extensions-3.10.0.0 urllib3-1.22

(r-gluonts1) C:\Users\User>pip install orjson `

VladPerervenko commented 3 years ago

Example in R. `reticulate::use_miniconda(condaenv = "r-gluonts1", required = TRUE) library(modeltime.gluonts) library(tidymodels) library(tidyverse)

Fit a GluonTS DeepAR Model

model_fit_deepar <- deep_ar( id = "id", freq = "M", prediction_length = 24, lookback_length = 48, epochs = 5 ) %>% set_engine("gluonts_deepar") %>% fit(value ~ ., training(m750_splits))

100%|██████████| 50/50 [00:05<00:00, 9.62it/s, epoch=1/5, avg_epoch_loss=8.12] 100%|██████████| 50/50 [00:04<00:00, 12.00it/s, epoch=2/5, avg_epoch_loss=7.61] 100%|██████████| 50/50 [00:04<00:00, 12.26it/s, epoch=3/5, avg_epoch_loss=7.45] 100%|██████████| 50/50 [00:04<00:00, 12.27it/s, epoch=4/5, avg_epoch_loss=7.39] 100%|██████████| 50/50 [00:04<00:00, 12.27it/s, epoch=5/5, avg_epoch_loss=7.31]

Forecast with 95% Confidence Interval

modeltime_table( model_fit_deepar ) %>% modeltime_calibrate(new_data = testing(m750_splits)) %>% modeltime_forecast( new_data = testing(m750_splits), actual_data = m750, conf_interval = 0.95 ) %>% plot_modeltime_forecast(.interactive = FALSE)

` Successfully completed

mdancho84 commented 3 years ago

OK, this is good information. Using the following commands you were able to get a successful installation:

Solution Update:

This issue has been resolved. The easiest way is to use:

install_gluonts(fresh_install = TRUE, include_pytorch = TRUE)

Alternative Solution

Using conda in terminal:

conda create -n r-gluonts1 python==3.7
pip install --upgrade mxnet~=1.7 gluonts
pip install orjson

The package versions that were successfully installed:

chardet-3.0.4 colorama-0.4.4 convertdate-2.3.2 cycler-0.10.0 gluonts-0.8.0 graphviz-0.8.4 hijri-converter-2.1.3 holidays-0.11.2 idna-2.6 kiwisolver-1.3.1 korean-lunar-calendar-0.2.1 matplotlib-3.4.2 mxnet-1.7.0.post2 numpy-1.16.6 pandas-1.1.5 pillow-8.3.1 pydantic-1.8.2 pymeeus-0.5.11 pyparsing-2.4.7 python-dateutil-2.8.2 pytz-2021.1 requests-2.18.4 six-1.16.0 toolz-0.11.1 tqdm-4.61.2 typing-extensions-3.10.0.0 urllib3-1.22

Todo:

I will attempt to enforce the package versions that make it easier to install on Windows. I believe Windows gets hung up with PIP searching for compatible packages. I'll run some windows tests.

VladPerervenko commented 3 years ago

Right. I think you can close it issue.

mdancho84 commented 3 years ago

OK, so I'm thinking the issue is mxnet >= 1.7 versus compatibility mxnet~=1.7. I have just revised. Can you try it and see if it works using the R command: install_gluonts(fresh = TRUE)?


One other point I saw. You will need pathlib if you intend to save GluonTS models. Please add that to your r-gluonts1 library using

pip install pathlib==1.0.1
mdancho84 commented 3 years ago

Before I close, please try:

remotes::install_github("business-science/modeltime.gluonts") # install latest version

# Install python r-gluonts env
install_gluonts(fresh_install = TRUE)
VladPerervenko commented 3 years ago

I try to install: `modeltime.gluonts::install_gluonts(fresh = TRUE)

Removing conda env r-gluonts to setup for fresh installation

The conflict is caused by: The user requested numpy==1.17.2 gluonts 0.8.0 depends on numpy~=1.16 pandas 1.0.5 depends on numpy>=1.13.3 mxnet 1.7.0.post2 depends on numpy<1.17.0 and >=1.8.2 The user requested numpy==1.17.2 gluonts 0.8.0 depends on numpy~=1.16 pandas 1.0.5 depends on numpy>=1.13.3 mxnet 1.7.0.post1 depends on numpy<1.17.0 and >=1.8.2

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies Error: Error installing package(s): "mxnet~=1.7", "gluonts==0.8.0", "numpy==1.17.2", "pandas==1.0.5", "pathlib==1.0.1", "ujson==4.0.2" x Installing gluonts python dependencies... ... failed`

You need to change the function install_gluonts() install_gluontsN <- function (fresh_install = FALSE)#, include_pytorch = FALSE) { if (!check_conda()) { return() } default_pkgs <- c("mxnet~=1.7", "gluonts==0.8.0", "ujson", "pathlib==1.0.1")

if (include_pytorch) {

#    default_pkgs <- c(default_pkgs, "torch==1.9.0", "pytorch-lightning==1.3.8")
#}
if (fresh_install) {
    cli::cli_alert_info("Removing conda env `r-gluonts` to setup for fresh install...")
    reticulate::conda_remove("r-gluonts")
}
cli::cli_process_start("Installing gluonts python dependencies...")
message("\n")
reticulate::py_install(packages = default_pkgs, envname = "r-gluonts", 
                       method = "conda", conda = "auto", python_version = "3.7.10", 
                       pip = TRUE)
if (!is.null(detect_default_gluonts_env())) {
    cli::cli_process_done(msg_done = "The {.field r-gluonts} conda environment has been created.")
    cli::cli_alert_info("Please restart your R Session and run {.code library(modeltime.gluonts)} to activate the {.field r-gluonts} environment.")
}
else {
    cli::cli_process_failed(msg_failed = "The {.field r-gluonts} conda environment could not be created.")
}

}

VladPerervenko commented 3 years ago

Installation torch==1.9.0 and pytorch-lightning==1.3.8 will occur conflict versions. Therefore, or mxnet or torch `(r-gluonts1) C:\Users\User>pip install torch==1.9.0 pytorch-lightning==1.3.8

Successfully built future Installing collected packages: pyasn1, charset-normalizer, zipp, rsa, requests, pyasn1-modules, oauthlib, multidict, cachetools, yarl, requests-oauthlib, importlib-metadata, google-auth, attrs, async-timeout, werkzeug, torch, tensorboard-plugin-wit, protobuf, packaging, numpy, markdown, grpcio, google-auth-oauthlib, fsspec, aiohttp, absl-py, torchmetrics, tensorboard, PyYAML, pyDeprecate, future, pytorch-lightning Attempting uninstall: requests Found existing installation: requests 2.18.4 Uninstalling requests-2.18.4: Successfully uninstalled requests-2.18.4 Attempting uninstall: numpy Found existing installation: numpy 1.16.6 Uninstalling numpy-1.16.6: Successfully uninstalled numpy-1.16.6 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. mxnet 1.7.0.post2 requires numpy<1.17.0,>=1.8.2, but you have numpy 1.21.1 which is incompatible. mxnet 1.7.0.post2 requires requests<2.19.0,>=2.18.4, but you have requests 2.26.0 which is incompatible. Successfully installed PyYAML-5.4.1 absl-py-0.13.0 aiohttp-3.7.4.post0 async-timeout-3.0.1 attrs-21.2.0 cachetools-4.2.2 charset-normalizer-2.0.3 fsspec-2021.7.0 future-0.18.2 google-auth-1.33.0 google-auth-oauthlib-0.4.4 grpcio-1.38.1 importlib-metadata-4.6.1 markdown-3.3.4 multidict-5.1.0 numpy-1.21.1 oauthlib-3.1.1 packaging-21.0 protobuf-3.17.3 pyDeprecate-0.3.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 pytorch-lightning-1.3.8 requests-2.26.0 requests-oauthlib-1.3.0 rsa-4.7.2 tensorboard-2.4.1 tensorboard-plugin-wit-1.8.0 torch-1.9.0 torchmetrics-0.4.1 werkzeug-2.0.1 yarl-1.6.3 zipp-3.5.0 `

mdancho84 commented 3 years ago

Ok, I see the issue. mxnet 1.7 is limiting numpy, which conflicts with torch. So, what I've done is upped mxnet~=1.8, which should resolve the numpy conflict with torch.

Please try:

remotes::install_github("business-science/modeltime.gluonts") # install latest version

# Install python r-gluonts env
install_gluonts(fresh_install = TRUE, include_pytorch = TRUE)
mdancho84 commented 3 years ago

Hang tight, I'm seeing errors on Windows now.

VladPerervenko commented 3 years ago

It is easier to spread the mxnet and torch in different environments and work with either one or the other. mxnet 1.8.0 is not yet available. Let's wait for mxnet 2.0.

mdancho84 commented 3 years ago

Right, I see that now. Apparently mxnet 1.8 is not available for Windows, which is unfortunate because it solves the numpy dependency issue.

Starting in gluonts 0.8.0, pytorch is integrated. So you will need both mxnet, torch, and pytorch_lightning in the same environment to access the Torch DeepAR.

mdancho84 commented 3 years ago

Ok, I believe I have fixed the Windows Installation Error here. https://github.com/business-science/modeltime.gluonts/commit/3dace46e04c0b560c86d17d24dd84e8f5b8cd491

The Test Passes on Windows here: https://github.com/business-science/modeltime.gluonts/runs/3107989676?check_suite_focus=true

I adjusted the requirements to be:

The easy way to set up is run this:

install_gluonts(fresh_install = TRUE, include_pytorch = TRUE)
mdancho84 commented 3 years ago

@VladPerervenko can you test that the install function works for you?

install_gluonts(fresh_install = TRUE, include_pytorch = TRUE)
VladPerervenko commented 3 years ago

moment

VladPerervenko commented 3 years ago

Try install: `remotes::install_github("business-science/modeltime.gluonts") modeltime.gluonts::install_gluonts(fresh_install = TRUE, include_pytorch = TRUE)

The conflict is caused by: The user requested numpy==1.17.2 gluonts 0.8.0 depends on numpy~=1.16 pandas 1.0.5 depends on numpy>=1.13.3 mxnet 1.7.0.post2 depends on numpy<1.17.0 and >=1.8.2 The user requested numpy==1.17.2 gluonts 0.8.0 depends on numpy~=1.16 pandas 1.0.5 depends on numpy>=1.13.3 mxnet 1.7.0.post1 depends on numpy<1.17.0 and >=1.8.2

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies Error: Error installing package(s): "mxnet~=1.7", "gluonts==0.8.0", "numpy==1.17.2", "pandas==1.0.5", "pathlib==1.0.1", "ujson==4.0.2", "torch~=1.6", "pytorch-lightning~=1.1"`

Can install numpy~=1.16?

VladPerervenko commented 3 years ago

With numpy 1.16, nothing is installed. It just hangs.

mdancho84 commented 3 years ago

That's it. I want to see if I can loosen numpy. Will take a bit since away from my computer.

VladPerervenko commented 3 years ago

Good. I will try only with the mxnet

Met0o commented 3 years ago

Got the same issue on my machine. Full reinstall of python and Anaconda followed by reboot does not resolve the problem.

Tried with install_gluonts(fresh_install = TRUE, include_pytorch = TRUE) as previously suggested but got the same error.

The conflict is caused by: The user requested numpy==1.17.2 gluonts 0.8.0 depends on numpy~=1.16 pandas 1.0.5 depends on numpy>=1.13.3 mxnet 1.7.0.post2 depends on numpy<1.17.0 and >=1.8.2

mdancho84 commented 3 years ago

Yes, this is due to numpy requirements for mxnet. I'll see if I can loosen the requirements. Hang tight.

Met0o commented 3 years ago

After few more attempts, I finally got it. Used the conda prompt and ran consecutively these commands:

conda create -n r-gluonts1 python==3.7 conda activate r-gluonts1 pip install --upgrade mxnet~=1.7 gluonts pip install orjson

The exact same steps failed twice before succeeding the third time.

It used to throw this error:

RuntimeError: Broken toolchain: cannot link a simple C program
----------------------------------------

Rolling back uninstall of numpy Moving to c:\programdata\anaconda3\lib\site-packages\numpy-1.20.3.dist-info\ from C:\ProgramData\Anaconda3\Lib\site-packages\~umpy-1.20.3.dist-info Moving to c:\programdata\anaconda3\lib\site-packages\numpy\ from C:\ProgramData\Anaconda3\Lib\site-packages\~umpy Moving to c:\programdata\anaconda3\scripts\f2py-script.py from C:\Users\metod\AppData\Local\Temp\pip-uninstall-18xopcm9\f2py-script.py Moving to c:\programdata\anaconda3\scripts\f2py.exe from C:\Users\metod\AppData\Local\Temp\pip-uninstall-18xopcm9\f2py.exe

I have no idea how it worked out at the end...

VladPerervenko commented 3 years ago

While you can use only with mxnet. By the way, it is impossible to use torch(R) insted of Torch(Python)?

mdancho84 commented 3 years ago

@Met0o I've just updated to allow numpy to be whatever version that PIP sees fit. I'm hopeful that it works now. I have tested on Windows, and it passes but so did the other tests. Please try:

install_gluonts(fresh_install = TRUE, include_pytorch = TRUE)

Testing passes on Windows.

Successfully installed PyYAML-5.4.1 absl-py-0.13.0 aiohttp-3.7.4.post0 async-timeout-3.0.1 attrs-21.2.0 cachetools-4.2.2 chardet-3.0.4 colorama-0.4.4 convertdate-2.3.2 cycler-0.10.0 fsspec-2021.7.0 future-0.18.2 gluonts-0.8.0 google-auth-1.33.1 google-auth-oauthlib-0.4.4 graphviz-0.8.4 grpcio-1.39.0 hijri-converter-2.1.3 holidays-0.11.2 idna-2.6 importlib-metadata-4.6.1 kiwisolver-1.3.1 korean-lunar-calendar-0.2.1 markdown-3.3.4 matplotlib-3.4.2 multidict-5.1.0 mxnet-1.7.0.post2 numpy-1.21.1 oauthlib-3.1.1 packaging-21.0 pandas-1.0.5 pathlib-1.0.1 pillow-8.3.1 protobuf-3.17.3 pyDeprecate-0.3.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 pydantic-1.8.2 pymeeus-0.5.11 pyparsing-2.4.7 python-dateutil-2.8.2 pytorch-lightning-1.3.8 pytz-2021.1 requests-2.18.4 requests-oauthlib-1.3.0 rsa-4.7.2 six-1.16.0 tensorboard-2.4.1 tensorboard-plugin-wit-1.8.0 toolz-0.11.1 torch-1.9.0 torchmetrics-0.4.1 tqdm-4.61.2 typing-extensions-3.10.0.0 ujson-4.0.2 urllib3-1.22 werkzeug-2.0.1 yarl-1.6.3 zipp-3.5.0

mdancho84 commented 3 years ago

While you can use only with mxnet. By the way, it is impossible to use torch(R) insted of Torch(Python)?

@VladPerervenko The R implementation is different than Pytorch. We can't use that because gluonts integrates Pytorch. So to use deep_ar() %>% set_engine("torch") then we need to have the Pytorch dependencies.

VladPerervenko commented 3 years ago

Installed in two stages:

  1. install_gluonts(fresh_install = TRUE, include_pytorch = FALSE)
  2. (r-gluonts) C:\Users\User>pip install --user torch pytorch-lightning Successfully installed PyYAML-5.4.1 absl-py-0.13.0 aiohttp-3.7.4.post0 fsspec-2021.7.0 future-0.18.2 google-auth-oauthlib-0.4.4 grpcio-1.39.0 markdown-3.3.4 pyDeprecate-0.3.0 pytorch-lightning-1.3.8 tensorboard-2.4.1 torchmetrics-0.4.1

All examples were performed 'accuracy_tbl %>% group_by(id) %>% slice_min(rmse) A tibble: 7 x 10

Groups: id [7]

.model_id .model_desc .type id mae mape mase smape rmse rsq

1 4 GP FORECASTER Test 1_1 2600. 14.2 2.35 13.0 3649. 0.154 2 1 DEEPAR Test 1_3 3289. 15.8 0.850 16.4 6392. 0.696 3 1 DEEPAR Test 1_8 2282. 5.89 1.09 6.11 2570. 0.528 4 1 DEEPAR Test 1_13 1300. 3.20 0.553 3.24 1560. 0.607 5 4 GP FORECASTER Test 1_38 6214. 8.50 0.741 7.95 8517. 0.152 6 1 DEEPAR Test 1_93 3128. 3.88 0.311 3.95 4200. 0.781 7 2 DEEPSTATE Test 1_95 4314. 3.29 0.571 3.32 5530. 0.554` Most likely a mistake here `if (include_pytorch) { default_pkgs <- c(default_pkgs, "torch~=1.6", "pytorch-lightning~=1.1") }` Maybe you need `if (include_pytorch) { default_pkgs <- c(default_pkgs, "torch~=1.9.0", "pytorch-lightning~=1.3.8") }` The main thing is all working
mdancho84 commented 3 years ago

Interesting. What version of numpy was installed?

VladPerervenko commented 3 years ago

Not understood. Version of what?

Versions of all installed packages '(r-gluonts) C:\Users\User>conda list packages in environment at C:\Users\User\AppData\Local\R-MINI~1\envs\r-gluonts:

Name Version Build Channel async-timeout 3.0.1 pypi_0 pypi attrs 21.2.0 pypi_0 pypi cachetools 4.2.2 pypi_0 pypi certifi 2021.5.30 py37haa95532_0 chardet 3.0.4 pypi_0 pypi charset-normalizer 2.0.3 pypi_0 pypi colorama 0.4.4 pypi_0 pypi convertdate 2.3.2 pypi_0 pypi cycler 0.10.0 pypi_0 pypi gluonts 0.8.0 pypi_0 pypi google-auth 1.33.1 pypi_0 pypi hijri-converter 2.1.3 pypi_0 pypi holidays 0.11.2 pypi_0 pypi idna 2.6 pypi_0 pypi importlib-metadata 4.6.1 pypi_0 pypi kiwisolver 1.3.1 pypi_0 pypi korean-lunar-calendar 0.2.1 pypi_0 pypi matplotlib 3.4.2 pypi_0 pypi multidict 5.1.0 pypi_0 pypi mxnet 1.7.0.post2 pypi_0 pypi numpy 1.21.1 pypi_0 pypi oauthlib 3.1.1 pypi_0 pypi packaging 21.0 pypi_0 pypi pandas 1.0.5 pypi_0 pypi pathlib 1.0.1 pypi_0 pypi pillow 8.3.1 pypi_0 pypi pip 21.1.3 pyhd8ed1ab_0 conda-forge protobuf 3.17.3 pypi_0 pypi pyasn1 0.4.8 pypi_0 pypi pyasn1-modules 0.2.8 pypi_0 pypi pydantic 1.8.2 pypi_0 pypi pymeeus 0.5.11 pypi_0 pypi pyparsing 2.4.7 pypi_0 pypi python 3.7.1 h9460c21_1003 conda-forge python-dateutil 2.8.2 pypi_0 pypi python-graphviz 0.8.4 pypi_0 pypi python_abi 3.7 2_cp37m conda-forge pytz 2021.1 pypi_0 pypi requests 2.26.0 pypi_0 pypi requests-oauthlib 1.3.0 pypi_0 pypi rsa 4.7.2 pypi_0 pypi setuptools 49.6.0 py37h03978a9_3 conda-forge six 1.16.0 pypi_0 pypi tensorboard-plugin-wit 1.8.0 pypi_0 pypi toolz 0.11.1 pypi_0 pypi torch 1.9.0 pypi_0 pypi tqdm 4.61.2 pypi_0 pypi typing-extensions 3.10.0.0 pypi_0 pypi ucrt 10.0.20348.0 h57928b3_0 conda-forge ujson 4.0.2 pypi_0 pypi urllib3 1.22 pypi_0 pypi vc 14.2 hb210afc_5 conda-forge vs2015_runtime 14.29.30037 h902a5da_5 conda-forge werkzeug 2.0.1 pypi_0 pypi wheel 0.36.2 pyhd3deb0d_0 conda-forge wincertstore 0.2 py37h03978a9_1006 conda-forge yarl 1.6.3 pypi_0 pypi zipp 3.5.0 pypi_0 pypi'

mdancho84 commented 3 years ago

@VladPerervenko Sorry about that... I was responding from my phone. This was perfect though! I wanted to check out your numpy version and how it was installed.

I have tested this latest fix on my local Windows OS. I ran into similar issues as you. I have found a solution, which is incorporated in the fix.

I have now updated the install_gluonts() function to split the installation into stages:

  1. Install gluonts and mxnet - For windows users, mxnet 1.7.0.post2 requires numpy<1.17.0,>=1.8.2
  2. Install torch and pytorch-lightning - This requires numpy >= 1.17.2

What now happens is you'll get a PIP error message indicating the dependency resolver doesn't take into account all the packages that are installed.

But, this is OK. The full functionality will work.

Simply run:

install_gluonts(fresh_install = TRUE, include_pytorch = TRUE)

Once installed, then restart your R-Session. Load modeltime.gluonts and you are good to go.

VladPerervenko commented 3 years ago

Everything was installed, all examples were executed. The question can be closed?

mdancho84 commented 3 years ago

That's great to hear. I will close.