Need Help Resolving Python Tiktoken Module Issue in IRISHealth
I'm currently facing an issue with a Python script in my IRISHealth environment and would appreciate your insights.
I've written a class method, `getTokenCount`, in Python, which uses the `tiktoken` module. However, when I run the script in the terminal using `do ##class(python.openaiUtils).getTokenCount("")`, I encounter the following error:
```
<THROW> *%Exception.PythonException <THROW> 230 ^^0^DO ##CLASS(python.openaiUtils).Test() <class 'ModuleNotFoundError'>: No module named 'tiktoken.core' -
```
I have already installed `tiktoken` in the correct directory (`C:\InterSystems\IRISHealth\bin>`), and running `irispip list` confirms its presence:
```
Package Version
------------------ ---------
...
tiktoken 0.5.1
...
```
Despite this, I'm unable to resolve the issue, and the error persists. Has anyone encountered a similar problem or has insights on how to fix this? Your assistance would be greatly appreciated!
Comments
All packages have to be installed into <Installdir>/mgr/python, check this folder if it contains the required module
You have to specify the target folder in irispip
irispip install --target <installdir>\mgr\python <package>Check the relevant documentation
yes, in my mgr\python dir, tiktoken package is already installed. but still getting No module named 'tiktoken.core' when I run,
Did you import tiktoken into your embedded python method?