InDashPC.org Forum Index InDashPC.org
In Dash Car PC forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to install PyMedia with Python 2.5 on Windows?

 
Post new topic   Reply to topic    InDashPC.org Forum Index -> Software
View previous topic :: View next topic  
Author Message
Aristocrata



Joined: 07 Apr 2008
Posts: 1

PostPosted: Mon Apr 07, 2008 10:03 pm    Post subject: How to install PyMedia with Python 2.5 on Windows? Reply with quote

I can't install the executable without Python 2.3 and I don't make idea about how to compile it. I've tried double clik on setup file and appears the following:

Quote:
Using WINDOWS configuration...

Path for OGG not found.
Path for VORBIS not found.
Path for FAAD not found.
Path for MP3LAME not found.
Path for VORBISENC not found.
Path for ALSA not found.
Continue building pymedia ? [Y,n]:


I try 'Y' but not happens.
Back to top
View user's profile Send private message
umanx



Joined: 08 Aug 2008
Posts: 1

PostPosted: Fri Aug 08, 2008 5:49 am    Post subject: Reply with quote

Anyone knows how to do this? Please.. Sad
Back to top
View user's profile Send private message
jbors
Site Admin


Joined: 12 Nov 2004
Posts: 1675

PostPosted: Sun Aug 10, 2008 11:31 pm    Post subject: Reply with quote

I do not think Python 2.3 is supported. Can you try 2.4 or 2.5 ?
Back to top
View user's profile Send private message
f0k
Newbie


Joined: 07 Aug 2009
Posts: 5

PostPosted: Fri Aug 07, 2009 2:52 am    Post subject: Reply with quote

Hi! I think Aristocrata did not try to compile it with Python 2.3, but he or she first tried to install the binary you provide (which is for Python 2.3) with a new python version (Python 2.5). This did not work, so he or she tried to compile PyMedia from source by doubleclicking setup.py. This will not have worked either, because this only launches "python setup.py" and not "python setup.py build".

