Trying to get a lib called chemlab to work in python 3.5
it requires PyQT4 which requires PyOpenGL
All of this is on a 64 machine, but everything - from python to every library is 32 bit (maybe that matters)
Initial code is
from chemlab.graphics.qt import QtViewer
from chemlab.graphics.renderers import PointRenderer
from chemlab.graphics.uis import TextUI
vertices = [[0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [2.0, 0.0, 0.0]]
blue = (0, 255, 255, 255)
colors = [blue, ] * 3
v = QtViewer()
pr = v.add_renderer(PointRenderer, vertices, colors)
tu = v.add_ui(TextUI, 100, 100, 'Hello, world!')
v.run()
Callstack is as follows
Traceback (most recent call last):
File "C:/Users/eldar/PycharmProjects/ChemTo3D/Proccessor.py", line 13, in <module> tu = v.add_ui(TextUI, 100, 100, 'Hello, world!')
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chemlab\graphics\qt\qtviewer.py", line 189, in add_ui
ui = klass(self.widget, *args, **kwargs)
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\sitepackages\chemlab\graphics\uis.py", line 120, in __init__
props = setup_textures()
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chemlab\graphics\uis.py", line 17, in setup_textures
ft = ImageFont.truetype(font_name, height)
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\ImageFont.py", line 238, in truetype
return FreeTypeFont(font, size, index, encoding)
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\ImageFont.py", line 127, in __init__
self.font = core.getfont(font, size, index, encoding)
OSError: cannot open resource
Exception ignored in: <bound method VertexBuffer.__del__ of <chemlab.graphics.buffers.VertexBuffer object at 0x04FF7630>>
Traceback (most recent call last):
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chemlab\graphics\buffers.py", line 26, in __del__
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\wrapper.py", line 98, in __nonzero__
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 376, in __nonzero__
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 381, in load
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 954, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 887, in _find_spec
TypeError: 'NoneType' object is not iterable
Exception ignored in: <bound method VertexBuffer.__del__ of <chemlab.graphics.buffers.VertexBuffer object at 0x04FF7D10>>
Traceback (most recent call last):
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chemlab\graphics\buffers.py", line 26, in __del__
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\wrapper.py", line 98, in __nonzero__
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 376, in __nonzero__
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 381, in load
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 954, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 887, in _find_spec
TypeError: 'NoneType' object is not iterable
Edit: The part that stops anything from displaying was the text. pillow is not playing nice at all. Molecules do indeed display if no text displaying is attempted, so I am no longer sure what the opengl import errors are doing - maybe nothing, maybe shaders are unavailable. Investigating ongoing.
This is normally because you are missing a font.
Looking at the code on github it's looking for 'Arial.ttf': https://github.com/chemlab/chemlab/blob/cded640add8322bf315abdb155e2e21d942ae337/chemlab/graphics/uis.py#L14