I am trying to packaging using the following pyproject.toml
file :
[project]
name = "mypkg"
version = "0.0.1"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = [
"numpy",
"scipy",
]
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project.optional-dependencies]
torch = ["torch","torchinterp1d@git+https://github.com/aliutkus/torchinterp1d"]
When installing my package into a fresh virtual environment using
pip install .[torch]
I obtain an error because torch
is needed to install the torchinterp1
dependency:
│ exit code: 1
╰─> [13 lines of output]
Traceback (most recent call last):
File "/tmp/pip-install-7ybk_fq5/torchinterp1d_298c86f7d4de431592653b4512b7b4c9/setup.py", line 8, in <module>
import torch
ModuleNotFoundError: No module named 'torch'
When installing torch alone and trying again, the package installation works fine. Is there a way to ensure that torch
installation is done before the installation of torchinterp1
? Thanks!