Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

IO Error: Trying to read a database file with version number 51, but we can only read version 64... #1102

Open
chuongmep opened this issue Apr 11, 2024 · 2 comments

Comments

@chuongmep
Copy link

chuongmep commented Apr 11, 2024

System Info

pandas 2.2.2
pandasai 2.0.30
Windows 10
Python Version : 3.12.1

馃悰 Describe the bug

I have a issue like that when use SmartDataframe:
IO Error: Trying to read a database file with version number 51, but we can only read version 64. The database file was created with DuckDB version v0.8.0 or v0.8.1.
Example :

import os
import pandas as pd
from pandasai import SmartDataframe

# Sample DataFrame
sales_by_country = pd.DataFrame({
    "country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"],
    "sales": [5000, 3200, 2900, 4100, 2300, 2100, 2500, 2600, 4500, 7000]
})
df = SmartDataframe(sales_by_country)
df.chat('Which are the top 5 countries by sales?')
# Output: China,United States, Japan, Germany, Australia

Full log :

{
	"name": "IOException",
	"message": "IO Error: Trying to read a database file with version number 51, but we can only read version 64.
The database file was created with DuckDB version v0.8.0 or v0.8.1.

The storage of DuckDB is not yet stable; newer versions of DuckDB cannot read old database files and vice versa.
The storage will be stabilized when version 1.0 releases.

For now, we recommend that you load the database file in a supported version of DuckDB, and use the EXPORT DATABASE command followed by IMPORT DATABASE on the current version of DuckDB.

See the storage page for more information: https://duckdb.org/internals/storage",
	"stack": "---------------------------------------------------------------------------
IOException                               Traceback (most recent call last)
Cell In[15], line 1
----> 1 sdf = SmartDataframe(sales_by_country)

File c:\\Users\\vho2\\AppData\\Local\\anaconda3\\envs\\python3\\Lib\\site-packages\\pandasai\\smart_dataframe\\__init__.py:62, in SmartDataframe.__init__(self, df, name, description, custom_head, config)
     52 \"\"\"
     53 Args:
     54     df: A supported dataframe type, or a pandasai Connector
   (...)
     58     config (Config, optional): Config to be used. Defaults to None.
     59 \"\"\"
     60 self._original_import = df
---> 62 self._agent = Agent([df], config=config)
     64 self.dataframe = self._agent.context.dfs[0]
     66 self._table_description = description

File c:\\Users\\vho2\\AppData\\Local\\anaconda3\\envs\\python3\\Lib\\site-packages\\pandasai\\agent\\base.py:76, in Agent.__init__(self, dfs, config, memory_size, pipeline, vectorstore, description)
     74 # Instantiate the context
     75 config = self.get_config(config)
---> 76 self.context = PipelineContext(
     77     dfs=dfs,
     78     config=config,
     79     memory=Memory(memory_size, agent_info=description),
     80     vectorstore=vectorstore,
     81 )
     83 # Instantiate the logger
     84 self.logger = Logger(save_logs=config.save_logs, verbose=config.verbose)

File c:\\Users\\vho2\\AppData\\Local\\anaconda3\\envs\\python3\\Lib\\site-packages\\pandasai\\pipelines\\pipeline_context.py:35, in PipelineContext.__init__(self, dfs, config, memory, skills_manager, cache, vectorstore, initial_values)
     32 self.skills_manager = skills_manager or SkillsManager()
     34 if config.enable_cache:
---> 35     self.cache = cache if cache is not None else Cache()
     36 else:
     37     self.cache = None

File c:\\Users\\vho2\\AppData\\Local\\anaconda3\\envs\\python3\\Lib\\site-packages\\pandasai\\helpers\\cache.py:32, in Cache.__init__(self, filename, abs_path)
     29 os.makedirs(cache_dir, mode=DEFAULT_FILE_PERMISSIONS, exist_ok=True)
     31 self.filepath = os.path.join(cache_dir, f\"{filename}.db\")
---> 32 self.connection = duckdb.connect(self.filepath)
     33 self.connection.execute(
     34     \"CREATE TABLE IF NOT EXISTS cache (key STRING, value STRING)\"
     35 )

IOException: IO Error: Trying to read a database file with version number 51, but we can only read version 64.
The database file was created with DuckDB version v0.8.0 or v0.8.1.

The storage of DuckDB is not yet stable; newer versions of DuckDB cannot read old database files and vice versa.
The storage will be stabilized when version 1.0 releases.

For now, we recommend that you load the database file in a supported version of DuckDB, and use the EXPORT DATABASE command followed by IMPORT DATABASE on the current version of DuckDB.

See the storage page for more information: https://duckdb.org/internals/storage"
}
@gventuri
Copy link
Collaborator

Which version of DuckDB are you using?

@chuongmep
Copy link
Author

Hi @gventuri , I updated latest version of DuckDB , any problem relate to Macos M1 Silicon, because when I'm try with another computer and windows, it worked well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants