-
Notifications
You must be signed in to change notification settings - Fork 856
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
Support for older Python versions #1
Comments
Facing similar issue: ImportError: cannot import name '_tiktoken' from partially initialized module 'tiktoken' |
@techthiyanes @mannasoumya Could you provide more details, e.g. maybe a script that reproduces the issue in a fresh environment? Are you installing from a wheel or from source? If from source, what version of setuptools, pip, setuptools-rust and do you have the build output? |
Thanks for mentioning about PIP details. While trying to install via colab using pip i have been getting below error. |
@techthiyanes One thing that could cause that message is if you're using an older Python; this initial release requires Python 3.9 or newer (last time I checked I think colab defaulted to an older Python version) |
Sure... Thank you for your response..i will try installing locally with 3.9. |
I have created a virtual environment of the above Python 3.10 and installed tiktoken via |
got it to work using python3.9 -m pip install tiktoken then running my test.py with python3.9 test.py |
Just to clarify the state of this issue: First, tiktoken currently only supports Python 3.9 and newer. This is the issue that techthiyanes and abdelhadi-azouni ran into. Future versions of tiktoken may add support for older Python. Thumbs up this comment if support for older Python is something you'd like. |
The other thing discussed on this issue is that @mannasoumya is running into some undiagnosed issue that I cannot reproduce. The following works for me. What does the equivalent output for each of the following commands look like for you?
|
Support for older versions of Python would certainly be appreciated. Compatibility with 3.6 would be ideal, but 3.8 would also work. A lot of people won't be running 3.9. |
This seems to be working now. I think I had some issues while previously building Python from source. I rebuilt Python 3.10 from source and then created venv and installed tiktoken. Its working fine now. Thanks for the help. |
Python 3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tiktoken
>>> tiktoken
<module 'tiktoken' from 'venv/lib/python3.8/site-packages/tiktoken/__init__.py'>
>>> tiktoken.get_encoding('gpt2')
<Encoding 'gpt2'> I managed to make it work with python 3.8, and practically >= 3.7. |
See https://github.com/openai/tiktoken/pull/14/files To install in older python versions until that PR is merged, you can fork and run: python3 setup.py build bdist_wheel
python -m pip install dist/tiktoken-0.1.1-cp38-cp38-linux_x86_64.whl Hope I helped. |
FWIW, I am on
|
I've added Python 3.8 support and released this in tiktoken 0.1.2. I'm not currently planning on adding Python 3.7 support.
@delip I'll need more information to help you. Can you run the equivalent of the commands I mentioned in this comment: #1 (comment) and open a new issue with the output? |
Could i know when PIP installed version to be rolled out? Also we are unable to locate (from tiktoken import _tiktoken) as well.
The text was updated successfully, but these errors were encountered: