missing `pandas` when using `isinstance`
Confirm this is an issue with the Python library and not an underlying OpenAI API
- [x] This is an issue with the Python library
Describe the bug
Traceback (most recent call last):
2025-01-28T12:19:51.802342624Z File "/usr/local/lib/python3.12/weakref.py", line 590, in __call__
2025-01-28T12:19:51.802544917Z return info.func(*info.args, **(info.kwargs or {}))
2025-01-28T12:19:51.802548333Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-28T12:19:51.802549625Z File "/usr/src/app/kai/kai/bot/bot.py", line 170, in cleanup
2025-01-28T12:19:51.802550583Z print(referrers.get_referrer_graph(conversation))
2025-01-28T12:19:51.802551417Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-28T12:19:51.802587458Z File "/usr/local/lib/python3.12/site-packages/referrers/impl.py", line 162, in get_referrer_graph
2025-01-28T12:19:51.802590083Z return get_referrer_graph_for_list(
2025-01-28T12:19:51.802590958Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-28T12:19:51.802591833Z File "/usr/local/lib/python3.12/site-packages/referrers/impl.py", line 234, in get_referrer_graph_for_list
2025-01-28T12:19:51.802592792Z builder = _ReferrerGraphBuilder(
2025-01-28T12:19:51.802593583Z ^^^^^^^^^^^^^^^^^^^^^^
2025-01-28T12:19:51.802594417Z File "/usr/local/lib/python3.12/site-packages/referrers/impl.py", line 710, in __init__
2025-01-28T12:19:51.802980461Z self._id_to_enclosing_closure = self._get_closure_functions()
2025-01-28T12:19:51.802985086Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-28T12:19:51.802986169Z File "/usr/local/lib/python3.12/site-packages/referrers/impl.py", line 1074, in _get_closure_functions
2025-01-28T12:19:51.803291962Z if inspect.isfunction(possible_function) or inspect.ismethod(
2025-01-28T12:19:51.803297171Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-28T12:19:51.803298921Z File "/usr/local/lib/python3.12/inspect.py", line 389, in isfunction
2025-01-28T12:19:51.804443843Z return isinstance(object, types.FunctionType)
2025-01-28T12:19:51.804452010Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-28T12:19:51.804454218Z File "/usr/local/lib/python3.12/site-packages/openai/_utils/_proxy.py", line 49, in __class__
2025-01-28T12:19:51.804517219Z proxied = self.__get_proxied__()
2025-01-28T12:19:51.804519427Z ^^^^^^^^^^^^^^^^^^^^^^
2025-01-28T12:19:51.804520344Z File "/usr/local/lib/python3.12/site-packages/openai/_utils/_proxy.py", line 55, in __get_proxied__
2025-01-28T12:19:51.804563511Z return self.__load__()
2025-01-28T12:19:51.804565469Z ^^^^^^^^^^^^^^^
2025-01-28T12:19:51.804568511Z File "/usr/local/lib/python3.12/site-packages/openai/_extras/pandas_proxy.py", line 22, in __load__
2025-01-28T12:19:51.804681636Z raise MissingDependencyError(PANDAS_INSTRUCTIONS) from err
2025-01-28T12:19:51.804712678Z openai._extras._common.MissingDependencyError:
2025-01-28T12:19:51.804714428Z
2025-01-28T12:19:51.804715303Z OpenAI error:
2025-01-28T12:19:51.804716178Z
2025-01-28T12:19:51.804716970Z missing `pandas`
2025-01-28T12:19:51.804717845Z
2025-01-28T12:19:51.804718720Z This feature requires additional dependencies:
2025-01-28T12:19:51.804719678Z
2025-01-28T12:19:51.804720470Z $ pip install openai[datalib]
2025-01-28T12:19:51.804721345Z
2025-01-28T12:19:51.804722178Z
To Reproduce
- import openai library
- try to use "referrers" libary
Code snippets
OS
macos
Python version
3.12.6
Library version
1.13.3
same on version 1.60.2
Thanks for the report, is there any way to tell this library to just not inspect certain symbols / paths? This is eagerly importing internal helpers and then trying to inspect them in ways which breaks assumptions about how the helpers should be used.
Thanks for the report, is there any way to tell this library to just not inspect certain symbols / paths? This is eagerly importing internal helpers and then trying to inspect them in ways which breaks assumptions about how the helpers should be used.
Hmm, this is a library for memory debugging. I didn't manage to find a way to disable inspecting specific types.
same here. I was using pympler to profile my project and show the same error.