homebrew on Leopard fails to install

illume avatarillume created an issue

There is a report of homebrew failing to install on OS X Leopard.

Following the directions at this url there is an error: http://www.daskrachen.com/2011/03/installing-pygame-using-homebrew.html

Comments (35)

  1. illume

    I got this working on OSX Lion:

    brew install python
    /usr/local/share/python/easy_install mecurial
    
    brew install sdl
    brew install sdl_mixer
    brew install sdl_ttf
    brew install sdl_image
    
    hg clone https://bitbucket.org/pygame/pygame
    cd pygame
    /usr/local/bin/python setup.py install
    

    I tried to create a basic foruma to do it, but it failed to build so far.

    I tried this `/usr/local/share/python/pip install pygame` But there is an error with the the camera module on x64 with SeqGrabComponent and friends stuff on osx Lion.

  2. beniamino38

    Homebrew doesn't duplicate other packaging systems, so they won't accept a pygame brew (since it would duplicate pip install pygame).

    As of today, I can successfully(*) install pygame for the system python using:

    brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi sudo pip install hg+http://bitbucket.org/pygame/pygame

    I think this is about as easy as it can get.

    (*)When I do pygame.init(), it crashes with some issue about bumpy arrays (float96) but I guess this is a separate issue.

  3. illume

    Cool, thanks for the info.

    I fixed that float96 issue with numpy now.

    So some updated instructions:

    How to install via the python in your path (likely the apple python):

    brew install sdl sdl_image sdl_mixer sdl_ttf portmidi 
    sudo pip install hg+http://bitbucket.org/pygame/pygame
    

    How to install to the brew supplied python.

    brew install python
    brew install sdl sdl_image sdl_mixer sdl_ttf portmidi 
    /usr/local/share/python/pip install hg+http://bitbucket.org/pygame/pygame
    
  4. Anonymous

    i just tried the first brew instruction to install pygame and i received the error message "hg command not found"

  5. illume
    • changed status to open

    Hello,

    ah, ok. I've updated the instructions to list installing mercurial first.

    I hope it works this time.

    cheers,


    Install mercurial from the .dmg from http://mercurial.selenic.com/ Or install mercurial via brew:

    brew install mercurial
    

    How to install via the python in your path (likely the apple python):

    brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi 
    sudo pip install hg+http://bitbucket.org/pygame/pygame
    

    How to install to the brew supplied python.

    brew install python
    brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi 
    /usr/local/share/python/pip install hg+http://bitbucket.org/pygame/pygame
    
  6. Ory Band

    I am receiving the following error when trying to

    ~$ brew list
    cmake			gdbm			libmikmod		node			readline		sdl_ttf
    ctags			git			libogg			pkg-config		sdl			smpeg
    dos2unix		google-app-engine	libvorbis		portmidi		sdl_image		sqlite
    flac			lame			macvim			python			sdl_mixer
    
    ~$ hg --version
    Mercurial Distributed SCM (version 1.9.1)
    
    ~$ which pip
    /usr/local/share/python/pip
    
    ~$ pip install hg+http://bitbucket.org/pygame/pygame
    Downloading/unpacking hg+http://bitbucket.org/pygame/pygame
      Cloning hg http://bitbucket.org/pygame/pygame to /var/folders/YY/YYOJp8QIH2CUgOPkMSfo0U+++TI/-Tmp-/pip-XOlq4e-build
    ** unknown exception encountered, please report by visiting
    **  http://mercurial.selenic.com/wiki/BugTracker
    ** Python 2.7.2 (default, Sep  7 2011, 03:24:05) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
    ** Mercurial Distributed SCM (version 1.9.1)
    ** Extensions loaded: hgattic, extdiff, color, pager
    Traceback (most recent call last):
      File "/usr/local/share/python/hg", line 38, in <module>
        mercurial.dispatch.run()
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/dispatch.py", line 27, in run
        sys.exit(dispatch(request(sys.argv[1:])))
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/dispatch.py", line 64, in dispatch
        return _runcatch(req)
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/dispatch.py", line 87, in _runcatch
        return _dispatch(req)
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/dispatch.py", line 679, in _dispatch
        cmdpats, cmdoptions)
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/dispatch.py", line 454, in runcommand
        ret = _runcommand(ui, options, cmd, d)
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/extensions.py", line 182, in wrap
        return wrapper(origfn, *args, **kwargs)
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/hgext/pager.py", line 107, in pagecmd
        return orig(ui, options, cmd, cmdfunc)
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/extensions.py", line 182, in wrap
        return wrapper(origfn, *args, **kwargs)
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/hgext/color.py", line 368, in colorcmd
        return orig(ui_, opts, cmd, cmdfunc)
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/dispatch.py", line 733, in _runcommand
        return checkargs()
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/dispatch.py", line 687, in checkargs
        return cmdfunc()
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/dispatch.py", line 676, in <lambda>
        d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/util.py", line 385, in check
        return func(*args, **kwargs)
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/commands.py", line 1041, in clone
        branch=opts.get('branch'))
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/hg.py", line 317, in clone
        create=True)
      File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/mercurial/hg.py", line 98, in repository
        hook(ui, repo)
      File "/Users/ory/.hg/extensions/attic.py", line 693, in reposetup
        repo.attic = attic(ui, repo.join(''))
      File "/Users/ory/.hg/extensions/attic.py", line 60, in __init__
        self.opener = util.opener(self.path)
    AttributeError: 'module' object has no attribute 'opener'
      Complete output from command /usr/local/share/python/hg clone --noupdate -q http://bitbucket.org/pygame/pygame /var/folders/YY/YYOJp8QIH2CUgOPkMSfo0U+++TI/-Tmp-/pip-XOlq4e-build:
      
    ----------------------------------------
    Command /usr/local/share/python/hg clone --noupdate -q http://bitbucket.org/pygame/pygame /var/folders/YY/YYOJp8QIH2CUgOPkMSfo0U+++TI/-Tmp-/pip-XOlq4e-build failed with error code 1
    Storing complete log in /Users/ory/.pip/pip.log
    

    Any idea? :)

  7. Ory Band

    Never mind my last error, I fixed it. Was caused by a bad Mercurial plugin I installed (hg attic).

    This error is unrelated to PyGame or Homebrew. Carry on now, move along with your daily lives, nothing to see here. :)

  8. Anonymous

    I get:

    Error: This is a head-only formula; install with `brew install --HEAD smpeg`

    So having to do that step separately.

  9. acidjunk

    Installed all deps via homebrew. Running latest xcode 4.3.

    When I run /usr/local/share/python/pip install hg+http://bitbucket.org/pygame/pygame It fails with an clang error.

    In file included from src/scale_mmx.c:33:

    src/scale_mmx64.c:424:27: error: invalid instruction mnemonic 'movsxl'

    asm volatile( " /* MMX code for inner loop of X bilinear filter */ "

    ^

    <inline asm>:1:191: note: instantiated into assembly here

    /* MMX code for inner loop of X bilinear filter */ movl -44(%rbp), %ecx; pxor %mm0, %mm0; 1: movsxl (%rdi), %rax; add $4, %rdi; movq (%r10), %mm1; add $8, %r10; movq (%rbx), %mm2; add $8, %rbx; movd (%r15,%rax,4), %mm4; movd 4(%r15,%rax,4), %mm5; punpcklbw %mm0, %mm4; punpcklbw %mm0, %mm5; pmullw %mm1, %mm4; pmullw %mm2, %mm5; paddw %mm4, %mm5; psrlw $8, %mm5; packuswb %mm0, %mm5; movd %mm5, (%r9); add $4, %r9; decl %ecx; jne 1b; emms;

    ^~~~~

    In file included from src/scale_mmx.c:33:

    src/scale_mmx64.c:499:27: error: invalid instruction mnemonic 'movsxl'

    asm volatile( " /* MMX code for inner loop of X bilinear filter */ "

    ^

    <inline asm>:1:191: note: instantiated into assembly here

    /* MMX code for inner loop of X bilinear filter */ movl -44(%rbp), %ecx; pxor %mm0, %mm0; 1: movsxl (%rdi), %rax; add $4, %rdi; movq (%r10), %mm1; add $8, %r10; movq (%rbx), %mm2; add $8, %rbx; movd (%r15,%rax,4), %mm4; movd 4(%r15,%rax,4), %mm5; punpcklbw %mm0, %mm4; punpcklbw %mm0, %mm5; pmullw %mm1, %mm4; pmullw %mm2, %mm5; paddw %mm4, %mm5; psrlw $8, %mm5; packuswb %mm0, %mm5; movd %mm5, (%r9); add $4, %r9; decl %ecx; jne 1b; emms;

    ^~~~~

    2 errors generated.

    error: command '/usr/bin/clang' failed with exit status 1

    I think the patch at https://bitbucket.org/pygame/pygame/issue/94/src-scale_mmx64c-cannot-be-compiled-with fixes the problem. I don't know how to apply the patch.

  10. acidjunk

    I retried my build with Xcode 4.2.1: and It builds pygame just fine for pyhone homebrew Should I open another ticket for the Xcode 4.3 issue?

  11. Anonymous

    This problem is still very much alive for users who have Lion and Xcode 4.3 installed. Modifying the file src/scale_mmx64.c to use the 'movslq' opcode instead of 'movsxl' allows successful installation. It seems like an easy problem to fix in the sourse base.

  12. Anonymous

    I am running OSX Snow Leopard 10.6.8 with Python 2.7 and am running into an issue.

    At one point I had both Fink and Homebrew installed. I don't know if this is causing the below issue but I thought I'd mention it. Right now I only have Homebrew installed. While recently trying to install Python Imaging Library, I decided to clean up my installations by having Homebrew handle what it could. I uninstalled Python and ran the code suggested in this thread by illume:

    brew install python
    brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi 
    /usr/local/share/python/pip install hg+http://bitbucket.org/pygame/pygame
    

    then I ran:

    brew install pil
    

    This all seemed to work really well. Except trying

    brew doctor
    

    came up with libraries that Homebrew didn't create, and it suggested deleting them. Knowing that there might be some consequences, I went ahead a deleted them.

    Now when I run some very simple code to load a .jpg (without using PIL), it fails to load and I receive the following message:

    File is not a Windows BMP file
    

    Here is what 'brew list' looks like:

    ~$ brew list
    cmake		libmikmod	mercurial	readline	smpeg
    flac		libogg		node		ruby		sqlite
    gdbm		libtiff		pil		sdl		xz
    git		libvorbis	pkg-config	sdl_image
    jpeg		libyaml		portmidi	sdl_mixer
    lame		little-cms	python		sdl_ttf
    

    Here is the relevant python code:

    import pygame
    import os
    import math
    from pygame import *
    
    def load_image(name, colorkey=None):
        print "loading %s" %name
        fullname = os.path.join('images', name)
        try:
            image = pygame.image.load(fullname)
        except pygame.error, message:
            print 'Cannot load image:', name
            raise SystemExit, message
        image = image.convert()
        if colorkey is not None:
            if colorkey is -1:
                colorkey = image.get_at((0,0))
            image.set_colorkey(colorkey, RLEACCEL)
        return image, image.get_rect()
    
    def main():
        pygame.init()
        bg = Surface((32, 32))
        bg, bg_rect = load_image('bg02.jpg')
    
    if(__name__== "__main__"):
        main()
    

    I'm worried this has something to do with the libraries Homebrew asked me to delete, though sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi are all installed. Any help would be much appreciated!

  13. Joe Maller

    Samuel John Your recipe compiled, but I had to pip install nose and brew install --HEAD smpeg before brew install pygame would work (with a long list of auto-installed dependencies). Unfortunately though, I wasn't able to get Python to import the module.

  14. Gabriel Le Breton

    I ran into a couple of problems trying to install pygame for the first time on my mac with HomeBrew, so here's what I did.

    I couldn't install smpeg, I was getting

    Error: No available formula for smpeg
    

    so I just tapped homebrew/headonly:

    brew tap homebrew/headonly
    

    brew install --HEAD smpeg worked fine but during pygame installation, I also had to tap another repo.

    brew tap homebrew/science
    

    Then, I installed nose with pip and gfortran from brew

    pip install nose
    brew install gfortran
    

    After everything was fine

    brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi 
    sudo pip install hg+http://bitbucket.org/pygame/pygame
    

    And voilà, import pygame works! :)

  15. epifanio

    i'm triying to follow you guys .. but my brew fail to install smpeg .. i got this :

    MacBook-Pro-di-Massimo:Library epi$ brew install --HEAD smpeg
    ==> Checking out svn://svn.icculus.org/smpeg/trunk
    ==> ./autogen.sh
    ==> ./configure --prefix=/usr/local/Cellar/smpeg/HEAD --disable-sdltest --with-sdl-prefix=/usr/local/opt/sdl
    ==> make
    make: *** [MPEGstream.lo] Error 1
    1 error generated.
    make: *** [MPEGsystem.lo] Error 1
    1 error generated.
    make: *** [MPEG.lo] Error 1
    

    debug log : https://gist.github.com/epifanio/5074298

    thanks a lot for your help!

  16. Laurens Van Houtven

    For those unfamiliar with ruby, keep in mind you also need to add a comma, so the head line ends up looking like:

      head 'svn://svn.icculus.org/smpeg/trunk', :revision => '398'
    
  17. Zsombor Nagy

    Hi! I installed pygame from the samueljohn/python tap on os x 10.8.3, and I cannot play ogg files for some reason, it says "Unrecognized music format". I cannot decide if it's a brew related problem, or something else. Anybody has a hint?

  18. pkim4

    I was able to install pygame using both samueljohn/homebrew-python tag and the solution posted here on my OS X 10.7.5 Lion. However, I am also facing the issue of not having music (.wav and .ogg file) playing. I know this is a Mac Homebrew specific issue, because the script runs fine on my Windows machine and I can hear the sounds. This is extremely frustrating. I'm about to try installing python via homebrew once again and try to install the .dmg file provided in the pygame downloads page. I am running out of options and might need to resort to installing python from python.org instead of using homebrew. BTW, I've tried using MacPorts to install Python and Pygame successfully. Unfortunately, I had problems with wxpython (which is why I tried Homebrew). Really running out of options for a decent Pygame support on Mac without going through days of "making it work"

  19. illume

    Compilation works with clang now. I removed smpeg from the homebrew install instructions because smpeg is not in homebrew any more.

  20. blurback

    The pygame downloads page links to illume comment for "homebrew install instructions".

    I also had an issue with sound, would recommend using:

    brew install libvorbis sdl sdl_image sdl_mixer sdl_ttf portmidi 
    # activate virtual env or use sudo:
    pip install hg+http://bitbucket.org/pygame/pygame
    

    Would it be possible to create a wiki page here on bitbucket and link to it?

  21. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.