Anyway, I'm now trying to build PyMedia for Python 2.5 or 2.6 on Windows XP. I've got Mingw32 installed (and also Cygwin, but as I do not want to install PyMedia on Cygwin's Python, this will not help).

I downloaded the PyMedia 1.3.7.3 source, extracted it and opened a command prompt in the folder. When I issue "D:\PathToPython\python setup.py build", I get the following:
Quote:

Using WINDOWS configuration...

Path for OGG not found.
Path for VORBIS not found.
Path for FAAD not found.
Path for MP3LAME not found.
Path for VORBISENC not found.
Path for ALSA not found.
Continue building pymedia ? [Y,n]:Y
running build
running build_py
creating build
creating build\lib.win32-2.6
creating build\lib.win32-2.6\pymedia
copying inst_lib\meta.py -> build\lib.win32-2.6\pymedia
copying inst_lib\player.py -> build\lib.win32-2.6\pymedia
copying inst_lib\__init__.py -> build\lib.win32-2.6\pymedia
creating build\lib.win32-2.6\pymedia\audio
copying inst_lib\audio\__init__.py -> build\lib.win32-2.6\pymedia\audio
creating build\lib.win32-2.6\pymedia\video
copying inst_lib\video\__init__.py -> build\lib.win32-2.6\pymedia\video
creating build\lib.win32-2.6\pymedia\video\ext_codecs
copying inst_lib\video\ext_codecs\__init__.py -> build\lib.win32-2.6\pymedia\video\ext_codecs
creating build\lib.win32-2.6\pymedia\removable
copying inst_lib\removable\__init__.py -> build\lib.win32-2.6\pymedia\removable
running build_ext
building 'pymedia.audio.sound' extension
error: Unable to find vcvarsall.bat


I guess "vcvarsall.bat" has got something to do with MS Visual C++? Is it possible to compile PyMedia with MingW32? If so, how can I configure the include dirs and such? setup.py and config.py do not seem to provide a way to do that. How does PyMedia's setup.py try to find the correct compiler?
Back to top
View user's profile Send private message
Hagbard_Durden



Joined: 07 Aug 2009
Posts: 1

PostPosted: Fri Aug 07, 2009 5:18 am    Post subject: Reply with quote

f0k wrote:
Hi! I think Aristocrata did not try to compile it with Python 2.3, but he or she first tried to install the binary you provide (which is for Python 2.3) with a new python version (Python 2.5). This did not work, so he or she tried to compile PyMedia from source by doubleclicking setup.py. This will not have worked either, because this only launches "python setup.py" and not "python setup.py build".

Anyway, I'm now trying to build PyMedia for Python 2.5 or 2.6 on Windows XP. I've got Mingw32 installed (and also Cygwin, but as I do not want to install PyMedia on Cygwin's Python, this will not help).

I downloaded the PyMedia 1.3.7.3 source, extracted it and opened a command prompt in the folder. When I issue "D:\PathToPython\python setup.py build", I get the following:
Quote:

Using WINDOWS configuration...

Path for OGG not found.
Path for VORBIS not found.
Path for FAAD not found.
Path for MP3LAME not found.
Path for VORBISENC not found.
Path for ALSA not found.
Continue building pymedia ? [Y,n]:Y
running build
running build_py
creating build
creating build\lib.win32-2.6
creating build\lib.win32-2.6\pymedia
copying inst_lib\meta.py -> build\lib.win32-2.6\pymedia
copying inst_lib\player.py -> build\lib.win32-2.6\pymedia
copying inst_lib\__init__.py -> build\lib.win32-2.6\pymedia
creating build\lib.win32-2.6\pymedia\audio
copying inst_lib\audio\__init__.py -> build\lib.win32-2.6\pymedia\audio
creating build\lib.win32-2.6\pymedia\video
copying inst_lib\video\__init__.py -> build\lib.win32-2.6\pymedia\video
creating build\lib.win32-2.6\pymedia\video\ext_codecs
copying inst_lib\video\ext_codecs\__init__.py -> build\lib.win32-2.6\pymedia\video\ext_codecs
creating build\lib.win32-2.6\pymedia\removable
copying inst_lib\removable\__init__.py -> build\lib.win32-2.6\pymedia\removable
running build_ext
building 'pymedia.audio.sound' extension
error: Unable to find vcvarsall.bat


I guess "vcvarsall.bat" has got something to do with MS Visual C++? Is it possible to compile PyMedia with MingW32? If so, how can I configure the include dirs and such? setup.py and config.py do not seem to provide a way to do that. How does PyMedia's setup.py try to find the correct compiler?


I'm also trying to install PyMedia on WinXP for Python 2.6 right now. I did exactly what you did and got the exact same results.
Back to top
View user's profile Send private message
f0k
Newbie


Joined: 07 Aug 2009
Posts: 5

PostPosted: Fri Aug 07, 2009 9:09 am    Post subject: Reply with quote

Hagbard_Durden wrote:
I'm also trying to install PyMedia on WinXP for Python 2.6 right now. I did exactly what you did and got the exact same results.

So at least I'm not the only one reviving this one-year-old thread. Smile

Compiling under Cygwin works seamlessly (using gcc and g++), so I guess all we need is getting setup.py to use the Mingw compiler. Setup.py uses the distutils module, but I don't know anything about it. The only Python module I compiled from scratch so far was Numpy, and this understood command line switches to select the compiler.

I'll try to fiddle around with Setup.py a bit, hardcoding the use of gcc/g++.
An alternative would be getting the Python-binding for GStreamer to work in Windows, maybe this is easier (I did not investigate that).

Still I would be interested in any hints from the developers of PyMedia!


/Update:
Okay, I now have found that all Python modules using distutils can be built and installed the same way.

"python setup.py --help-commands" lists all available commands. We only need "build" and "install", or, instead of "install", "bdist_wininst" (the latter will create a nice executable setup file tailored to your python version).

"python setup.py --help build" lists the command line options for the build command.
"python setup.py build --help-compiler" lists the available compiler names understood by distutils, which finally leads us to...
"python setup.py build --compiler=mingw32"

This command finally tries to compile PyMedia using Mingw32. Everything works well for the first few files, then gcc throws an error:
Quote:

D:\Entwicklung\Mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DBUILD_NUM=1868 -DWIN32 -DHAVE_AV_CONFIG_H -DUDF_CACHE=1 -ID:\Setup\pymedia-1.3.7.3 -Iaudio/ -Id:\Entwicklung\Python\include -Id:\Entwicklung\Python\PC -c audio\acodec/acodec.c -o build\temp.win32-2.6\Release\audio\acodec\acodec.o
In file included from audio\acodec/acodec.c:31:
audio/libavcodec/dsputil.h:485: warning: static declaration of 'lrintf' follows non-static declaration
audio\acodec/acodec.c:249: warning: initialization from incompatible pointer type
audio\acodec/acodec.c:250: error: initializer element is not constant
audio\acodec/acodec.c:250: error: (near initialization for `ACStringType.tp_getattro')
[...]
audio\acodec/acodec.c:924: error: initializer element is not constant
audio\acodec/acodec.c:924: error: (near initialization for `EncoderType.tp_alloc')
audio\acodec/acodec.c:926: error: initializer element is not constant
audio\acodec/acodec.c:926: error: (near initialization for `EncoderType.tp_free')
error: command 'gcc' failed with exit status 1


I did not yet look at the source code, but I thought I'd share the current progress with you.
(Side note: The gcc call does not include the Mingw include and library directories. This can be fixed using the --include-dirs and --library-dirs switches for the build_ext command, but it does not solve the compilation problem.)

/Update2:
Googling for "Cygwin gcc 'initializer element is not constant' problem" gives an old mailing list conversation from 2003 addressing this issue (I am not allowed to post links here), something to do with "__declspec(dllimport)"... I did not understand much, though, and did not find out anything useful.
Back to top
View user's profile Send private message
f0k
Newbie


Joined: 07 Aug 2009
Posts: 5

PostPosted: Sun Aug 09, 2009 2:58 am    Post subject: initializer element is not constant solved for Mingw. Works! Reply with quote

Okay, finally I got it working.

Explanation:
The "initializer element is not constant" problem originally occured with Cygwin, but apparently it also affects Mingw. The error is thrown because the compiler does not accept a "__declspec(dllimport)" function declaration to be used as a constant, however the compilers (Cygwin's gcc and Mingw's gcc) supports auto-import so the declaration can just be left out to make it work. Python's pyport.h circumvents the problem for Cygwin (using the HAVE_DECLSPEC_DLL and PyAPI_FUNC(RTYPE) makros), but not for Mingw, so I had to change this file. I will contact the Python team about that.

Several other compilation problems originated from the PyMedia source not distinguishing between MSVC and Mingw, only between MSVC and Cygwin. I had to change several #ifdefs to check for __MINGW32__, too (Cygwin and Mingw still needed different treatment in some places, otherwise PyMedia could just have been compiled with -D__CYGWIN__,SYS_CYGWIN). I will contact the PyMedia team about that.


And here is how to do it:

Python modifications:
In your Python installation directory, create the file "Lib\distutils\distutils.cfg" with the following two lines:
Quote:
[build]
compiler=mingw32

This saves you from having to compile with --compiler=mingw32 each time.

In Python's include directory, change pyport.h. Wherever there is a check for __CYGWIN__, add a check for __MINGW32__ to behave the same way.
For example, replace "ifdef(__CYGWIN__)" by "if defined(__CYGWIN__) || defined(__MINGW32__)".

PyMedia modifications:
You can download my fixed PyMedia code from f0k.de/ pub/ pymedia-1.3.7.3-fixed.zip (still not allowed to post URLs here).
Alternatively, perform the following steps on the official PyMedia source code.

Change setup.py: Replace "+= NONMMX_FILES" with "+= MMX_FILES" (the non-MMX files are not included in the source distribution and your CPU will support MMX anyway.)

In video\inttypes.h, append "&& !defined( __MINGW32__ )" to each line ending with "&& !defined( SYS_CYGWIN )". After the line "typedef UINT64 uint64_t;", add the lines "#define INT16_MAX 0x7fff" and "#define INT16_MIN (-0x7fff-1)".
Replace audio\inttypes.h and removable\cd\dvdlibs\dvdcss\inttypes.h with the modified video\inttypes.h.

In audio\libavcodec\common.h, before the "#define floorf(x) floor(x)" line, add a "#ifndef __MINGW32__" line and add a "#endif" line after the "floor" line.

In audio\libavcodec\wmadec.c, replace the "#ifdef WIN32"/"#else"/"#endif" stuff with the line "norm = (1.0 / (float)(int64_t_C(1) << 31)) * sqrt(3) * s->noise_mult;"

In removable\cd\ntddstor.h, append "&& !defined( __MINGW32__ )" to the line ending with "&& !defined( SYS_CYGWIN )".

Compilation and installation:
Start up a Command Prompt and enter:
Quote:
set PATH=D:\PathToMingw\bin
d:\PathToPython\python setup.py build_py
d:\PathToPython\python setup.py build_ext -DHAVE_MMX
d:\PathToPython\python setup.py bdist_wininst

The dist folder now contains a setup file for installing PyMedia. Doubleclick it Smile


Just for the record (for anybody stumbling over this thread in a year or so): gcc --version gives "gcc (GCC) 3.4.5 (mingw-vista special r3)". python -c "import sys; print sys.version" gives "2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)]".
Back to top
View user's profile Send private message
ratchse



Joined: 16 Feb 2010
Posts: 1

PostPosted: Tue Feb 16, 2010 5:57 pm    Post subject: Reply with quote

Quote:


C:\Documents and Settings\ddd\Desktop\Lib\pymedia-1.3.7.3>setup.py build_py
Using WINDOWS configuration...

Path for OGG not found.
Path for VORBIS not found.
Path for FAAD not found.
Path for MP3LAME not found.
Path for VORBISENC not found.
Path for ALSA not found.
Continue building pymedia ? [Y,n]:Y
running build_py

C:\Documents and Settings\ddd\Desktop\Lib\pymedia-1.3.7.3>setup.py build_ext -DHAVE_MMX
Using WINDOWS configuration...

Path for OGG not found.
Path for VORBIS not found.
Path for FAAD not found.
Path for MP3LAME not found.
Path for VORBISENC not found.
Path for ALSA not found.
Continue building pymedia ? [Y,n]:Y
running build_ext
building 'pymedia.audio.acodec' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DBUILD_NUM=1879 -DWIN32 -DHAVE_AV_CONFIG_H -DUDF_CA
CHE=1 -DHAVE_MMX=1 "-IC:\Documents and Settings\ddd\Desktop\Lib\pymedia-1.3.7.3" -Iaudio/ -IC:\Py
thon26\include -IC:\Python26\PC -c audio\acodec/acodec.c -o build\temp.win32-2.6\Release\audio\acode
c\acodec.o
In file included from audio\acodec/acodec.c:31:
audio/libavcodec/dsputil.h:485: warning: static declaration of 'lrintf' follows non-static declarati
on
audio\acodec/acodec.c:249: warning: initialization from incompatible pointer type
audio\acodec/acodec.c:250: error: initializer element is not constant
audio\acodec/acodec.c:250: error: (near initialization for `ACStringType.tp_getattro')
audio\acodec/acodec.c:272: error: initializer element is not constant
audio\acodec/acodec.c:272: error: (near initialization for `ACStringType.tp_free')
audio\acodec/acodec.c:422: error: initializer element is not constant
audio\acodec/acodec.c:422: error: (near initialization for `FrameType.tp_getattro')
audio\acodec/acodec.c:442: error: initializer element is not constant
audio\acodec/acodec.c:442: error: (near initialization for `FrameType.tp_alloc')
audio\acodec/acodec.c:444: error: initializer element is not constant
audio\acodec/acodec.c:444: error: (near initialization for `FrameType.tp_free')
audio\acodec/acodec.c:840: error: initializer element is not constant
audio\acodec/acodec.c:840: error: (near initialization for `DecoderType.tp_getattro')
audio\acodec/acodec.c:860: error: initializer element is not constant
audio\acodec/acodec.c:860: error: (near initialization for `DecoderType.tp_alloc')
audio\acodec/acodec.c:862: error: initializer element is not constant
audio\acodec/acodec.c:862: error: (near initialization for `DecoderType.tp_free')
audio\acodec/acodec.c:904: error: initializer element is not constant
audio\acodec/acodec.c:904: error: (near initialization for `EncoderType.tp_getattro')
audio\acodec/acodec.c:924: error: initializer element is not constant
audio\acodec/acodec.c:924: error: (near initialization for `EncoderType.tp_alloc')
audio\acodec/acodec.c:926: error: initializer element is not constant
audio\acodec/acodec.c:926: error: (near initialization for `EncoderType.tp_free')
error: command 'gcc' failed with exit status 1


I still can't build it.
help me please.
Back to top
View user's profile Send private message
f0k
Newbie


Joined: 07 Aug 2009
Posts: 5

PostPosted: Thu Feb 18, 2010 4:37 am    Post subject: Reply with quote

Did you use my modified PyMedia sources and did you perform the changes to Python's pyport.h as indicated in my posting ("Python modifications")? As far as I know, my changes still did not make it into the official Python release (see bugs.python.org/issue6672).
If you still cannot get it to work, send me your email address in a private message and I will send you an installer for PyMedia by email.
Back to top
View user's profile Send private message
f0k
Newbie


Joined: 07 Aug 2009
Posts: 5

PostPosted: Sun Mar 28, 2010 6:32 pm    Post subject: PyMedia installer Reply with quote

As I am repeatedly asked for the PyMedia installer because my building instructions do not seem to work for everybody, I decided to upload my binaries for you to download.
Python 2.6 installer: www.f0k.de/pub/pymedia-1.3.7.3.win32-py2.6.exe
Python 2.5 installer: www.f0k.de/pub/pymedia-1.3.7.3.win32-py2.5.exe
Modified PyMedia source: www.f0k.de/pub/pymedia-1.3.7.3-fixed.zip
These binaries do not include any of the additional libraries, so you cannot produce MP3 files or read Ogg Vorbis with them, but everything else should work.
I hope I do not infringe the licence in any way by posting these binaries. If so, please let me know and I will remove the download links again.
Have fun!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    InDashPC.org Forum Index -> Software All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group