diff --git a/setup.py b/setup.py
index e4741c6..3294b1a 100644
--- a/setup.py
+++ b/setup.py
@@ -3,16 +3,20 @@
 
 import sys
 import platform
-import toml
+if sys.version_info < (3, 11):
+    import tomli as tomllib
+else:
+    import tomllib
 
 from os.path import join, dirname
 from setuptools import setup, find_packages, Extension
 
 
-meta = toml.load(join(dirname(__file__), 'pyproject.toml') )
-install_requires = meta["project"]["dependencies"]
-dev_requires = meta["project"]["optional-dependencies"]["dev"]
-tornado_requires = meta["project"]["optional-dependencies"]["tornado"]
+with open(join(dirname(__file__), 'pyproject.toml'), "rb") as f:
+    meta = tomllib.load(f)
+    install_requires = meta["project"]["dependencies"]
+    dev_requires = meta["project"]["optional-dependencies"]["dev"]
+    tornado_requires = meta["project"]["optional-dependencies"]["tornado"]
 
 try:
     from tornado import version as tornado_version
