# opam install torch
The following actions will be performed:
=== remove 1 package
⊘ libtorch 2.2.1+linux-x86_64 [conflicts with torch]
=== install 1 package
∗ torch v0.17.0
Proceed with ⊘ 1 removal and ∗ 1 installation? [y/n] y
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⊘ removed libtorch.2.2.1+linux-x86_64
⬇ retrieved torch.v0.17.0 (cached)
[ERROR] The compilation of torch.v0.17.0 failed at "dune build -p torch -j 19".
#=== ERROR while compiling torch.v0.17.0 ======================================#
# context 2.2.1 | linux/x86_64 | ocaml-base-compiler.5.1.1 | git+https://github.com/ocaml/opam-repository.git
# path ~/.opam/5.1.1/.opam-switch/build/torch.v0.17.0
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p torch -j 19
# exit-code 1
# env-file ~/.opam/log/torch-1790911-e78aac.env
# output-file ~/.opam/log/torch-1790911-e78aac.out
### output ###
# [...]
# torch_api_generated.h:2014:73: note: expected ‘char *’ but argument is of type ‘const char *’
# raw_tensor atg_segment_reduce_out(gc_tensor out, gc_tensor data, char * reduce, gc_tensor lengths, gc_tensor indices, gc_tensor offsets, int64_t axis, int unsafe, scalar initial);
# ~~~~~~~^~~~~~
# torch_stubs_generated.c: In function ‘caml__2413_atg_stft_center’:
# torch_stubs_generated.c:35007:28: warning: passing argument 9 of ‘atg_stft_center’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
# x33586, x33589, x33590, x33593, x33596);
# ^~~~~~
# In file included from torch_api.h:163,
# from torch_stubs_generated.c:1:
# torch_api_generated.h:2336:182: note: expected ‘char *’ but argument is of type ‘const char *’
# raw_tensor atg_stft_center(gc_tensor self, int64_t n_fft, int64_t hop_length_v, int hop_length_null, int64_t win_length_v, int win_length_null, gc_tensor window, int center, char * pad_mode, int normalized, int onesided, int return_complex);
# ~~~~~~~^~~~~~~~
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build torch v0.17.0
└─
┌─ The following changes have been performed
│ ⊘ remove libtorch 2.2.1+linux-x86_64
└─
<><> torch.v0.17.0 troubleshooting ><><><><><><><><><><><><><><><><><><><><><><>
=> Installation of ocaml-torch failed. This likely happened
because there is no system installation of libtorch to compile
OCaml bindings against. Please instal the CPU version of libtorch
through opam, or the appropriate version of libtorch for your GPU
through the official distribution.
[...]
# pip list | grep torch
torch 2.7.0
# python --version
Python 3.10.19