Vision: Library not loaded error when running hello_world example

Created on 11 Dec 2020  路  3Comments  路  Source: pytorch/vision

馃悰 Bug

I am unable to run examples/cpp/hello_world/main.cpp after compilation using torchvision 0.8.2 with libtorch 1.7.1.

I encountered this in a CI run when trying to update libtorch and torchvision on Homebrew: https://github.com/Homebrew/homebrew-core/pull/66688

The test attempts to compile and run the example mentioned above. It produced this error:

==> /usr/bin/clang++ -std=c++14 main.cpp -o test -I/usr/local/opt/libtorch/include -I/usr/local/opt/libtorch/include/torch/csrc/api/include -L/usr/local/opt/libtorch/lib -ltorch -ltorch_cpu -lc10 -L/usr/local/Cellar/torchvision/0.8.2/lib -ltorchvision
==> ./test
dyld: Library not loaded: /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/Python
  Referenced from: /usr/local/opt/torchvision/lib/libtorchvision.dylib
  Reason: image not found

Error: torchvision: failed

This was the same test used with previous versions of torchvision in Homebrew CI. I'm trying to reproduce the error locally, but libtorch is taking ages to compile on my woefully underpowered laptop.

To Reproduce

Steps to reproduce the behavior:

  1. Build libtorch and torchvision from source using the formulae in this PR: https://github.com/Homebrew/homebrew-core/pull/66688
  2. brew test torchvision

CI run logs available here: https://github.com/Homebrew/homebrew-core/pull/66688/checks?check_run_id=1535220352

Expected behavior

No errors.

Environment

Additional context

None.

c++ frontend

Most helpful comment

Ok, things finally finished compiling. I'm unable to reproduce the error locally. Apologies for cluttering your issue tracker.

All 3 comments

Ok, things finally finished compiling. I'm unable to reproduce the error locally. Apologies for cluttering your issue tracker.

In case anyone was following along, pytorch and torchvision are now at their latest versions on Homebrew. As a bonus, Homebrew torchvision comes with torchvision's C++ front-end.

Thanks for the great work you've put into this project.

@carlocab thanks for the heads up!

cc @datumbox as a FYI because we are making breaking changes for the C++ frontend of torchvision

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Linardos picture Linardos  路  4Comments

IssamLaradji picture IssamLaradji  路  3Comments

chinglamchoi picture chinglamchoi  路  3Comments

yxlabs picture yxlabs  路  4Comments

300LiterPropofol picture 300LiterPropofol  路  3Comments