Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserving libtorch_python in package #246

Closed
wants to merge 10 commits into from
1 change: 0 additions & 1 deletion recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ if [[ "$PKG_NAME" == "libtorch" ]]; then
for f in ATen caffe2 tensorpipe torch c10; do
mv torch/include/$f ${PREFIX}/include/$f
done
rm ${PREFIX}/lib/libtorch_python.*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work AFAIU; libtorch_python.so depends on a specific python version, while the conda package libtorch intentionally does not depend on python at all.

If we want to ship libtorch_python.so, we should most likely package it in the pytorch output (or perhaps create a separate output).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing out that libtorch should not depend on Python. Moving it or creating a separate output seems like a viable solution.

I am relatively new to the build script of this feedstock and find it more complex than other packages I've worked with. Could you please provide some guidance on how to implement your suggestion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please provide some guidance on how to implement your suggestion?

As a first approach, it should work to "install" libtorch_python.so in build_pytorch.sh, by copying from the build cache (that's created & populated during the execution of build.sh) into $PREFIX/lib.

popd
popd

Expand Down
4 changes: 2 additions & 2 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set version = "2.3.1" %}
{% set build = 1 %}
{% set build = 2 %}

{% if cuda_compiler_version != "None" %}
{% set build = build + 200 %}
Expand Down Expand Up @@ -159,7 +159,7 @@ requirements:
test:
commands:
# libraries
{% for each_lib in [ 'libc10', 'libshm', 'libtorch', 'libtorch_cpu', 'libtorch_global_deps'] %}
{% for each_lib in [ 'libc10', 'libshm', 'libtorch', 'libtorch_cpu', 'libtorch_global_deps', 'libtorch_python'] %}
- test -f $PREFIX/lib/{{ each_lib }}.so # [linux]
- test -f $PREFIX/lib/{{ each_lib }}.dylib # [osx]
{% endfor %}
Expand Down
Loading