Skip to content

Forum in maintenance, we will back soon 🙂

OPenAPI Script Erro...
 
Notifications
Clear all

OPenAPI Script Errors

24 Posts
4 Users
7 Reactions
332 Views
(@google-rayazsiddiqi)
Posts: 95
Estimable Member
Topic starter
 

@admin @ssadvisor i tried again and here is what I got

 

import openai
ModuleNotFoundError: No module named 'openai'
PS D:\github repos\test-repo> d:
PS D:\github repos\test-repo> cd..
PS D:\github repos> cd..
PS D:\> c:
PS C:\> & "d:/github repos/test-repo/venv/Scripts/python.exe" "d:/github repos/test-repo/chatgpt.py"
Traceback (most recent call last):
File "d:\github repos\test-repo\chatgpt.py", line 1, in <module>
import openai
ModuleNotFoundError: No module named 'openai'
PS C:\>

 
Posted : 04/29/2024 5:45 pm
(@husein)
Posts: 531
Member Moderator
 

@google-rayazsiddiqi You're getting this error while using a virtual environment and installing openai?

 
Posted : 04/29/2024 6:45 pm
(@google-rayazsiddiqi)
Posts: 95
Estimable Member
Topic starter
 

@husein please see the code below, I've tried to create the Virtual env but it didn't work. So I used the command mentioned by @ssadvisor to set the permissions level and that gave errors as well. Please help as I need to get this working, thanks!! Can someone please provie a step by step guide on what to do to get this working, many thanks!!

 

PS C:\Users\rayaz\Python Projects\Openai> & D:/Python/python.exe "c:/Users/rayaz/Python Projects/Openai/chatgpt.py"
PS C:\Users\rayaz\Python Projects\Openai> python -m venv venv
PS C:\Users\rayaz\Python Projects\Openai> venv/scripts/activate
venv/scripts/activate : File C:\Users\rayaz\Python Projects\Openai\venv\scripts\Activate.ps1 cannot be loaded because running scripts is
disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ venv/scripts/activate
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\rayaz\Python Projects\Openai> Set-ExecutionPolicy -ExecutionPolicy Bypass
Set-ExecutionPolicy : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell' is
denied. To change the execution policy for the default (LocalMachine) scope, start Windows PowerShell with the "Run as administrator"
option. To change the execution policy for the current user, run "Set-ExecutionPolicy -Scope CurrentUser".
At line:1 char:1
+ Set-ExecutionPolicy -ExecutionPolicy Bypass
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
PS C:\Users\rayaz\Python Projects\Openai>

 
Posted : 04/29/2024 7:14 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@google-rayazsiddiqi right-click the icon for the command windows and choose "Run as administrator" (if I recall it correctly but if not it will be similar).

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 04/29/2024 11:59 pm
Hasan Aboul Hasan
(@admin)
Posts: 1252
Member Admin
 

1- Open VS Code as Administrator

2- in the terminal run: Set-ExecutionPolicy -ExecutionPolicy Bypass

3- continue your work

 
Posted : 04/30/2024 8:06 am
SSAdvisor reacted
(@google-rayazsiddiqi)
Posts: 95
Estimable Member
Topic starter
 

@admin I'm about to give up on this course and this program, I think it may be too technical for me. I added the code you mentioned and it didn't work. I dont know how to run VS code in Admin mode. Can someone give me words of encouragement or should I just quit this program? I tried in windows admin mode and go this error:

image

 

Error Message:

PS C:\Users\rayaz\Python Projects\Openai> Set-ExecutionPolicy -ExecutionPolicy Bypass
Set-ExecutionPolicy : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell' is
denied. To change the execution policy for the default (LocalMachine) scope, start Windows PowerShell with the "Run as administrator"
option. To change the execution policy for the current user, run "Set-ExecutionPolicy -Scope CurrentUser".
At line:1 char:1
+ Set-ExecutionPolicy -ExecutionPolicy Bypass
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand

 

 

 
Posted : 05/07/2024 5:33 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@google-rayazsiddiqi hire a local High School student to help you with modifying your windows registry. This is one of the reasons I dislike Windows OS. The "Run As Administrator" option is available when you Right Click the icon to start VS Code.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 05/07/2024 7:00 pm
(@google-rayazsiddiqi)
Posts: 95
Estimable Member
Topic starter
 

@admin @husein getting this error when running openai script

File "C:\Users\rayaz\Python Projects\Openai\venv\Lib\site-packages\openai\_base_client.py", line 1005, in _request
return self._retry_request(
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rayaz\Python Projects\Openai\venv\Lib\site-packages\openai\_base_client.py", line 1053, in _retry_request
return self._request(
^^^^^^^^^^^^^^
File "C:\Users\rayaz\Python Projects\Openai\venv\Lib\site-packages\openai\_base_client.py", line 1020, in _request
raise self._make_status_error_from_response(err.response) from None
openai.RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors .', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}

 
Posted : 05/07/2024 8:15 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@google-rayazsiddiqi you need to update your OpenAI account to purchase more tokens.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 05/08/2024 11:44 am
Page 2 / 2
Share: