darts icon indicating copy to clipboard operation
darts copied to clipboard

[QUESTION] Is there a recommended way to use darts with cpu version of pytorch ?

Open trya2l opened this issue 5 months ago • 3 comments

Hello,

I have this use case where I need to use darts with PyTorch, but I do not have access/need for a GPU.

I was able to install darts with PyTorch CPU version with

pip install u8darts 
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install pytorch_lightning

Is there a better or more official way to install Darts with CPU-only PyTorch? For example, could there be an option like pip install u8darts[torch-cpu] similar to existing extras ?

If so, would it be appropriate to add these instructions to the official installation docs here?

https://github.com/unit8co/darts/blob/master/INSTALL.md

Thanks!

trya2l avatar Jun 26 '25 19:06 trya2l

According to the various resources I could find online, what you described seems to be a nice way to install Darts with the CPU-only version of PyTorch. I would maybe just install PyTorch before installing Darts, so that it's not installed twice.

At the moment, there is no official way/flavor of Darts with PyTorch for CPU but we might consider it.

madtoinou avatar Jun 27 '25 07:06 madtoinou

@madtoinou u8darts comes without torch :)

You could simplify it a bit with:

pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install u8darts[torch]

This would install all our torch dependencies though:

pytorch-lightning>=1.5.0
tensorboardX>=2.1
torch>=1.8.0

Since torch would already installed in the CPU version, it should not install the GPU version.

If you don't need tensorboardX then you can use what you suggested initially :)

dennisbader avatar Jun 27 '25 09:06 dennisbader

Hello @dennisbader @madtoinou,

Thanks for the tips. I've taken the time to try, and I can confirm it works as intended. Would you find it appropriate if I sent a PR to add this use case to the docs ?

https://github.com/unit8co/darts/blob/bd53fe022f3dcb48799fe3f0cdf3a6ba004a820e/INSTALL.md?plain=1#L1-L18

After these lines I would add an item to the list in the form of

  • Install core + neural networks CPU only (using PyTorch CPU wheel): first install torch pip install torch --index-url https://download.pytorch.org/whl/cpu then u8darts pip install "u8darts[torch]"

trya2l avatar Jun 30 '25 00:06 trya2l