Compose: Binary on darwin fails with "illegal instruction" on some machines

Created on 25 Jun 2014  ·  98Comments  ·  Source: docker/compose

The current fig release doesn’t work for me:

$ fig
-bash: fig: command not found

$ curl -L https://github.com/orchardup/fig/releases/download/0.4.2/darwin > /usr/local/bin/fig
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   329  100   329    0     0    329      0  0:00:01 --:--:--  0:00:01   329
100 3860k  100 3860k    0     0   625k      0  0:00:06  0:00:06 --:--:--  842k

$ chmod +x /usr/local/bin/fig

$ fig
Illegal instruction: 4

I’m running OS X 10.9.3 on a 1.6 GHz Intel Core 2 Duo (Late 2010 MacBook Air).

arepackaging kinbug

Most helpful comment

In seriousness... we shouldn't be shipping binaries that don't work on some machines. Or, we should at least try and figure out which machines it doesn'tw ork on and give alternate instructions. (E.g. "If you have a processor older than an Intel i5/i7, then you need to use pip.")

All 98 comments

Does run for me and I did the same steps

-> fig --version
fig 0.4.2

Darwin ... 13.2.0 Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64

@tomstuart Are you still getting this error?

I am getting the same.

Mid 2009 13-inch 10.9.3

@tomstuart have you replaced the system Python with something else? Can you try 0.5.0?

I have the same issue
Darwin Kernel Version 13.3.0
Python 2.7.8

was able to solve this by installing python with homebrew then fig with pip

Can confirm that @ndeloof solution worked for me.

I had installed via curl as per the fig site suggested on a clean reinstall of Mavericks. Got the 'illegal instruction' error.

Mv'd /usr/local/bin/fig. Ran brew python and then pip install fig

All working fine now. (Well, the Rails demo has at least)

Having this issue with OSX version 10.9.5 and Python 2.7.8 for fig 1.0.0. It was solved by using pip to install, rather then curl

@sirwolfgang What is the model of the Mac you are using?

