Description of problem: I had previously (F25) got a small python3 script running to connect to a Postgres database using the PyGreSQL module. On F26, this seems to have stopped working. The pg modules seems to want to load GLFW3 for reasons that are not obvious to me, but at any rate can't find it. is this a bug or am I doing something dumb? Thanks. Version-Release number of selected component (if applicable): [root@npgs-fedora lib]# rpm -qa python3 PyGreSQL python3-pyopengl glfw glfw-devel python3-3.6.2-8.fc26.x86_64 PyGreSQL-5.0.3-4.fc26.x86_64 glfw-3.2.1-3.fc26.x86_64 glfw-devel-3.2.1-3.fc26.x86_64 python3-pyopengl-3.1.1a1-7.fc26.x86_64 How reproducible: Always. Tried on 2 separate F26 machines. Steps to Reproduce: root@npgs-fedora ~]# pip3 install pg WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead. Collecting pg Downloading pg-0.1.tar.gz Requirement already satisfied: Pillow in /usr/lib64/python3.6/site-packages (from pg) Collecting PyOpenGL (from pg) Downloading PyOpenGL-3.1.0.tar.gz (1.2MB) 100% |████████████████████████████████| 1.2MB 637kB/s Requirement already satisfied: olefile in /usr/lib/python3.6/site-packages (from Pillow->pg) Installing collected packages: PyOpenGL, pg Running setup.py install for PyOpenGL ... done Running setup.py install for pg ... done Successfully installed PyOpenGL-3.1.0 pg-0.1 [root@npgs-fedora ~]# [root@npgs-fedora ~]# python3 Python 3.6.2 (default, Oct 2 2017, 16:51:32) [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pg Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.6/site-packages/pg/__init__.py", line 1, in <module> from .core import ( File "/usr/lib/python3.6/site-packages/pg/core.py", line 6, in <module> from . import glfw File "/usr/lib/python3.6/site-packages/pg/glfw.py", line 140, in <module> raise ImportError("Failed to load GLFW3 shared library.") ImportError: Failed to load GLFW3 shared library. >>> root@npgs-fedora ~]# pip3 install glfw WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead. Collecting glfw Downloading glfw-1.4.0.tar.gz Installing collected packages: glfw Running setup.py install for glfw ... done Successfully installed glfw-1.4.0 [root@npgs-fedora ~]# python3 Python 3.6.2 (default, Oct 2 2017, 16:51:32) [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pg Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.6/site-packages/pg/__init__.py", line 1, in <module> from .core import ( File "/usr/lib/python3.6/site-packages/pg/core.py", line 6, in <module> from . import glfw File "/usr/lib/python3.6/site-packages/pg/glfw.py", line 140, in <module> raise ImportError("Failed to load GLFW3 shared library.") ImportError: Failed to load GLFW3 shared library. >>> Actual results: ImportError: Failed to load GLFW3 shared library. Expected results: No error when pg is loaded into python3 Additional info: [root@npgs-fedora lib64]# pwd /lib64 [root@npgs-fedora lib64]# ls -l libglfw* lrwxrwxrwx. 1 root root 12 Feb 11 2017 libglfw.so -> libglfw.so.3 lrwxrwxrwx. 1 root root 14 Feb 11 2017 libglfw.so.3 -> libglfw.so.3.2 -rwxr-xr-x. 1 root root 119864 Feb 11 2017 libglfw.so.3.2 [root@npgs-fedora lib64]#
This does not seem like an issue with PyGreSQL. If you take a look into the code where the exception is raised: $ cat /usr/lib/python3.6/site-packages/pg/glfw.py ... _glfw = _load_library(['glfw', 'glfw3'], ['.so', '.dylib', '.dll'], ['', '/usr/lib', '/usr/local/lib'], _glfw_get_version) ... From what I can understand pg is just looking in the wrong places.
So should this bug be moved to be against Postgres instead?
Where does the glfw.py file come from? It's not from core Postgres, for sure.
I assume/believe it's from glfw: [root@pooh ~]# rpm -q glfw glfw-3.2.1-3.fc26.x86_64 but it's not clear to me why an OpenGL wrapper is involved in a database access API. Something important I am missing. Do let me know if there is anything I can test; I have a spare machine I can do clean installs etc, if needed. Thanks
(In reply to NickPGSmith from comment #4) > I assume/believe it's from glfw: "rpm -qf /usr/lib/python3.6/site-packages/pg/glfw.py" would tell you for sure. > but it's not clear to me why an OpenGL wrapper is involved in a database > access API. Something important I am missing. That bemuses me as well.
Hum, curious: [root@pooh ~]# rpm -qf /usr/lib/python3.6/site-packages/pg/glfw.py file /usr/lib/python3.6/site-packages/pg/glfw.py is not owned by any package Perhaps it appeared from when I ran pip3. Perhaps I shoudln't have done that. I might try a clean build.
The glfw.py comes from 'pg' package installed by pip, and 'pg' should be patched so it tries to find libglfw.so* under /usr/lib64, too (not only /usr/lib). Upstream report should go here: https://github.com/fogleman/pg https://pypi.python.org/pypi/pg/0.1
OK, I realised what was confusing me here. My desired library, PyGreSQL appears under the namespace "pg". However, the default installation seems to include pg, the Python OpenGL Graphics Framework under the same "pg" namespace. So I removed the graphics framework: pip3 uninstall pg and then installed PyGreSQL: pip3 install pygresql (additionally I had to install the packages: postgresql-devel python3-devel) All good now.
(In reply to NickPGSmith from comment #8) > So I removed the graphics framework: > pip3 uninstall pg > > and then installed PyGreSQL: > pip3 install pygresql Just correction, this is actually a result of upstream bug. You _should_ be able to run the 'pg' library against system-default PyGreSQL (without the need to install PyGreSQL with pip. That's the similar issue to: https://github.com/fogleman/pg/pull/5 (IOW, Nick, for your particular issue, it would be nice to have another pull request against upstream; but the project seems to be dead anyways, so I'm just saying..)