Search code examples
pythonmodulepygresql

Import Errror for python pg module


I am having trouble using the pg module in my code. I've installed it using pip. But when I go to run it I get the following error:

Traceback (most recent call last):
  File "Contract_gen.py", line 2, in <module>
    import pg
  File "C:\Python27\lib\site-packages\pg\__init__.py", line 1, in <module>
    from .core import (
  File "C:\Python27\lib\site-packages\pg\core.py", line 6, in <module> 
    from . import glfw
  File "C:\Python27\lib\site-packages\pg\glfw.py", line 140, in <module>
    raise ImportError("Failed to load GLFW3 shared library.")
ImportError: Failed to load GLFW3 shared library.

Solution

  • It seems like to require the GLFW3 library. Download & install it and the error should be gone. If you use macOS you can get it via brew.