pyairtable icon indicating copy to clipboard operation
pyairtable copied to clipboard

Import Error: TypeError When Using pyairtable Library

Open zcrodriguez opened this issue 1 year ago • 0 comments

Bug Report

Description

I encountered a TypeError when trying to import the pyairtable API using from pyairtable import Api. The error traceback indicates a conflict with multiple base classes in the Comment class of the pyairtable package.

This is my first time using and installing the pyairtable library, and I'm working in a Jupyter notebook within a virtual environment. I followed the installation instructions from the documentation, but the error occurred during the import.

Code to Reproduce

from pyairtable import Api

Error Output

---------------------------------------------------------------------------  
TypeError Traceback (most recent call last)  
...  
TypeError: multiple bases have instance lay-out conflict  

#### Traceback (Full)
File "c:\path\to\your\project\pyairtable\__init__.py", line 3  
    from .api import Api, Base, Table  
File "c:\path\to\your\project\pyairtable\api\api.py", line 10  
    from pyairtable.api.enterprise import Enterprise  
File "c:\path\to\your\project\pyairtable\models\comment.py", line 7  
    class Comment(CanUpdateModel, CanDeleteModel, ...):  
File "c:\path\to\your\project\pydantic\v1\main.py", line 282, in ModelMetaclass.__new__  
    cls = super().__new__(mcs, name, bases, new_namespace, **kwargs)  
File <frozen abc>, line 106, in __new__  
    TypeError: multiple bases have instance lay-out conflict  

Environment

  • Python version: 3.13.0
  • pyairtable version: 2.3.3
  • pydantic version: 2.9.2
  • typing_extensions version: 4.12.2
  • Jupyter notebook: Yes
  • Virtual environment: Yes (created using venv)

Steps to Reproduce

  1. Set up a virtual environment and install pyairtable with pip install pyairtable.
  2. Launch a Jupyter notebook.
  3. Try to import the Api class from pyairtable using from pyairtable import Api.
  4. The above error occurs upon import.

Expected Behavior

The library should import without any errors.

Installed Libraries

Here is the list of installed libraries in my virtual environment: annotated-types==0.7.0 asttokens==2.4.1 certifi==2024.8.30 charset-normalizer==3.4.0 colorama==0.4.6 comm==0.2.2 debugpy==1.8.7 decorator==5.1.1 executing==2.1.0 idna==3.10 inflection==0.5.1 ipykernel==6.29.5 ipython==8.28.0 jedi==0.19.1 jupyter_client==8.6.3 jupyter_core==5.7.2 matplotlib-inline==0.1.7 nest-asyncio==1.6.0 packaging==24.1 parso==0.8.4 platformdirs==4.3.6 prompt_toolkit==3.0.48 psutil==6.0.0 pure_eval==0.2.3 pyairtable==2.3.3 pydantic==2.9.2 pydantic_core==2.23.4 Pygments==2.18.0 python-dateutil==2.9.0.post0 pywin32==308 pyzmq==26.2.0 requests==2.32.3 six==1.16.0 stack-data==0.6.3 tornado==6.4.1 traitlets==5.14.3 typing_extensions==4.12.2 urllib3==2.2.3 wcwidth==0.2.13

zcrodriguez avatar Oct 17 '24 20:10 zcrodriguez