Skip to content

Forum in maintenance, we will back soon 🙂

Connect Python With...
 
Notifications
Clear all

Connect Python With OpenAI API section question

5 Posts
2 Users
1 Reactions
20 Views
(@hursel-williams)
Posts: 29
Eminent Member Customer
Topic starter
 

I was testing the API connection and it returned an error. Line 1 was import openai. I did install using "pip install openai" Any ideas?

sh-5.1$ /bin/python /home/mcuser/Documents/python/chatgpt.py
[670 preload-host-spawn-strategy] Warning: waitpid override ignores groups
Traceback (most recent call last):
File "/home/mcuser/Documents/python/chatgpt.py", line 1, in <module>
import openai
ModuleNotFoundError: No module named 'openai'
[670 preload-host-spawn-strategy] Warning: waitpid override ignores groups
sh-5.1$ /bin/python /home/mcuser/Documents/python/chatgpt.py
[670 preload-host-spawn-strategy] Warning: waitpid override ignores groups
Traceback (most recent call last):
File "/home/mcuser/Documents/python/chatgpt.py", line 1, in <module>
import openai
ModuleNotFoundError: No module named 'openai'
[670 preload-host-spawn-strategy] Warning: waitpid override ignores groups

 
Posted : 08/17/2023 10:50 am
(@hursel-williams)
Posts: 29
Eminent Member Customer
Topic starter
 

I thought I would try the same using my Windows machine (was using a Linux machine). When I try "pip install openai" is get an error:

PS C:\Users\13173\Documents\GitHub\pro104-repo> pip install openai
pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the e program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ pip install openai
+ ~~~
+ CategoryInfo : ObjectNotFound: (pip:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

 
Posted : 08/17/2023 12:48 pm
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

Did you install python on windows and added to path?

 
Posted : 08/17/2023 1:39 pm
SSAdvisor reacted
(@hursel-williams)
Posts: 29
Eminent Member Customer
Topic starter
 

@admin Yes sir! I ended up choosing the repair option on python. Said it was repaired. Working now. Pretty strange...

 
Posted : 08/18/2023 10:36 am
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

@hursel-williams yeah you should add your payment details to use the API

 
Posted : 08/18/2023 12:16 pm
Share:
[the_ad_group id="312"]