pythondocker-composelinuxbrew

docker-compose up, bad interpreter, is looking for the wrong path for python executable


When I run docker-compose up

I get the error

zsh: /home/emil/.local/bin/docker-compose: bad interpreter: /home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.16/bin/python: no such file or directory

I checked which python and I get /home/linuxbrew/.linuxbrew/bin/python

I tried to system link

➜ 2.7.16 ln -s /home/linuxbrew/.linuxbrew/bin/python home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.16/bin/python ln: failed to create symbolic link 'home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.16/bin/python': No such file or directory ➜ 2.7.16 ln -s home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.16/bin/python /home/linuxbrew/.linuxbrew/bin/python ln: failed to create symbolic link '/home/linuxbrew/.linuxbrew/bin/python': File exists

At the moment linux brew python installation is at 2.7.16_1 folder not 2.7.16. How do I fix this ? I want to create link so whenever it looks for python at 2.7.16/bin/python it should rather look into 2.7.16_1/bin/python.

Is this even possible ?

And how can I solve this, any ideas ? I tried uninstalling and reinstalling docker and python.


Solution

  • I found the solution.

    I uninstalled docker apt remove docker as it is suggested at their website

    sudo apt-get remove docker docker-engine docker.io containerd runc
    

    then I had installed docker and docker-compose using linuxbrew.

    But it was still somehow using the /home/username/.local/bin/docker-compose, so I deleted it. I figured that once i ran docker-compose, it gave the same error but also ran successfully. Somehow it was running both of the executables.

    So I just rm /home/username/.local/bin/docker-compose and it was fixed.