MacBook Pro 6,2 (15" Mid 2010)

FYI same issue on a 2009 27'' iMac with Core i7 (iMac11,1). Installed via pip instead, seems ok.

Same issue here with a 2009 15" MacBook Pro running OSX 10.9.5.

brew install python; pip install fig

worked for me.

I got the same error @tomstuart had, when trying to curl fig-1.0.1.

Mac OS X 10.10.1
Python 2.7.8
Darwin 14.0.0

Fixed with @ndeloof solution (pip).

:+1: for the solution posted by @ndeloof

Everyone seems happy with the homebrew/pip solution (and I don’t care any more), so I’ll close this issue.

I care, Tom.

In seriousness... we shouldn't be shipping binaries that don't work on some machines. Or, we should at least try and figure out which machines it doesn'tw ork on and give alternate instructions. (E.g. "If you have a processor older than an Intel i5/i7, then you need to use pip.")

I have the same problem +1

I saw the same, +1, as requested below:

Model Name: iMac
Model Identifier: iMac11,3
Processor Name: Intel Core i5
Processor Speed: 3.6 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache (per Core): 256 KB
L3 Cache: 4 MB
Memory: 8 GB
Processor Interconnect Speed: 6.4 GT/s
Boot ROM Version: IM112.0057.B01
SMC Version (system): 1.59f2

If your additional having the issue, could you please also include the hardware that your using? Rather then just +1ing it.

+1

fig: 1.0.1
python: 2.7.5
OS X: 10.9.5

Model Name: MacBook
Model Identifier: MacBook6,1 (Late 2009)
Processor Name: Intel Core 2 Duo
Processor Speed: 2.26 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache: 3 MB
Memory: 4 GB
Bus Speed: 1.07 GHz
Boot ROM Version: MB61.00C8.B00
SMC Version (system): 1.51f53

We hit this over here, too.

I'd really love to see docker-compose working on vanilla OSX.

fig: 1.1.0-rc2
python: 2.7.5
OS X: 10.9.5

Model Name: MacBook
Model Identifier: MacBook5,2 (Early 2009)
Processor Name: Intel Core 2 Duo
Processor Speed: 2 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache: 3 MB
Memory: 4 GB
Bus Speed: 1.07 GHz

:+1:

Model Name: MacBook Pro
Model Identifier: MacBookPro5,4
Processor Name: Intel Core 2 Duo
Processor Speed: 2.53 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache: 3 MB
Memory: 4 GB
Bus Speed: 1.07 GHz
Boot ROM Version: MBP53.00AC.B03
SMC Version (system): 1.49f2

$ sysctl -n machdep.cpu.brand_string
Intel(R) Core(TM) i7 CPU M 640 @ 2.80GHz

Had the same issue but
brew install python
pip install -U pip
fixed it for me

Not sure why but installing python by downloading their package installer (2.7.9) and install Fig with curl gave me the Illegal instruction: 4 error when running fig --version

"Fixing it" by using 3rd party software is known to work. It also works if I start my virtualbox debian and install fig in there.

Same issue for me on Yosemite. I have python installed, but not pip. Running the fig 1.0.1 binary downloaded from github resulted in an "Illegal instruction: 4".

To fix it, all I had to do was install pip and then that same fig binary worked. Didn't even need to run "pip install fig" - just executed the fig binary again and the error didn't happen.

I'm doubtful that this is a hardware specific issue. Isn't it more likely that pip installed/updated some library that the raw fig binary depends on?

Has anyone ever been able to run the fig binary, without having pip already installed? Its fairly common to have pip these days...

@kulinski Are you absolutely certain you ran the same binary before and after?

@kulinski 's way is not working, at least not on my machine.

Note: docker-compose = fig

Steps:

  • virtualenv'ed python
  • installed pip
  • DL latest fig release
  • Mv fig to virtualenv
  • Run fig
  • Illegal instruction: 4

Oh and yes: I double checked that fig was not installed on my machine. So there is no way I could have run the wrong binary

+1

$ docker-compose
Illegal instruction: 4

Model : MacBookPro5,5 (13" mid-2009 - Core 2 Duo)
OS : 10.10.2
Python : 2.7.6

But docker-compose works fine on my iMac :
Model : iMac12,2 (27" mid-2011 - Core i5)
OS : 10.9.5
Python : 2.7.5

Actual fig binary worked fine on both up to 1.0.1 !

tryin to build bytecoin using instructions here: http://bytecoin.org/mac-download?binaries
failing with "Illegal instruction: 4" tried to fix using:
brew install python; pip install fig, still no joy
machine details:
Mac mini 2009
Processor 2 GHz Intel Core 2 Duo
Memory 5 GB 1067 MHz DDR3
Graphics NVIDIA GeForce 9400 256 MB
oftware OS X 10.9.5 (13F34)

Same problem here.
Fig is working. Docker 1.5 working.
Just installed docker-compose latest and get Illegal Instruction: 4.
Mac Pro 2009 . Yosemite 10.10.2.

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   .Python                         0x0000000106cce5e6 _PyRandom_Init + 359
1   .Python                         0x0000000106ccbc2b Py_InitializeEx + 345
2   docker-compose                  0x0000000106bd4a13 0x106bd2000 + 10771
3   docker-compose                  0x0000000106bd3f38 0x106bd2000 + 7992
4   docker-compose                  0x0000000106be7cb8 0x106bd2000 + 89272
5   docker-compose                  0x0000000106bd37f4 0x106bd2000 + 6132

After rc2, the same with 1.1 release. :cry:

+1. Fig had worked fine, but the transition to docker-compose was pretty rough. Doing it through pip worked - some combination of removing the curl'd file, installing brew, upgrading things, running pip install, and restarting the terminal.

Model Name: MacBook Pro (this is the mid-late 2007 model. Running 10.10.1.)
Model Identifier: MacBookPro3,1
Processor Name: Intel Core 2 Duo
Processor Speed: 2.4 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache: 4 MB
Memory: 4 GB
Bus Speed: 800 MHz
Boot ROM Version: MBP31.0070.B07
SMC Version (system): 1.16f11

+1. Illegal Instruction: 4.

Installing through pip as @BrendanBerkley mentions worked for me

Model Name: MacBook
Model Identifier: MacBook6,1
Processor Name: Intel Core 2 Duo
Processor Speed: 2.26 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache: 3 MB
Memory: 8 GB
Bus Speed: 1.07 GHz
Boot ROM Version: MB61.00C8.B00
SMC Version (system): 1.51f53

+1

MacBook Pro "Core i5" 2.53 15" Mid-2010
2.53 GHz Core i5 (I5-540M)
Model ID: MacBookPro6,2

Works when installing from brew but I would like to try the new prerelease. https://github.com/docker/compose/releases/tag/1.2.0rc1 but then I get Illegal Instruction: 4.

@EloB docker-compose 1.1.0 works perfectly on older Macs when installing with pip install docker-compose

Can you try sudo pip install -U https://github.com/docker/compose/archive/1.2.0rc2.zip ?

As far as I know, OSX does not ship with pip.

So you can try this, but it seems some dependencies need to be updated with pip :

git clone https://github.com/docker/compose.git
cd compose
sudo python setup.py install

Or install pip with brew : brew install python which updates shipped Python binaries and installs pip.

Thanks installing with pip worked! :)

I have an old machine I'm trying to set up as a Docker host. It would be good to get this problem identified so I don't have to install a bunch of otherwise unused dependencies.

The discussion this far implies this is something new to 1.2 but I've verified that the problem also happens in 1.1

Using the binary throws:

[1]    10956 illegal hardware instruction  docker-compose

And after installing from pip (with python 3.4.3), it throws:

Traceback (most recent call last):
  File "/Users/Arthur/.pyenv/versions/3.4.3/lib/python3.4/site-packages/pkg_resources/__init__.py", line 612, in _build_master
    ws.require(__requires__)
  File "/Users/Arthur/.pyenv/versions/3.4.3/lib/python3.4/site-packages/pkg_resources/__init__.py", line 918, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/Users/Arthur/.pyenv/versions/3.4.3/lib/python3.4/site-packages/pkg_resources/__init__.py", line 810, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (requests 2.4.3 (/Users/Arthur/.pyenv/versions/3.4.3/lib/python3.4/site-packages), Requirement.parse('requests>=2.5.2'), {'docker-py'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/Arthur/.pyenv/versions/3.4.3/bin/docker-compose", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/Users/Arthur/.pyenv/versions/3.4.3/lib/python3.4/site-packages/pkg_resources/__init__.py", line 3018, in <module>
    working_set = WorkingSet._build_master()
  File "/Users/Arthur/.pyenv/versions/3.4.3/lib/python3.4/site-packages/pkg_resources/__init__.py", line 614, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/Users/Arthur/.pyenv/versions/3.4.3/lib/python3.4/site-packages/pkg_resources/__init__.py", line 627, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/Users/Arthur/.pyenv/versions/3.4.3/lib/python3.4/site-packages/pkg_resources/__init__.py", line 810, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (requests 2.4.3 (/Users/Arthur/.pyenv/versions/3.4.3/lib/python3.4/site-packages), Requirement.parse('requests>=2.5.2'), {'docker-py'})

I'm using an iMac with Yosemite, and I'd like to use docker-compose you know :/

Hi Haggen,

You should try update requests package try to use 'pip install --upgrade requests==2.5.2' and install docker-py too

@rfranca86 I got it working by using python 2.7.9, then simply pip install docker-compose and done! But I'm gonna try what you say later, thanks!

Installing via pip worked for me too.

When running docker compose on Mac OS 10.7.5 (Mac Pro Mid 2010)
Error:
Illegal instruction: 4

Fix:
brew install python
pip install docker-compose

Does not work. Re-installing using

curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-uname -s-uname -m > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

also does not work.

Download https://www.python.org/ftp/python/2.7.9/python-2.7.9-macosx10.6.pkg installer.
Install Python 2.7.9
pip install docker-compose also fails.

This is happening because by default, Homebrew builds Python with all of the optimizations that the build machine can support. Assuming the build is happening on a Mac with a Sandy Bridge or newer processor, those optimizations will include the use of AVX instructions. So the solution is to configure Homebrew to only use safe optimizations; I'd suggest "-O2 -fno-omit-frame-pointer" and nothing more.

pip installed successfully but i've got the following error while starting docker-compose:

$ docker-compose up
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 5, in <module>
    from pkg_resources import load_entry_point
...
pkg_resources.DistributionNotFound: six>=1.3.0,<2

i've updated to docker-compose 1.3.1 which fixed my issues.

cURL install method is not working for everyone as it seems... I also get the

Error:
Illegal instruction: 4

Funny thing is that I was going to install first with pip... Why not display pip as the default install method in the docker website? Whatever...

Installed 1.3.3 (latest release) with curl and getting this error:

$ docker-compose up
Illegal instruction: 4

OS X 10.9.5 MBP Late 2008

I struggled for two days and finally got. it. Use home-brew:

brew install docker
brew install docker-compose

but take care to get rid of whatever you installed beforehand and, may be, use

brew link --force openssl

but I am not sure whether the latter is necessary.

Got the idea because somebody somewhere stated that home-brew does not provide docker-compose

OSX 10.10.4 MBP Late 2007

Thanks, @apoigne. Your solution works for me.

You are welcome

Axel

Does anyone care to read the thread? This one is going in circles. It was "always" working with non-vanilla solutions like brew. This is not why this thread was created. It was created MORE THAN A YEAR AGO to highlight it non-working on VANILLA OSX.

I followed @josephpage and installed docker-compose from source :

$ git clone https://github.com/docker/compose.git
$ cd compose
$ sudo python setup.py install
$ docker-compose --version
docker-compose version: 1.4.0dev

@aanand it would be great if we had specific system requirements in terms of software / libraries. A lot of people posted their specs here. Do we have any idea why it does not work exactly? Sorry if I missed them if we do.

Yes, we do know why it doesn't work. As I posted earlier, the problem is that the Compose binary package for OS X uses the Python package from Homebrew. By default, Homebrew enables all of the CPU-specific compiler optimizations that are supported by the processor on the build machine. Specifically, assuming the build is done on a Mac with a Sandy Bridge or later processor, the version of Python compiled by Homebrew will use AVX. So the solution is to configure Homebrew at build time to use a more conservative set of optimizations. Someone needs to figure out how to do this in the Compose build scripts for OS X.

Thanks @mwcampbell. This is the Homebrew formula we use:

https://raw.githubusercontent.com/Homebrew/homebrew/1681e193e4d91c9620c4901efd4458d9b6fcda8e/Library/Formula/python.rb

I'm not sure how to configure Homebrew to disable AVX optimizations.

I have determined the CFLAGS passed when compiling Python:

$ /usr/local/bin/python
Python 2.7.9 (default, May  2 2015, 03:33:28) 
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
>>> sysconfig.get_config_var('CFLAGS')
'-fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes'

But I'm not sure which, if any of those, are the culprits, or how to disable them. Other than just downloading Python and compiling it ourselves. Certainly an option.

Came here to say +1.

Fixed it by uninstalling docker, boot2docker and fig, installing dockertoolbox, running it so the default machine gets initialized, remove dockertoolbox and install docker, docker-compose and docker-machine.

Then I had to install openssl and force link it.

Not the way it should be but at least it works on a MacbookPro5,3 and OS X 10.9.5

brew remove docker boot2docker fig
brew cask install dockertoolbox
# run the docker toolbox app to initialize the default machine
brew cask remove dockertoolbox
brew install docker docker-compose docker-machine
brew install openssl
brew link --force openssl

@Coaxial
Error: No available Cask for docker. Did you mean one of:
boot2docker boot2docker-status docker-compose docker-machine dockertoolbox

@dacz my bad, it should be brew install docker docker-compose docker-machine, not brew cask ...

Fixed after install compose with pip (osx 10.11)
sudo pip install -U docker-compose

I had same problem on a Macbook Pro Mid 2010,

I had the problem by installing from toolbox, I then tried the 1.4.2 version from brew install docker-compose and manual install from this:

curl -L https://github.com/docker/compose/releases/download/1.4.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

That was still failing.

I confirm this works:

sudo pip install -U docker-compose

Successfully installed PyYAML-3.11 docker-compose-1.4.2 docker-py-1.3.1 dockerpty-0.3.4 docopt-0.6.2 requests-2.6.2 six-1.10.0 texttable-0.8.3 websocket-client-0.32.0

sudo pip install -U docker-compose works for removing the Illegal instruction: 4 for me.
Getting python errors now when running docker-compose:

Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
    working_set.require(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: six>=1.3.0,<2

Installing sudo pip install distribute worked to fix the issue :)

Our new "install using pip" instructions suggest using a virtualenv to mitigate problems like this.

@antek-drzewiecki (or anyone else that hit this issue) I'd like to see if the binaries we build on travis have this same issue. If you have a minute could you try the master build: https://dl.bintray.com/docker-compose/master/docker-compose-Darwin-x86_64 and let me know if you get the same error.

Thanks!

@dnephin I got my dependencies solved now. So it's not like I'm on a clean install anymore.
I will uninstall the docker-compose pip and use the darwin binary you linked.

The dev version works, the steps I took:

$ sudo pip uninstall docker-compose
 Successfully uninstalled docker-compose-1.4.2

$ docker
docker          docker-machine  


$ curl -L https://dl.bintray.com/docker-compose/master/docker-compose-Darwin-x86_64  > /usr/local/bin/docker-compose
$ chmod +x /usr/local/bin/docker-compose
$ docker-compose --version
docker-compose version: 1.5.0dev

@antek-drzewiecki Thank you for trying it out! I think we should use these binaries for the release from now on.

@dnephin : It works on my config also :

  • Hackintosh on El Capitan 10.10
  • CPU : Core i7-950 (before Sandy bridge so)

Thanks for solving that, hope you'll have time to integrate in the 1.5.0 release :)

Same problem with docker toolbox 1.9 relase, on Mac OS X, running on a 2008 MacPro.

Are the binarys compiled with instruction set which excludes some older CPUs maybe?

@kolis Does the binary from https://dl.bintray.com/docker-compose/master/ work for you?

What version of OSX are you running?

I encountered the same problem after updating docker toolbox to 1.9.

The binary downloaded from https://dl.bintray.com/docker-compose/master/ solved the problem.

OS X 10.11.1 El Capitan
MacBook Pro 15 Mid 2010

@dnephin Yes, the bintray master version works fine, running OS X 10.11.1 (15B42)

For information, it is working fine with my config :

$ ./docker-compose-Darwin-x86_64 -version
docker-compose version: 1.6.0dev
$ sysctl -n machdep.cpu.brand_string
Intel(R) Core(TM) i7 CPU         950  @ 3.07GHz

BTW I'm on OS X 10.11 and have the latest toolbox (1.9.0c) installed.

@dnephin : what is the integration plan ? Release 1.6.0 ?

Thanks for the fix !

Any progress on this? Still having the error crop up when installed with brew cask on a mid 09 MacBook running Yosemite 10.10.5.

Installing using pip works for me.

Same problem in 1.6 release of docker-compose, and again, the bintray binary works

Same here. Running a Mac Pro 5,1 with 10.11.2. Bintray works.

We see this on OS X 10.10.5

Running a Mac Pro 5,1 with 10.11.2. Bintray works.

1.6.0 in docker-toolbox is still broken.

Can we at least change the download and install instructions on the main website? It's silly to have official how-to's that don't work.

Just ran across this. OS X 10.11.3,MacBook Pro (15-inch, Mid 2010).

Just installed on OS X 10.11.3 on a MacBook Pro (15-inch, 2.53GHz, Mid 2009) and I get the "Illegal instruction: 4"

I solved the issue without homebrew in this way:

first, download python official package from here: https://www.python.org/downloads/
will update local python and install pip. Now, in a new terminal session

sudo pip install fig
sudo pip uninstall docker-compose
sudo pip install —upgrade docker-compose
hash -r

@Elhodred Which version of Python? 2 or 3?

Python 2

Thanks @Elhodred it works!

Just ran into this on a mid-2010 Macbook pro

  Model Name:   MacBook Pro
  Model Identifier: MacBookPro6,2
  Processor Name:   Intel Core i7
  Processor Speed:  2.66 GHz
  Number of Processors: 1
  Total Number of Cores:    2
  L2 Cache (per Core):  256 KB
  L3 Cache: 4 MB
  Memory:   8 GB
  Processor Interconnect Speed: 4.8 GT/s
  Boot ROM Version: MBP61.0057.B11
  SMC Version (system): 1.58f17

This should now be fixed in the 1.7.0 release candidate.

Apologies, that link's broken. Correct URL:

https://github.com/docker/compose/releases/tag/1.7.0-rc1

Can anyone who's experienced this issue confirm whether or not the 1.7.0-rc1 binary fixes the issue for them?

yes @aanand it is now fixed. Thanks!

Hello @aanand ! Thanks for fixing that !

i7 950 with El Capitan 10.11.2 and i3 540 with 10.9.4 tested : success !

Fix is working on iMac (Mid 2010). Thanks @aanand. :)

I can confirm it works in 1.7.0-rc1 and 1.7.0-rc2 on my Mac mini (Mid 2010). Thank you!

@aanand I have a similar problem with my own software: we build on new macs but it needs to work on old ones. Your bug is pretty much the top google hit for "Illegal instruction: 4" :) Can you provide some details on your solution to enlighten the Internet? Did you just find old hardware to build on? Or set some compile time flags?

We started building on travisci, which fixes it for newer versions of OSX, but it doesn't run on older versions of OSX.

Was this page helpful?
0 / 5 - 0 ratings