Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function 'FTC_CMapCache_Lookup' not found #683

Open
mocherry opened this issue Sep 5, 2024 · 5 comments
Open

function 'FTC_CMapCache_Lookup' not found #683

mocherry opened this issue Sep 5, 2024 · 5 comments
Assignees

Comments

@mocherry
Copy link

mocherry commented Sep 5, 2024

Dear developers,

I tried to install micro-sam with the windows installer and when trying to run it I get the following error:
function 'FTC_CMapCache_Lookup' not found

Any idea what is wrong?

Thanks and best
Matthias

@constantinpape
Copy link
Contributor

Can you please post the complete error message here?

@mocherry
Copy link
Author

mocherry commented Sep 5, 2024 via email

@constantinpape
Copy link
Contributor

Yes, I mean the traceback.

@mocherry
Copy link
Author

mocherry commented Sep 6, 2024

this is a copy of the traceback:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\app\backends\_qt.py:928, in CanvasBackendDesktop.paintGL(self=<vispy.app.backends._qt.CanvasBackendDesktop object>)
    926 # (0, 0, self.width(), self.height()))
    927 self._vispy_canvas.set_current()
--> 928 self._vispy_canvas.events.draw(region=None)
        self._vispy_canvas = <VispyCanvas (PyQt5) at 0x1f0b6fba810>
        self._vispy_canvas.events.draw = <vispy.util.event.EventEmitter object at 0x000001F0B7006C10>
        self = <vispy.app.backends._qt.CanvasBackendDesktop object at 0x000001F0B6FC1510>
        self._vispy_canvas.events = <vispy.util.event.EmitterGroup object at 0x000001F0B6442450>
    930 # Clear the alpha channel with QOpenGLWidget (Qt >= 5.4), otherwise the
    931 # window is translucent behind non-opaque objects.
    932 # Reference:  MRtrix3/mrtrix3#266
    933 if QT5_NEW_API or PYSIDE6_API or PYQT6_API:

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\util\event.py:453, in EventEmitter.__call__(self=<vispy.util.event.EventEmitter object>, *args=(), **kwargs={'region': None})
    450 if self._emitting > 1:
    451     raise RuntimeError('EventEmitter loop detected!')
--> 453 self._invoke_callback(cb, event)
        event = <DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>
        self = <vispy.util.event.EventEmitter object at 0x000001F0B7006C10>
        cb = <bound method SceneCanvas.on_draw of <VispyCanvas (PyQt5) at 0x1f0b6fba810>>
    454 if event.blocked:
    455     break

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\util\event.py:471, in EventEmitter._invoke_callback(self=<vispy.util.event.EventEmitter object>, cb=<bound method SceneCanvas.on_draw of <VispyCanvas (PyQt5)>>, event=<DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>)
    469     cb(event)
    470 except Exception:
--> 471     _handle_exception(self.ignore_callback_errors,
        self = <vispy.util.event.EventEmitter object at 0x000001F0B7006C10>
        cb = <bound method SceneCanvas.on_draw of <VispyCanvas (PyQt5) at 0x1f0b6fba810>>
        event = <DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>
        (cb, event) = (<bound method SceneCanvas.on_draw of <VispyCanvas (PyQt5) at 0x1f0b6fba810>>, <DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>)
    472                       self.print_callback_errors,
    473                       self, cb_event=(cb, event))

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\util\event.py:469, in EventEmitter._invoke_callback(self=<vispy.util.event.EventEmitter object>, cb=<bound method SceneCanvas.on_draw of <VispyCanvas (PyQt5)>>, event=<DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>)
    467 def _invoke_callback(self, cb, event):
    468     try:
--> 469         cb(event)
        cb = <bound method SceneCanvas.on_draw of <VispyCanvas (PyQt5) at 0x1f0b6fba810>>
        event = <DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>
    470     except Exception:
    471         _handle_exception(self.ignore_callback_errors,
    472                           self.print_callback_errors,
    473                           self, cb_event=(cb, event))

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\scene\canvas.py:219, in SceneCanvas.on_draw(self=<VispyCanvas (PyQt5)>, event=<DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>)
    216 # Now that a draw event is going to be handled, open up the
    217 # scheduling of further updates
    218 self._update_pending = False
--> 219 self._draw_scene()
        self = <VispyCanvas (PyQt5) at 0x1f0b6fba810>

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\scene\canvas.py:278, in SceneCanvas._draw_scene(self=<VispyCanvas (PyQt5)>, bgcolor=<class 'numpy.ndarray'> (4,) float32)
    276     bgcolor = self._bgcolor
    277 self.context.clear(color=bgcolor, depth=True)
--> 278 self.draw_visual(self.scene)
        self = <VispyCanvas (PyQt5) at 0x1f0b6fba810>

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\scene\canvas.py:316, in SceneCanvas.draw_visual(self=<VispyCanvas (PyQt5)>, visual=<SubScene>, event=None)
    314         else:
    315             if hasattr(node, 'draw'):
