Mni.kit.pipapi.install("openai") not working

Hi all, i’m trying to use openai package in an extension using the omni.kit.pipapi.install .

Here is the code I’m trying, really simple:
‘’’
import omni.ext

import omni.ui as ui

import omni.kit.pipapi

omni.kit.pipapi.install(“openai”)

import openai
‘’’

and when saving here is what the console of omniverse code gives me:
2024-09-12 09:29:49 [Warning] [omni.kit.pipapi.pipapi] [omni.kit.pipapi] ‘openai’ failed to install.
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] Failed to import python module EasyMarketPlaceGen. Error: No module named ‘openai’. Traceback:
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] Traceback (most recent call last):
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] File “/home/coucou/.local/share/ov/pkg/deps/d63ea876e0b68c9bd49a17dcbc178280/kernel/py/omni/ext/_impl/custom_importer.py”, line 76, in import_module
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] return importlib.import_module(name)
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] File “/home/coucou/.local/share/ov/pkg/deps/d63ea876e0b68c9bd49a17dcbc178280/python/lib/python3.7/importlib/init.py”, line 127, in import_module
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] return _bootstrap._gcd_import(name[level:], package, level)
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] File “”, line 1006, in _gcd_import
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] File “”, line 983, in _find_and_load
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] File “”, line 967, in _find_and_load_unlocked
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] File “”, line 677, in _load_unlocked
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] File “”, line 728, in exec_module
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] File “”, line 219, in _call_with_frames_removed
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] File “/home/coucou/Documents/ODYSSE/Tutorials/Extensions/Maerket-Place-Generator-Easy/exts/EasyMarketPlaceGen/EasyMarketPlaceGen/init.py”, line 1, in
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] from .extension import *
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] File “/home/coucou/Documents/ODYSSE/Tutorials/Extensions/Maerket-Place-Generator-Easy/exts/EasyMarketPlaceGen/EasyMarketPlaceGen/extension.py”, line 5, in
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] import openai # You need to install the OpenAI Python client: pip install openai
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer] ModuleNotFoundError: No module named ‘openai’
2024-09-12 09:29:49 [Error] [omni.ext._impl.custom_importer]
2024-09-12 09:29:49 [Error] [carb.scripting-python.plugin] Exception: Extension python module: ‘EasyMarketPlaceGen’ in ‘/home/coucou/Documents/ODYSSE/Tutorials/Extensions/Maerket-Place-Generator-Easy/exts/EasyMarketPlaceGen’ failed to load.
2024-09-12 09:29:49 [Error] [carb.scripting-python.plugin]
2024-09-12 09:29:49 [Error] [carb.scripting-python.plugin] At:
2024-09-12 09:29:49 [Error] [carb.scripting-python.plugin] /home/coucou/.local/share/ov/pkg/deps/d63ea876e0b68c9bd49a17dcbc178280/kernel/py/omni/ext/_impl/_internal.py(189): startup
2024-09-12 09:29:49 [Error] [carb.scripting-python.plugin] /home/coucou/.local/share/ov/pkg/deps/d63ea876e0b68c9bd49a17dcbc178280/kernel/py/omni/ext/_impl/_internal.py(285): startup_extension
2024-09-12 09:29:49 [Error] [carb.scripting-python.plugin] PythonExtension.cpp::startup()(2):
2024-09-12 09:29:49 [Error] [carb.scripting-python.plugin]
2024-09-12 09:29:49 [Error] [omni.ext.plugin] [ext: EasyMarketPlaceGen-1.0.0] Failed to startup python extension.

But when testing with others packages like “names” its working…

Often when you get this error it’s because the pip install times out. The way to resolve this is to navigate to open a terminal, navigate to the folder where your omniverse python environment is located and run the pip install manually there.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.