Torch cpu as a dependency of package

Hi, I have a trained model and created a Django app to host this model. Everything works great in development but now as I am trying to package the Django app for production I have the problem that setuptools can’t seem to install pytorch correctly. In my I have install_requires containing "torch==1.2.0+cpu", "torchvision==0.4.0+cpu and the dependency_links containing

This seems to be finding torch on pip instead and deciding it can’t install.

I have also tried with install_requires containing


and dependency_links containing

Neither of these seem to work and I can’t find anything online about this issue. Has anyone done this before and how did you do it?

1 Like

I’ve had some success using URL dependency syntax from PEP 508. I had to commit to a specific python version and architecture, though. It’s fine in my case, I know the environment where the package will be used. I’ve looked for a way to leave out the environment spec, but haven’t found anything.

Example entry in install_requires: "torch @"

The links can be found here: