CMake can not find package after install with conda

If I install pytorch with conda the relevant cmake files fro find_package are not stored in the default folder that cmake checks. The only way for me to make it work is to specificaly set the CMAKE_PREFIX_PATH.
This is unfortunate as it is python version dependent and any update would require to also change the Cmake file. Is there any way around that? Could the conda package just add the files to the default CMAKE_PREFIX_PATH?

Thanks

I’ve not faced the same error but if installing from source, yes.

It’s documented to manually set CMAKE_PREFIX_PATH before python setup.py install or python setup.py develop: pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration (github.com).

well installing with conda pytorch_cpu the needed cmake files are in anaconda/envs/<env_name>/lib/python3.8/site-packages/torch/share/cmake/
That is not a path that cmake chacks by default as far as I can tell