CLI data preparation tool Windows

I am having issue with data preparation tool on Windows:
(Here is the document I followed: ).

Both of these commands are working:

pip install --upgrade openai

(I replaced export with SET)

But, when I am using this: openai tools fine_tunes.prepare_data -f <LOCAL_FILE> , it is showing this:

Please help me with this.

Together with the support team, I was unable to get this working on Windows. They ended up suggesting Google Colab, which finally worked. If all else fails, try that!

I know why it’s not working for Windows users running ‘openai’ CLI commands through Command Prompt and PowerShell, as well as why this will work for Windows users running it using ‘Git Bash’:

When you call ‘openai’ in Command Prompt and Powershell, the system will traverse the PATH system variable which contains a list of directories to look through to find ‘openai’ (Like when you call ‘Notepad’ which is the same as running ‘C:\Windows\System32\Notepad.exe’). The ‘openai’ file can be found inside of ‘[Python install directory]\Scripts’. So for me, the directory is ‘C:\Users\iadmin\AppData\Local\Programs\Python\Python39\Scripts\openai’, however it does not have an extension as you can see:

Because of this, Command Prompt and PowerShell will ask you which program you want to open the file in, but selecting ‘Python.exe’ will simply run the program and not keep it open interactively. I’m trying to find a current workaround for this.

Git Bash works though, and after a little investigating as to why, I figured it out. The ‘openai’ file will contain something like this at the top (Shows up different for everyone):


That line starts with ‘#!’ and essentially tells Git Bash what interpreter to use (in this case, Python). So it will launch the Python shell and then run ‘openai’ which is essentially a Python file. Git Bash is a Bash emulator so it analyzes the ‘openai’ file differently than Command Prompt and PowerShell.

For now, I highly recommend downloading Git Bash for now to support running the OpenAI CLI commands on Windows!


Works well with the Ubuntu Linux subsystem installed on Windows. Regular Windows, not worth trying.


@jackcole, as long as the program you’re calling ‘openai’ from has the Bash shell, then it will work, otherwise the program will not know how to open that file.

1 Like

I installed Ubuntu Linux subsysytem on Windows, and it is working as expected.


Thank you @jackcole