I'm trying to follow the fine tuning guide for Openai here.
I ran:
pip install --upgrade openai
Which install without any errors.
But even after restarting my terminal, i still get
zsh: command not found: openai
Here is the output of echo $PATH:
/bin:/usr/bin:/usr/local/bin:/Users/nickrose/Downloads/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Here is the output of which python:
/usr/bin/python
Any tips for how to fix this? I'm on MacOS Big Sur 11.6.
CodePudding user response:
Basically pip installs the packages under its related python directory, in a directory called site-packages
(most likely, I'm not a python expert tbh). This is not included in the path you provided. First, ask pip to show the location to the package:
pip show openai
The output would be something like this:
Name: openai
Version: 0.22.0
Summary: Python client library for the OpenAI API
Home-page: https://github.com/openai/openai-python
Author: OpenAI
Author-email: [email protected]
License:
Location: /Users/<USER>/DIR/TO/SOME/PYTHON/site-packages
Requires: numpy, openpyxl, pandas, pandas-stubs, requests, tqdm
Required-by:
So your package will be available in
/Users/<USER>/DIR/TO/SOME/PYTHON/site-packages/openai
Either add /Users/<USER>/DIR/TO/SOME/PYTHON/site-packages/
to your path, or use the complete address to your package, or try to access it using your python:
python -m openai # -m stands for module
To get more information about the -m
flag, run python --help
.
Update
So as you mentioned in the comments, you get permission denied
after you add the directory to your package. This actually means that the package exists, but it's not permitted by your OS to execute. This is the thing you have to do, locate your package, and then:
sudo chmod x /PATH/TO/script
And the reason you're getting command not found
after you use sudo directly with the package, is that you update your path variable in zsh
, but when you use sudo
, superuser uses sh
instead of zsh
.