--> 316                 node.draw()
        node = <PointsVisual at 0x1f0fa411690>
    317                 prof.mark(str(node))
    318 else:

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\scene\visuals.py:106, in VisualNode.draw(self=<PointsVisual>)
    104 if self.picking and not self.interactive:
    105     return
--> 106 self._visual_superclass.draw(self)
        self = <PointsVisual at 0x1f0fa411690>
        self._visual_superclass = <class 'vispy.visuals.visual.CompoundVisual'>

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\visuals\visual.py:668, in CompoundVisual.draw(self=<PointsVisual>)
    666 for v in self._subvisuals:
    667     if v.visible:
--> 668         v.draw()
        v = <Text at 0x1f0fa473f90>

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\scene\visuals.py:106, in VisualNode.draw(self=<Text>)
    104 if self.picking and not self.interactive:
    105     return
--> 106 self._visual_superclass.draw(self)
        self = <Text at 0x1f0fa473f90>
        self._visual_superclass = <class 'vispy.visuals.text.text.TextVisual'>

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\visuals\visual.py:505, in Visual.draw(self=<Text>)
    503 if not self.visible:
    504     return
--> 505 if self._prepare_draw(view=self) is False:
        self = <Text at 0x1f0fa473f90>
    506     return
    508 if self._vshare.draw_mode is None:

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\visuals\text\text.py:533, in TextVisual._prepare_draw(self=<Text>, view=<Text>)
    530 n_char = sum(len(t) for t in text)
    531 # we delay creating vertices because it requires a context,
    532 # which may or may not exist when the object is initialized
--> 533 self._vertices = np.concatenate([
        self._vertices = None
        self = <Text at 0x1f0fa473f90>
        np.concatenate = <function concatenate at 0x000001F0A996DEB0>
        np = <module 'numpy' from 'C:\\Users\\kirsch\\AppData\\Local\\micro_sam\\Lib\\site-packages\\numpy\\__init__.py'>
        self._font = <vispy.visuals.text.text.TextureFont object at 0x000001F0FA49C410>
        self._anchors[0] = 'center'
        self._anchors[1] = 'center'
        self._anchors = ('center', 'center')
        text = <class 'numpy.ndarray'> (1,) <U1
        self._font._lowres_size = 64
    534     _text_to_vbo(t, self._font, self._anchors[0], self._anchors[1],
    535                  self._font._lowres_size) for t in text])
    536 self._vertices = VertexBuffer(self._vertices)
    537 idx = (np.array([0, 1, 2, 0, 2, 3], np.uint32) +
    538        np.arange(0, 4*n_char, 4, dtype=np.uint32)[:, np.newaxis])

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\visuals\text\text.py:534, in <listcomp>(.0=<iterator object>)
    530 n_char = sum(len(t) for t in text)
    531 # we delay creating vertices because it requires a context,
    532 # which may or may not exist when the object is initialized
    533 self._vertices = np.concatenate([
--> 534     _text_to_vbo(t, self._font, self._anchors[0], self._anchors[1],
        self._vertices = None
        self = <Text at 0x1f0fa473f90>
        np.concatenate = <function concatenate at 0x000001F0A996DEB0>
        np = <module 'numpy' from 'C:\\Users\\kirsch\\AppData\\Local\\micro_sam\\Lib\\site-packages\\numpy\\__init__.py'>
        self._font = <vispy.visuals.text.text.TextureFont object at 0x000001F0FA49C410>
        t = ''
        self._anchors[0] = 'center'
        self._anchors[1] = 'center'
        self._anchors = ('center', 'center')
        self._font._lowres_size = 64
    535                  self._font._lowres_size) for t in text])
    536 self._vertices = VertexBuffer(self._vertices)
    537 idx = (np.array([0, 1, 2, 0, 2, 3], np.uint32) +
    538        np.arange(0, 4*n_char, 4, dtype=np.uint32)[:, np.newaxis])

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\visuals\text\text.py:264, in _text_to_vbo(text='', font=<vispy.visuals.text.text.TextureFont object>, anchor_x='center', anchor_y='center', lowres_size=64)
    257 # Need to store the original viewport, because the font[char] will
    258 # trigger SDF rendering, which changes our viewport
    259 # todo: get rid of call to glGetParameter!
    260 
    261 # Also analyse chars with large ascender and descender, otherwise the
    262 # vertical alignment can be very inconsistent
    263 for char in 'hy':
--> 264     glyph = font[char]
        char = 'h'
        font = <vispy.visuals.text.text.TextureFont object at 0x000001F0FA49C410>
    265     y0 = glyph['offset'][1] * ratio + slop
    266     y1 = y0 - glyph['size'][1]

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\visuals\text\text.py:81, in TextureFont.__getitem__(self=<vispy.visuals.text.text.TextureFont object>, char='h')
     79     raise TypeError('index must be a 1-character string')
     80 if char not in self._glyphs:
---> 81     self._load_char(char)
        char = 'h'
        self = <vispy.visuals.text.text.TextureFont object at 0x000001F0FA49C410>
     82 return self._glyphs[char]

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\visuals\text\text.py:95, in TextureFont._load_char(self=<vispy.visuals.text.text.TextureFont object>, char='h')
     93 assert char not in self._glyphs
     94 # load new glyph data from font
