Closed jeremyben closed 4 weeks ago
I can reproduce this exactly. It seems weird to me that it can't access the conda environment as there import torch
does work.
@tdejager We did already activate the conda env right?
Yes, but because we use isolated builds this does not include python dependencies.
Right, so the only way for now would be to run:
pixi add uv setuptools
and then run the following task, which you could put in a pixi task.
pixi run uv pip install --no-build-isolation git+https://github.com/facebookresearch/detectron2@bcfd464d0c810f0442d91a349c0f6df945467143
To give a little more background for users finding this issue. This issue is something we still have to fix. It's part of the build-isolation story.
detectron2
requires torch
but doesn't depend on it. build-isolation
for building pypi-dependencies
meaning all "conda-python" dependencies are not taking into account by the pypi build environment. detectron2
gets build in an empty environment with no way to give it torch
. There are multiple issues explaining this. But it would be best to track https://github.com/prefix-dev/pixi/issues/1124 and please :+1: (upvote) the issue.
I'll close this issue for now as it has become a duplicate.
Right, so the only way for now would be to run:
pixi add uv setuptools
and then run the following task, which you could put in a pixi task.
pixi run uv pip install --no-build-isolation git+https://github.com/facebookresearch/detectron2@bcfd464d0c810f0442d91a349c0f6df945467143
Maybe add the --no-deps
to be on the safe side.
@tdejager Then you would need to add some more packages as conda package. But it is indeed a good idea!
Right, so the only way for now would be to run:
pixi add uv setuptools
and then run the following task, which you could put in a pixi task.
pixi run uv pip install --no-build-isolation git+https://github.com/facebookresearch/detectron2@bcfd464d0c810f0442d91a349c0f6df945467143
Thank you for this workaround, but that defeats the purpose of the lock file and even the dependencies metadata, which is the reason I want to migrate to Pixi (right now I'm pinning my dependencies in environment.yaml
).
I'll wait for an option to build without isolation. Thank you for all your work and the security consideration you put into it !
Checks
pixi --version
.Reproducible example
Trying to install detectron2 from source, which has a build and runtime dependency on pytorch. Haven't got this problem with miniconda.
Issue description
ModuleNotFoundError: No module named 'torch'
during detectron2 build step.Expected behavior
Pypi build step should be able to resolve conda installed modules.