3

I had various bugs in my GIS softwares (QGIS, ArcGIS) after uninstalling PyCharm from my computer (time limited school license). For a school assignment we had to change the PythonPATH and PythonHOME and after uninstalling the said IDE, some plugins stoped working in QGIS.

I uninstalled the programs, ran CCleaner to remove old registries and just re-installed these:

  • ArcGIS 10.2
  • OSGeo4W (including QGIS Lyon 2.12.3)
  • OpenGeoSuite 4.8 (without QGIS)
  • Python 2.7
  • PyScripter

Now the Processing toolbox and other plugins are corrupted and there is this error message:

AttributeError: 'module' object has no attribute 'openssl_md_meth_names'

Also, when the program starts I have other Python errors.

Impossible to load fTools plugin provokes error when calling classFactory()

(translated from french)

Here's the logfile:

Traceback (most recent call last):
              File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 306, in startPlugin
                plugins[packageName] = package.classFactory(iface)
              File "C:/OSGEO4~1/apps/qgis/./python/plugins\fTools\__init__.py", line 33, in classFactory
                from .fTools import fToolsPlugin
              File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 572, in _import
                mod = _builtin_import(name, globals, locals, fromlist, level)
              File "C:/OSGEO4~1/apps/qgis/./python/plugins\fTools\fTools.py", line 52, in <module>
                import doRandom
              File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 572, in _import
                mod = _builtin_import(name, globals, locals, fromlist, level)
              File "C:\OSGEO4~1\apps\qgis\python\plugins\fTools\tools\doRandom.py", line 37, in <module>
                import random
              File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 572, in _import
                mod = _builtin_import(name, globals, locals, fromlist, level)
              File "C:\Python27\Lib\random.py", line 49, in <module>
                import hashlib as _hashlib
              File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 572, in _import
                mod = _builtin_import(name, globals, locals, fromlist, level)
              File "C:\Python27\Lib\hashlib.py", line 138, in <module>
                _hashlib.openssl_md_meth_names)
            AttributeError: 'module' object has no attribute 'openssl_md_meth_names'
  • Did you delete the qgis2 folder (C:\Users\You\.qgis2) before reinstalling? This is where most of your plugins are stored are requires to be manually removed. – Joseph Feb 19 '16 at 10:21
  • No, I was not aware of this procedure. I guess it's worth a try. Would you reccomend re-installing the full OSgeo4W bundle? – Ninja Tuna Feb 19 '16 at 19:36
  • Remove old QGIS installations from "C:Program Files\" etc. Clean registry. Before reinstalling, remove .qgis2. from User path like Joseph said. You can try QGIS standalone installer. – Artec Feb 19 '16 at 20:18
  • @NinjaTuna - If you plan on using Python and various other packages then you could re-install via OSGeo4W but is not required if you just want to use QGIS as a standalone software. – Joseph Feb 22 '16 at 11:08
  • @Joseph - I uninstalled OSGeo4W by deleting C:\OSGeo4W64, deleted the qgis2 folder as recommended, restarted the computer before re-installing OSGeo4W but the problem persists. Any other ideas? – Ninja Tuna Feb 23 '16 at 20:10
3

Cleaning registries and re-installations did not solve the problem.

I opened C:\Python27\Lib\hashlib.py (the problematic file) in Notepad++ and checked on line 138 (where the problem was specified) and compared it to the same file on an other computer, where QGIS works correctly.

Note: I only edited the python file, not the compiled python file.

I found 2 extra command lines that I commented out (using #) for the code to be like the one on the working computer.

I saved the file, re-opened QGIS and found no error and geoprocessing tool back.

Here are the 2 extra lines that I commented out in case someone else gets a similar problem:

(first line = 133)

try:
    import _hashlib
    new = __hash_new
    __get_hash = __get_openssl_constructor
#    algorithms_available = algorithms_available.union(
#        _hashlib.openssl_md_meth_names)
except ImportError:
    new = __py_new
    __get_hash = __get_builtin_constructor

(last line = 141)

  • 1
    I only have basic python skills so I can't explain in much depth why it worked. I'll keep this thread updated in case further problems arise from editing the code. – Ninja Tuna Feb 25 '16 at 15:16
  • New problem arose a few days later. Different error messages, details posted here: gis.stackexchange.com/questions/183095/… – Ninja Tuna Mar 2 '16 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.