Hey everyone, I’m having trouble with a Python wrapper for Airtable. I installed it using pip, but when I try to import the Airtable class, I get an error. Here’s what I did:
from airtable import Airtable
from pprint import pprint
table_info = Airtable('my_base_key', 'My_Table_Name')
print(table_info)
But when I run this, I get:
ImportError: cannot import name 'Airtable' from 'airtable' (unknown location)
I’m pretty sure I followed the docs correctly. Any ideas what might be going wrong? Maybe I messed up the installation somehow? Or could it be a version issue? I’m stumped and would really appreciate any help. Thanks!
I encountered this issue as well and found that the problem often lies in how Python handles package naming and imports. To resolve it, try using the full import path:
from airtable.airtable import Airtable
This explicitly tells Python where to find the Airtable class. If that doesn’t work, double-check your installation:
pip list | grep airtable
This will show which Airtable-related packages you have installed. Ensure you’re using the correct version compatible with your Python environment. If all else fails, consider using an alternative like pyairtable or airtable-python-wrapper, as others have suggested. These tend to have more straightforward import processes and better maintenance.
I ran into a similar issue when working with the Airtable Python wrapper recently. It turns out there are a couple of different packages with similar names, which can be confusing. The one that worked for me was ‘airtable-python-wrapper’, not just ‘airtable’.
Try uninstalling your current package and then install the correct one:
pip uninstall airtable
pip install airtable-python-wrapper
Then modify your import statement to:
from airtable import airtable
And create your Airtable object like this:
table_info = airtable.Airtable(‘my_base_key’, ‘My_Table_Name’)
This should resolve the import error. Make sure you’re using the latest version of the wrapper, as older versions might have different import structures. Hope this helps solve your problem!
hey mate, i had the same issue. try using pyairtable instead. it’s more up to date and easier to use. just do ‘pip install pyairtable’ and then import it like:
from pyairtable import Table
table = Table(‘api_key’, ‘base_id’, ‘table_name’)
should work like a charm!