av with python2
Created by: zoldaten
hi !
Overview
i have successfully built av for python2 from source on Raspbian Stretch armv7l:
python2 -m pip install Cython
git clone https://github.com/PyAV-Org/PyAV
cd PyAV
*fixed in setup.py: added import codecs, from io import open
python2 setup.py build
python2 setup.py install --user
but cant use it:
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import av
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "av/__init__.py", line 20, in <module>
from av._core import time_base, library_versions
ImportError: No module named _core
Expected behavior
{{ import av in python2 OK }}
Actual behavior
{{does not work }}
Traceback:
{{ Include complete tracebacks if there are any exceptions. }}
Investigation
i fixed import just with export path:
export PATH="$PATH:/home/pi/PyAV/build/lib.linux-armv7l-2.7/av"
but got this:
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import av
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.local/lib/python2.7/site-packages/av-10.0.0-py2.7-linux-armv7l.egg/av/__init__.py", line 23, in <module>
from av import logging
File "av/logging.pyx", line 39, in init av.logging
ImportError: cannot import name get_ident
ok. i commented out logging in :
"/home/pi/.local/lib/python2.7/site-packages/av-10.0.0-py2.7-linux-armv7l.egg/av/__init__.py"
but crashed finally:
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import av
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.local/lib/python2.7/site-packages/av-10.0.0-py2.7-linux-armv7l.egg/av/__init__.py", line 27, in <module>
from av.audio.fifo import AudioFifo
File "/home/pi/.local/lib/python2.7/site-packages/av-10.0.0-py2.7-linux-armv7l.egg/av/audio/__init__.py", line 1, in <module>
from .frame import AudioFrame
File "av/audio/frame.pyx", line 1, in init av.audio.frame
File "av/frame.pyx", line 1, in init av.frame
File "/home/pi/.local/lib/python2.7/site-packages/av-10.0.0-py2.7-linux-armv7l.egg/av/codec/__init__.py", line 1, in <module>
from .codec import Capabilities, Codec, Properties, codec_descriptor, codecs_available
File "av/codec/codec.pyx", line 1, in init av.codec.codec
File "av/descriptor.pyx", line 1, in init av.descriptor
File "av/option.pyx", line 1, in init av.option
File "av/enum.pyx", line 13, in init av.enum
ImportError: No module named copyreg
Research
I have done the following:
- [V] Checked the PyAV documentation
- [ V] Searched on Google
- [ V] Searched on Stack Overflow
- [ V] Looked through old GitHub issues
-
Asked on PyAV Gitter -
... and waited 72 hours for a response.
Additional context
I know that you do not officially support python2 but if you could help a bit that will be great because otherwise i need to rewrite all packages for dji tello ROS nodes as it uses python2 and av.