Options

[WinError 2] The system cannot find the file specified

Hi,

when running the functiona pandas_to_vertica():

vp.pandas_to_vertica(df=df_csv, name="sales", schema="Report")

I got this message:

[WinError 2] The system cannot find the file specified: 'sales.csv

But if I run the function pandas_to_vertica() in another Jupyter Notebook, the function works without problems.

Thank you for the support

Massimo

Answers

  • Options
    Bryan_HBryan_H Vertica Employee Administrator
    edited April 2023

    It looks like you're trying to copy a Pandas DataFrame "df_csv" that in turn points to a CSV file. When you try to print df_csv - just type "df_csv" in a cell and execute - what is the detailed message?

  • Options
    MaxMaffioMaxMaffio Vertica Customer

    Hi Bryan, thank you for the support.
    The variable "df_csv" is a pandas DataFrame, it is the ouput of a data-manipulation in python. All the code is in a Jupyter Notebook.
    At the end of the Notebook, I want to store the pandas dataframe named df_csv in Vertica. But I get the error:

    [WinError 2] The system cannot find the file specified: 'sales.csv'

    Is it like that it's saving the temporary file somewhere in the Laptop, but than it does not manage to find it?

  • Options
    MaxMaffioMaxMaffio Vertica Customer

    I tried also with:

    vp.pandas_to_vertica(df=df_sales_retail_dp, name="sales", schema="Report", temp_path=path)

    where path is defined in a cell of my Notebook.
    But I got another error message:

    pandas_to_vertica() got an unexpected keyword argument 'temp_path'

  • Options
    Bryan_HBryan_H Vertica Employee Administrator

    temp_path may have been added in a newer version. What version of VerticaPy have you installed? If possible, please run pip3 install --upgrade verticapy[all]

  • Options
    MaxMaffioMaxMaffio Vertica Customer

    I updated both conda and pip, but in Jupyter Notebook the problem persists, instead in PyCHarm (that uses py 10.5) it works without problems

  • Options
    MaxMaffioMaxMaffio Vertica Customer

    However, the error:

    [WinError 2] The system cannot find the file specified: 'sales.csv'

    persits also in PyCHamr, can it be due to Windows? Why verticapy does not manage to find the .csv file?

  • Options
    Bryan_HBryan_H Vertica Employee Administrator

    From the developers: "“pandas_to_vertica” exports the pandas to CSV first. “temp_file” is used to locate the file. If it is not defined it will create the temp file in the current directory." Depending on your setup, current directory might be a system path such as path to conda, and needs to be set differently.
    They request that you create an issue on GitHub so they can work on it: https://github.com/vertica/VerticaPy/issues

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file