I just Installed torch and torchvision with the following command:
pip install torch===1.4.0 torchvision===0.5.0 -f https://download.pytorch.org/whl/torch_stable.html
system:
OS: win 7, python 3.6.8, with cuda
when I do:
import torchvision
I get a pop up "python.exe - System Error" "The program can't start because avcodec-58.dll is missing from your computer..."
I have torch/torchvision running on another win machine (10, cpu only) without problems. Is this related to ffmpeg? I do not have it installed on either machine.
Any suggestions to get this resolved would be appreciated.
av is installed before building wheels on Windows, so ffmpeg is actually a required component. It can be seen here. https://github.com/pytorch/vision/blob/winbuild/v0.5.0/packaging/windows/build_vision.bat
If you use Anaconda, you can use conda install -c conda-forge av to install that. Otherwise, you'll need to do that manually. You can refer to http://blog.gregzaal.com/how-to-install-ffmpeg-on-windows/.
Thank you, peterjc123 for your reply.
I installed ffmpeg with chocolatey, but still get the same error. What's odd is that I did not have to deal with any of this on my win 10 laptop and torch / torchvision worked fine (it is cpu only and python 3.7).
I should mention that I started with torch breaking on this machine at first that I addressed by upgrading python from 3.6.0 to 3.6.8. Perhaps something did not reinstall cleanly?
You mention av being installed as part of the installation, where do I find it? I do not see it in C:\Python36\Lib\site-packagesav
Sorry for confusion, I mean av is installed in our build environment. It leads to ffmpeg component being built and thus the DLLs of them are required at the user's side.
Thank you, though I probably still do not or even have to understand the finer points of your explanation for the reasons why. However I did just find the critical bit of information that was missing to resolve the error. Apparently there are two versions of ffmpeg static and shared. Apparently chocolatey installs the static one and the shared one is needed as it is the one with the dlls including avcodec-58.dll.
Maybe you could download them here. https://ffmpeg.zeranoe.com/builds/
Thanks, that is what I did this time. This is how I figured out that there is a ffmpeg build with the dlls and a build without.
The ffmepg is installed successfully and the path is added to the environment variable ,
and avcodec-58.dll exists in the bin folder right now, but still I get same error,
any suggestions?
If you are using Python 3.8, then you may need an additional os.add_dll_directory call.
I just pip installed using Command Prompt and then tried to run torch. I am getting the same error.
I am a new in Julia and after adding the Plots package I tried to use Plots and I got this Error message:
julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
ERROR: LoadError: InitError: could not load library "C:\Users\niri.julia\artifacts\7350a6401f1c0d38cc3518193083bc4f83adfe99\binavcodec-58.dll"
The specified module could not be found.
Stacktrace:
[1] dlopen(::String, ::UInt32; throw_error::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Libdl\src\Libdl.jl:109
[2] dlopen at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Libdl\src\Libdl.jl:109 [inlined] (repeats 2 times)
[3] __init__() at C:\Users\niri.julia\packages\FFMPEG_jll\w0b7h\src\wrappers\x86_64-w64-mingw32.jl:234
[4] _include_from_serialized(::String, ::Array{Any,1}) at .\loading.jl:697
[5] _require_search_from_serialized(::Base.PkgId, ::String) at .\loading.jl:782
[6] _require(::Base.PkgId) at .\loading.jl:1007
[7] require(::Base.PkgId) at .\loading.jl:928
[8] require(::Module, ::Symbol) at .\loading.jl:923
[9] include(::Function, ::Module, ::String) at .\Base.jl:380
[10] include(::Module, ::String) at .\Base.jl:368
[11] top-level scope at none:2
[12] eval at .\boot.jl:331 [inlined]
[13] eval(::Expr) at .\client.jl:467
[14] top-level scope at .\none:3
during initialization of module FFMPEG_jll
in expression starting at C:\Users\niri.julia\packages\FFMPEG\vocw2\src\FFMPEG.jl:3
ERROR: LoadError: Failed to precompile FFMPEG [c87230d0-a227-11e9-1b43-d7ebe4e7570a] to C:\Users\niri.julia\compiled\v1.5\FFMPEG\TGvga_Ik59J.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1305
[3] _require(::Base.PkgId) at .\loading.jl:1030
[4] require(::Base.PkgId) at .\loading.jl:928
[5] require(::Module, ::Symbol) at .\loading.jl:923
[6] include(::Function, ::Module, ::String) at .\Base.jl:380
[7] include(::Module, ::String) at .\Base.jl:368
[8] top-level scope at none:2
[9] eval at .\boot.jl:331 [inlined]
[10] eval(::Expr) at .\client.jl:467
[11] top-level scope at .\none:3
in expression starting at C:\Users\niri.julia\packages\Plots\cc8wh\src\Plots.jl:11
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to C:\Users\niri.julia\compiled\v1.5\Plots\ld3vC_Ik59J.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1305
[3] _require(::Base.PkgId) at .\loading.jl:1030
[4] require(::Base.PkgId) at .\loading.jl:928
[5] require(::Module, ::Symbol) at .\loading.jl:923
can someone help me to resolve the problem
Closing, as this issue is fixed in 0.6.0. If you are using 0.5.0, please refer to https://github.com/pytorch/vision/issues/1877#issuecomment-586157441 and https://github.com/pytorch/vision/issues/1877#issuecomment-609003986.
Most helpful comment
If you are using Python 3.8, then you may need an additional
os.add_dll_directorycall.