coala / coala-bears

Bears for coala
https://coala.io/
GNU Affero General Public License v3.0
294 stars 580 forks source link

pkg_resources.ContextualVersionConflict #2992

Closed Mryanhehe closed 2 years ago

Mryanhehe commented 3 years ago

head -n 1 /etc/issue : Ubuntu 18.04.2 LTS

Installing coala-bears resulted in this , which I havent seen before.

/home/ubuntu/coala-tutorial# coala --files=src/\*.c --bears=SpaceConsistencyBear --save [ERROR][15:12:25] There is a conflict in the version of a dependency you have installed and the requirements of coala. This may be resolved by creating a separate virtual environment for coala or runningpip install "pyyaml~=3.12"`. Be aware that the latter solution might break other python packages that depend on the currently installed version. [INFO][15:12:25] Exception was: Traceback (most recent call last):

File "/usr/local/lib/python3.6/dist-packages/coalib/coala_main.py", line 81, in run_coala arg_list=arg_list)

File "/usr/local/lib/python3.6/dist-packages/coalib/settings/ConfigurationGathering.py", line 387, in gather_configuration log_printer)

File "/usr/local/lib/python3.6/dist-packages/coalib/settings/SectionFilling.py", line 31, in fill_settings bear_dirs = section.bear_dirs()

File "/usr/local/lib/python3.6/dist-packages/coalib/settings/Section.py", line 116, in bear_dirs for bear_dir in collect_registered_bears_dirs('coalabears')]

File "/usr/local/lib/python3.6/dist-packages/coalib/collecting/Collectors.py", line 307, in collect_registered_bears_dirs registered_package = ep.load()

File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2323, in load self.require(*args, **kwargs)

File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2346, in require items = working_set.resolve(reqs, env, installer, extras=self.extras)

File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 783, in resolve raise VersionConflict(dist, req).with_context(dependent_req)

pkg_resources.VersionConflict: (PyYAML 5.4.1 (/usr/local/lib/python3.6/dist-packages), Requirement.parse('pyyaml~=3.12'))`

It's my PyYAML information pip3 show PyYAML: Home-page: https://pyyaml.org/ Author: Kirill Simonov Author-email: xi@resolvent.net License: MIT Location: /usr/local/lib/python3.6/dist-packages Requires:

I follow the system prompts ,then I code " pip3 install pyyaml~=3.12"

pip3 show PyYAML Name: PyYAML Version: 3.13 Summary: YAML parser and emitter for Python Home-page: http://pyyaml.org/wiki/PyYAML Author: Kirill Simonov Author-email: xi@resolvent.net License: MIT Location: /usr/local/lib/python3.6/dist-packages Requires:

but it still goes wrong /home/ubuntu/coala-tutorial# coala --files=src/\*.c --bears=SpaceConsistencyBear --save [ERROR][15:14:24] There is a conflict in the version of a dependency you have installed and the requirements of coala. This may be resolved by creating a separate virtual environment for coala or runningpip install "PyYAML>=5.3.1"`. Be aware that the latter solution might break other python packages that depend on the currently installed version. [INFO][15:14:24] Exception was: Traceback (most recent call last):

File "/usr/local/lib/python3.6/dist-packages/coalib/coala_main.py", line 81, in run_coala arg_list=arg_list)

File "/usr/local/lib/python3.6/dist-packages/coalib/settings/ConfigurationGathering.py", line 387, in gather_configuration log_printer)

File "/usr/local/lib/python3.6/dist-packages/coalib/settings/SectionFilling.py", line 31, in fill_settings bear_dirs = section.bear_dirs()

File "/usr/local/lib/python3.6/dist-packages/coalib/settings/Section.py", line 116, in bear_dirs for bear_dir in collect_registered_bears_dirs('coalabears')]

File "/usr/local/lib/python3.6/dist-packages/coalib/collecting/Collectors.py", line 307, in collect_registered_bears_dirs registered_package = ep.load()

File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2323, in load self.require(*args, **kwargs)

File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2346, in require items = working_set.resolve(reqs, env, installer, extras=self.extras)

File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 783, in resolve raise VersionConflict(dist, req).with_context(dependent_req)

pkg_resources.ContextualVersionConflict: (PyYAML 3.13 (/usr/local/lib/python3.6/dist-packages), Requirement.parse('PyYAML>=5.3.1'), {'bandit'})`

how to fix it ?