Reputation: 65
I was trying to install openai to fine tune the model and use opeanAI cli to train the model.
python --version
Python 3.10.6
I also installed openai package
pip show openai
Name: openai
Version: 0.26.4
Summary: Python client library for the OpenAI API
Home-page: https://github.com/openai/openai-python
Author: OpenAI
Author-email: [email protected]
License:
Location: /home/vanshmittal/.local/lib/python3.10/site-packages
Requires: aiohttp, requests, tqdm
Required-by:
.zshrc file contains
alias python=/usr/bin/python3
alias pip=/usr/bin/pip3.10
export PATH="$PATH:/home/vanshmittal/.local/lib/python3.10/site-packages/openai"
On checking $PATH
echo $PATH
it had the above path provided
:/home/vanshmittal/.local/lib/python3.10/site-packages/openai
on running opeanAI CLI command says zsh: command not found: openai
openai tools fine_tunes.prepare_data -f <file_path>
I also followed this stackoverflow question:- openai command not found (mac)
python -m openai
/usr/bin/python3: No module named openai.__main__; 'openai' is a package and cannot be directly executed
Made the file executable also
sudo chmod +x /home/vanshmittal/.local/lib/python3.10/site-packages/openai/
But even after that also it's returning zsh: command not found: openai Could anyone please help me, what additionally needs to be done for successfull installation?
Upvotes: 2
Views: 1356
Reputation: 2013
I would recommend making an executable bash script in /usr/loca/bin/
.
Execute the following command to create a bash script that calls the the OpenAI Python CLI script:
sudo sh -c 'echo python3 "$(python3 -m site --user-site)"/openai/_openai_scripts.py \$\@ > /usr/local/bin/openai'
and then make that script executable:
sudo chmod +x /usr/local/bin/openai
Afterwards you should be able to simply execute openai --help
or any other openai cli command from your shell/terminal.
Upvotes: 0
Reputation: 11
I had a similar error after trying several times, I solved it by adding the following to my zshrc:
export PATH=$PATH:/home/USER/.local/bin
export PATH="$PATH:/home/USER/.local/lib/python3.10/site-packages/openai"
I hope I can solve your problem
Upvotes: 1