question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Building from source OSX: import torchvision crash (with ffmpeg version 4.4)

See original GitHub issue

❓ Questions and Help

Hi, I’m trying to build torchvision from source on OSX and have followed the contributing guidelines. I run the following

git clone https://github.com/pytorch/vision.git
cd vision

# Initialize and activate the environment
conda create -n  vision python=3.8 -y
conda activate vision

pip install flake8 typing mypy pytest scipy numpy
# Install pytorch nightly
conda install pytorch -c pytorch-nightly -c conda-forge

MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py develop

While building I can see the following clang error.

clang: error: unknown argument: '-print-multiarch'
clang: error: no input files

The setup completes, but on importing the module in python, I run into the issue below.

>>> import torchvision
libc++abi: terminating with uncaught exception of type c10::Error: Type c10::tagged_capsule<vision::video::Video> could not be converted to any of the known types.
Exception raised from operator() at /Users/gollum/anaconda3/envs/vision/lib/python3.8/site-packages/torch/include/ATen/core/jit_type.h:1592 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) + 98 (0x112b1c402 in libc10.dylib)
frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 106 (0x112b1ab7a in libc10.dylib)
frame #2: c10::detail::getTypePtr_<c10::tagged_capsule<vision::video::Video> >::call()::'lambda'()::operator()() const + 298 (0x13021bb3a in video_reader.so)
frame #3: c10::detail::getTypePtr_<c10::tagged_capsule<vision::video::Video> >::call() + 41 (0x13021b989 in video_reader.so)
frame #4: c10::detail::infer_schema::(anonymous namespace)::createArgumentVector(c10::ArrayRef<c10::detail::infer_schema::ArgumentDef>) + 216 (0x1178446b8 in libtorch_cpu.dylib)
frame #5: c10::detail::infer_schema::make_function_schema(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, c10::ArrayRef<c10::detail::infer_schema::ArgumentDef>, c10::ArrayRef<c10::detail::infer_schema::ArgumentDef>) + 123 (0x11784445b in libtorch_cpu.dylib)
frame #6: torch::jit::Function* torch::class_<vision::video::Video>::defineMethod<torch::class_<vision::video::Video>& torch::class_<vision::video::Video>::def<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(torch::detail::types<void, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::initializer_list<torch::arg>)::'lambda'(c10::tagged_capsule<vision::video::Video>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::initializer_list<torch::arg>) + 505 (0x130215a89 in video_reader.so)
frame #7: torch::class_<vision::video::Video>& torch::class_<vision::video::Video>::def<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(torch::detail::types<void, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::initializer_list<torch::arg>) + 113 (0x1301f0fe1 in video_reader.so)
frame #8: _GLOBAL__sub_I_video.cpp + 173 (0x13021be6d in video_reader.so)
frame #9: 0x0 + 4617463815 (0x11338e807 in ???)
frame #10: 0x0 + 4617464850 (0x11338ec12 in ???)
frame #11: 0x0 + 4617443238 (0x1133897a6 in ???)
frame #12: 0x0 + 4617434463 (0x11338755f in ???)
frame #13: 0x0 + 4617434624 (0x113387600 in ???)
frame #14: 0x0 + 4617370136 (0x113377a18 in ???)
frame #15: 0x0 + 4617416162 (0x113382de2 in ???)
frame #16: dlopen_internal(char const*, int, void*) + 185 (0x7fff20441c94 in libdyld.dylib)
frame #17: dlopen + 28 (0x7fff2043007e in libdyld.dylib)
frame #18: py_dl_open + 135 (0x10b4a6d47 in _ctypes.cpython-38-darwin.so)
<omitting python frames>

Complete build log available here: log.txt

Output for clang --version:

Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

I don’t have a lot of experience with clang and was not able to find a solution for the same. I apologize before since this may be a clang specific issue and not really related to torchvision. Any help troubleshooting this will be extremely helpful. Thanks in advance!

Ps. I was able to build it just fine on another machine following the same steps, it seems like a clang problem on my machine.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
datumboxcommented, Jun 7, 2021

@AnirudhDagar We need to close the issue to keep things tidy. I think users can still find the issue even if it’s closed. To help them further you can edit your description and link to the reply that helped you solve it or summarize it in a few words.

If you face any additional issues, don’t hesitate to reopen it. Thanks!

1reaction
fmassacommented, Jun 9, 2021

@prabhat00155 what do you think if we skip compiling ffmpeg in torchvision is the version is not compatible, printing a message saying that that version of ffmpeg is not compatible?

Read more comments on GitHub >

github_iconTop Results From Across the Web

StreamWriter Basic Usage — Torchaudio 0.13.1 documentation
StreamWriter to encode and save audio/video data into various formats/destinations. Note. This tutorial requires torchaudio nightly build and FFmpeg libraries (> ...
Read more >
Package List — Spack 0.20.0.dev0 documentation
This is a list of things you can install using Spack. It is automatically generated based on the packages in this Spack version....
Read more >
homebrew-core - Homebrew Formulae
a2ps 4.14 Any‑to‑PostScript filter aacgain 1.8 AAC‑supporting version of mp3gain aalib 1.4rc5 Portable ASCII art graphics library aamath 0.3 Renders mathematical expressions as ASCII art
Read more >
main - Anaconda repo
Package Latest Version Doc Dev License linux‑64 osx‑64 win‑64 7za 920 doc LGPL X 7zip 19.00 dev LGPL‑2.1‑or‑later X _anaconda_depends 2022.05 doc dev BSD X X...
Read more >
EasyBuild Documentation - Read the Docs
Seeding in source files for container build process . ... This documentation is intended for EasyBuild version 4.6.2, and was last rebuilt ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found