docker-compose fails due to missing `distutils` module
cartergrobinson opened this issue · comments
I encountered an issue while trying to run docker-compose
using the docker-compose.dev.yaml
file in the Farfalle project.
First, I ran:
docker-compose -f docker-compose.dev.yaml up -d
The command fails with the following traceback:
Traceback (most recent call last):
File "/usr/bin/docker-compose", line 33, in <module>
sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')())
File "/usr/bin/docker-compose", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 9, in <module>
from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils'
I attempted to install distutils
:
sudo apt-get install python3-distutils
However, this package was not available:
Package python3-distutils is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python3-distutils' has no installation candidate
I searched online and it looks like this packaged is deprecated/possibly removed in 3.12.
Could my use of Python 3.12 be causing any compatibility issues? If so, which version should I be running? Are there additional setup steps or dependencies I might be missing? I'm running Ubuntu 23.04 if that makes a difference. I saw the thread in /r/selfhosted and many voicing support for a container. If you have the time to put one together, I would love one!
I was running this on one of my computers with other containers that could be causes conflict. I could spin up a VM, but I'm curious what the dependencies are?
Instead of using docker-compose
, use docker compose
as i had the same issue when i upgraded my ubuntu to 24.10. Also you will need to give sudo permissions as those were needed for it to work and then reboot and try.