Answer the question
In order to leave comments, you need to log in
How to fix error when running tests in docker via phpstorm?
When trying to run tests in phpstorm, an error appears. At the same time, the docker itself works fine. The problem is only when running tests.
The problem seems to have appeared after updating python, but I'm not sure. I tried to return to the old version - it did not help.
Error running 'tests': Process `docker-compose config` failed.
Traceback (most recent call last): File "/usr/bin/docker-compose", line 6, in from pkg_resources import load_entry_point
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3088, in
@_call_aside
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3072, in _call_aside f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3101, in _initialize_master_working_set working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 574, in _build_master ws.require(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 892, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 778, in resolve raise DistributionNotFound(req, requirers) pkg_resources.
DistributionNotFound: The 'docker-compose==1.17.1' distribution was not found and is required by the application
Error in sys.excepthook: Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in import apt File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was: Traceback (most recent call last):
File "/usr/bin/docker-compose", line 6, in from pkg_resources import load_entry_point File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3088, in
@_call_aside
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3072, in _call_aside f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3101, in _initialize_master_working_set
Answer the question
In order to leave comments, you need to log in
A similar DistributionNotFound problem occurred on Ubuntu after changing the /usr/bin/python link from python2 to python3. Changing the link back to python2 solved the problem.
sudo ln -sf python2.7 /usr/bin/python
Before that remove docker:
sudo apt-get remove docker-ce docker-ce-cli containerd.io
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question