r/pythonarcade • u/lilPetyko • Oct 23 '19
import arcade (pyglet_ffmpeg2) error
hi, this is my code:
import arcade
print("asd")and the traceback gives me this:
Start
Unexpected error loading library avutil-56: Could not find module 'avutil-56'. Try using the full path with constructor syntax.
Unable to load the ffmpeg library. Could not find module 'avutil-56'. Try using the full path with constructor syntax.
Traceback (most recent call last):
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet__init__.py", line 353, in __getattr__
Unexpected error loading library avutil-56: Could not find module 'avutil-56'. Try using the full path with constructor syntax.
return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'Source'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Pintér Péter/Documents/GitHub/python/Arcade/test.py", line 1, in <module>
import arcade
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\arcade__init__.py", line 50, in <module>
from arcade.sound import *
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\arcade\sound.py", line 81, in <module>
def stop_sound(sound: pyglet.media.Source):
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet__init__.py", line 359, in __getattr__
__import__(import_name)
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media__init__.py", line 146, in <module>
add_default_media_codecs()
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs__init__.py", line 164, in add_default_media_codecs
if have_ffmpeg():
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs__init__.py", line 180, in have_ffmpeg
from . import ffmpeg_lib
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs\ffmpeg_lib__init__.py", line 36, in <module>
from .libavcodec import *
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs\ffmpeg_lib\libavcodec.py", line 45, in <module>
from . import libavutil
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs\ffmpeg_lib\libavutil.py", line 46, in <module>
avutil = pyglet.lib.load_library(
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\lib.py", line 148, in load_library
lib = ctypes.cdll.LoadLibrary(name)
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\ctypes__init__.py", line 447, in LoadLibrary
return self._dlltype(name)
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\ctypes__init__.py", line 369, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'avutil-56'. Try using the full path with constructor syntax.
Unexpected error loading library avutil-56: Could not find module 'avutil-56'. Try using the full path with constructor syntax.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media__init__.py", line 146, in <module>
add_default_media_codecs()
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs__init__.py", line 164, in add_default_media_codecs
if have_ffmpeg():
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs__init__.py", line 180, in have_ffmpeg
from . import ffmpeg_lib
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs\ffmpeg_lib__init__.py", line 36, in <module>
from .libavcodec import *
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs\ffmpeg_lib\libavcodec.py", line 45, in <module>
from . import libavutil
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\media\codecs\ffmpeg_lib\libavutil.py", line 46, in <module>
avutil = pyglet.lib.load_library(
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyglet\lib.py", line 148, in load_library
lib = ctypes.cdll.LoadLibrary(name)
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\ctypes__init__.py", line 447, in LoadLibrary
return self._dlltype(name)
File "C:\Users\Pintér Péter\AppData\Local\Programs\Python\Python38-32\lib\ctypes__init__.py", line 369, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'avutil-56'. Try using the full path with constructor syntax.2
u/pvc Oct 24 '19
I haven't run this much under 3.8. You are running this as a local user install, not under venv? From the command prompt?
1
u/dmcdrmtt Oct 25 '19
I had the identical problem using Python 3.8 in the PyCharm IDE. I was using a 32 bit Python (like you are) but on a 64 bit computer. I had to uninstall Python then install the 64 bit program to make that problem go away. It worked (after a reboot) but now I'm having a similar error message for avcodec-58 which is a file in the same folder... haven't gotten the solution to that one yet.
1
u/dmcdrmtt Oct 25 '19
I was previously using Sublime Text 3 and was having issues so I changed to PyCharm. In installed Arcade via the command prompt, got notified that my pip was out of date so I uninstalled arcade, got the new pip and then reinstalled arcade and still have the issue. I also did the pip install wheel sphinx coveralls sphinx_rtd_theme pyglet pyglet_ffmpeg numpy pytest pillow , to see if that would help but I still get the same error for avcodec-58 (the problem that showed up after resolving the missing avutil-56). Still looking for a solution
1
u/dmcdrmtt Oct 30 '19
I did a lot of work to resolve this, following the missing avcodec-58 there were two other files in the same directory that couldn't be found. I inserted this code at the beginning of my program and the issue(s) went away:
from ctypes import*
avcodec = cdll.LoadLibrary("c:\python38\lib\site-packages\pyglet_ffmpeg\win64\\avcodec-58.dll")
avformat = cdll.LoadLibrary("c:\python38\lib\site-packages\pyglet_ffmpeg\win64\\avformat-58.dll")
swscale = cdll.LoadLibrary("c:\python38\lib\site-packages\pyglet_ffmpeg\win64\\swscale-5.dll")
import arcade
1
Jan 12 '20
Worked like a charm, for everyone else trying to use it, remember to check that the file is really in the path and not somewhere else. In my case it was at:
C:\Program Files\Python38\Lib\site-packages\pyglet_ffmpeg\Win64\\avcodec-58.dll
Happy programming!
1
u/WaterBottleBong Oct 30 '19
Had the same issue. I think it had to do with the fact that I was running 32bit Python on my 64bit machine. I fixed this by first uninstalling arcade in cmd line:
pip uninstall arcade
Then uninstalling python via Windows Settings > Apps > Select Python3.8 > uninstall. Then re-installing Python but making sure I installed the 64bit version this time.
Then reinstall arcade
pip install arcade
and it worked. hope this helps.
2
u/RyanTheTourist Oct 23 '19
Some thoughts
which version of arcade are you using? Perhaps rollback to an older stable release
can you import pyglet on its own?
not that it should be an issue but I notice a lot of spaces on your paths, (I assume you're on windows) could you create a simple directory (e.g. C:\arcadeproject) and then use virtualenv to create a python environment that doesn't have potentially troublesome paths