---> 95 _load_glyph(self._font, char, self._glyphs)
        char = 'h'
        self._glyphs = {}
        self._font = {'face': 'OpenSans', 'bold': False, 'italic': False, 'size': 256}
        self = <vispy.visuals.text.text.TextureFont object at 0x000001F0FA49C410>
     96 # put new glyph into the texture
     97 glyph = self._glyphs[char]

File ~\AppData\Local\micro_sam\Lib\site-packages\vispy\util\fonts\_freetype.py:47, in _load_glyph(f={'bold': False, 'face': 'OpenSans', 'italic': False, 'size': 256}, char='h', glyphs_dict={})
     45 def _load_glyph(f, char, glyphs_dict):
     46     """Load glyph from font into dict"""
---> 47     from freetype import (FT_LOAD_RENDER, FT_LOAD_NO_HINTING,
     48                           FT_LOAD_NO_AUTOHINT)
     49     flags = FT_LOAD_RENDER | FT_LOAD_NO_HINTING | FT_LOAD_NO_AUTOHINT
     50     face = _load_font(f['face'], f['bold'], f['italic'])

File ~\AppData\Local\micro_sam\Lib\site-packages\freetype\__init__.py:24
     21 import ctypes.util
     22 import struct
---> 24 from freetype.raw import *
     26 # Hack to get unicode class in python3
     27 PY3 = sys.version_info[0] == 3

File ~\AppData\Local\micro_sam\Lib\site-packages\freetype\raw.py:201
    195     pass
    197 # Wholesale import of 102 routines which can be reasonably expected
    198 # to be found in freetype 2.2.x onwards. Some of these might need
    199 # to be protected with try:/except AttributeError: in some freetype builds.
--> 201 FTC_CMapCache_Lookup           = _lib.FTC_CMapCache_Lookup
        _lib = <CDLL 'C:\Program Files\Eclipse Adoptium\jdk-21.0.2.13-hotspot\bin\freetype.dll', handle 7ffc36120000 at 0x1f0fcd6fd90>
    202 FTC_CMapCache_New              = _lib.FTC_CMapCache_New
    203 FTC_ImageCache_Lookup          = _lib.FTC_ImageCache_Lookup

File ~\AppData\Local\micro_sam\Lib\ctypes\__init__.py:389, in CDLL.__getattr__(self=<CDLL 'C:\Program Files\Eclipse Adoptium\jdk-21....3-hotspot\bin\freetype.dll', handle 7ffc36120000>, name='FTC_CMapCache_Lookup')
    387 if name.startswith('__') and name.endswith('__'):
    388     raise AttributeError(name)
--> 389 func = self.__getitem__(name)
        name = 'FTC_CMapCache_Lookup'
        self = <CDLL 'C:\Program Files\Eclipse Adoptium\jdk-21.0.2.13-hotspot\bin\freetype.dll', handle 7ffc36120000 at 0x1f0fcd6fd90>
    390 setattr(self, name, func)
    391 return func

File ~\AppData\Local\micro_sam\Lib\ctypes\__init__.py:394, in CDLL.__getitem__(self=<CDLL 'C:\Program Files\Eclipse Adoptium\jdk-21....3-hotspot\bin\freetype.dll', handle 7ffc36120000>, name_or_ordinal='FTC_CMapCache_Lookup')
    393 def __getitem__(self, name_or_ordinal):
--> 394     func = self._FuncPtr((name_or_ordinal, self))
        self._FuncPtr = <class 'ctypes.CDLL.__init__.<locals>._FuncPtr'>
        (name_or_ordinal, self) = ('FTC_CMapCache_Lookup', <CDLL 'C:\Program Files\Eclipse Adoptium\jdk-21.0.2.13-hotspot\bin\freetype.dll', handle 7ffc36120000 at 0x1f0fcd6fd90>)
        name_or_ordinal = 'FTC_CMapCache_Lookup'
        self = <CDLL 'C:\Program Files\Eclipse Adoptium\jdk-21.0.2.13-hotspot\bin\freetype.dll', handle 7ffc36120000 at 0x1f0fcd6fd90>
    395     if not isinstance(name_or_ordinal, int):
    396         func.__name__ = name_or_ordinal

AttributeError: function 'FTC_CMapCache_Lookup' not found

@anwai98
Copy link
Contributor

anwai98 commented Sep 23, 2024

Hi @mocherry,

Thanks for reporting the issue. It seems that "freetype.dll" is causing the core issue.

Could you please confirm if you still face the issue with the Windows Installer? If not, I'll add a few mentions which might help us understand the issue better.

  • Can you tell us your windows system configuration? (is it 64-bit or 32-bit)
  • There is a scenario possible that while installing micro-sam using the installer, 'freetype.dll' did not install properly, or potentially needs an upgrade. In case it still interests you, could we ask you to reinstall micro-sam using the latest installer links in our documentation?

Let us know how it goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants