suonlight / ob-chatgpt

GNU General Public License v3.0
27 stars 5 forks source link

No module named 'chatgpt_wrapper' #3

Open OrionRandD opened 1 year ago

OrionRandD commented 1 year ago

Now I get it when executing the code-block:

SRC chatgpt "What is the capital of France?" SRC

executing Chatgpt code block... epc:start-server: Server may raise an error. Use "M-x epc:pop-to-last-server-process-buffer RET" to see full traceback: Traceback (most recent call last): File "/home/me/.emacs.d/.local/straight/repos/ChatGPT.el/chatgpt.py", line 5, in from chatgpt_wrapper import ChatGPT ModuleNotFoundError: No module named 'chatgpt_wrapper'

:(

monkeypants commented 1 year ago

similar to my answer in #2, you need to have chatgpt_wrapper installed in the python environment that emacs is starting it's subprocesses in. Suggest the following steps:

  1. decide which python environment you want to use. I did it with a virtualenv in ~/.emacs.d/, no idea if that's a good place for it.
  2. install chatgpt_wrapper in that python environment per the instructions here
  3. confirm chatgpt_wrapper is working by using the interactive mode. This will establish if your OPENAI_API_KEY environment variable is valid, etc.
  4. configure emacs to use the correct python environment (the one where chatgpt_wrapper is installed, as per my comment in #2
  5. confirm Chatgpt.el is working by selecting a region of text and then pressing C-c q RET RET

for me, after that, ob-chatgpt "just worked".