openai / tiktoken

tiktoken is a fast BPE tokeniser for use with OpenAI's models.
MIT License
11.76k stars 801 forks source link

mypy: Cannot find implementation or library stub for module named "tiktoken" [import] #151

Closed ryan-mccaffrey closed 1 year ago

ryan-mccaffrey commented 1 year ago

I noticed that this was supposed to be solved with the 0.1.4 release but I'm still consistently running into this issue when trying to type code that relies on tiktoken version 0.4.0.

hauntsaninja commented 1 year ago

The most likely thing is you haven't installed tiktoken in the environment you're asking mypy to check with. See https://mypy.readthedocs.io/en/stable/running_mypy.html#cannot-find-implementation-or-library-stub

If it was a problem with tiktoken, you'd see something like https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker instead.