PaloAltoNetworks / minemeld-ansible

Ansible playbook for installing MineMeld on Linux
Apache License 2.0
48 stars 48 forks source link

Core installation fails with NameError: global name 'get_installed_distributions' is not defined #47

Open goniomdq opened 6 years ago

goniomdq commented 6 years ago

According to this https://github.com/pypa/pip/issues/5243 you are no longer allowed to us get_installed_distributions from PIP. Instead, you are meant to use working_set from pkg_resources. I've changed the code to use this and works fine. However, I'm not a developer, so not sure the code is 100% correct. Patch follows:

--- loader.py.bak       2018-10-16 09:27:52.565683157 +1300
+++ loader.py   2018-10-16 09:33:41.806177088 +1300
@@ -2,7 +2,7 @@

 import pip

-from pkg_resources import WorkingSet, _initialize_master_working_set, parse_version
+from pkg_resources import WorkingSet, _initialize_master_working_set, parse_version, working_set
 from collections import namedtuple

 try:
@@ -33,10 +33,10 @@

 def _installed_versions():
-    if parse_version(pip.__version__) >= parse_version('10.0.0'):
-        installed_dists = get_installed_distributions(local_only=False)
-    else:
-        installed_dists = get_installed_distributions()
+#    if parse_version(pip.__version__) >= parse_version('10.0.0'):
+#        installed_dists = get_installed_distributions(local_only=False)
+#    else:
+    installed_dists = working_set

     return {d.project_name: d for d in installed_dists}
iamtimroberts commented 6 years ago

Ran into this same issue. Used the changes above and commented out the git section of the playbook and successfully installed minemeld. Thanks!

jtschichold commented 6 years ago

Thanks @goniomdq. We just merged a fix for this (PaloAltoNetworks/minemeld-core#300). Could you try?