Skip to content
site logo mobile

Forum in maintenance, we will back soon 🙂

RE:Python error
 
Notifications
Clear all

[Solved] RE:Python error

24 Posts
4 Users
2 Likes
99 Views
(@wiscochris)
Posts: 28
Member
Power Member
Topic starter
 

Hi,

I have followed this guidance https://learnwithhasan.com/optimize-landing-pages-ai/ and when running the script,

terminal is generating the following error: https://app.screencast.com/iqjvg6WaEGH3D    

chat GPT suggests: https://app.screencast.com/OWPHQ3TvQSXfV

Any guidance on this issue would be very much appreciated.

 
Posted : 03/31/2024 9:30 am
(@husein)
Posts: 262
Member Moderator
Premium Member
Prompt Engineer
Pythonista Prodigy Badge
API Entrepreneur
Power Member
 

@wiscochris Can you please provide a screenshot of the error you're encountering

 
Posted : 03/31/2024 1:11 pm
SSAdvisor
(@ssadvisor)
Posts: 916
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@wiscochris your pictures aren't giving me any clues, especially the ChatGPT response since you didn't give the prompt you used. Can you please create a public GitHub repository and share your code so we can help debug it?

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

 
Posted : 03/31/2024 1:58 pm
(@wiscochris)
Posts: 28
Member
Power Member
Topic starter
 

Hi, thanks for your replies and help. I just joined as a annual member and will post future questions in that forum but, I will finsih up this chat here.   Here is my git    https://github.com/christojuan2/AI-Marketing-Army-Tester-main2

Note that it containst the same exact files that were downloaded here:  https://learnwithhasan.com/optimize-landing-pages-ai/   The only difference betweeen what you find on my git and the files in my example video are that I added my Openai and imagur api keys to the openai_functions.py and web_screenshot.py files. Once I added the apis I ran app.py from the command line and the result is:
https://app.screencast.com/YUHWy3JZJlphY  

this video hopefully helps explain everythign  I tried. I'm sure I'm missing something basic as I imagine that others have been successful.

https://app.screencast.com/gXEe0fS69UUtg  

 

Thanks again for any help you can provide.

 
Posted : 04/01/2024 11:14 pm
(@husein)
Posts: 262
Member Moderator
Premium Member
Prompt Engineer
Pythonista Prodigy Badge
API Entrepreneur
Power Member
 

@wiscochris I just watched the video. To solve run in the terminal the following:

pip install openai
 
Posted : 04/02/2024 7:39 am
Hasan Aboul Hasan
(@admin)
Posts: 954
Member Admin
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@wiscochris, why are you using Visual Studio? 

Use VS code instead.

please try installing openai as @husein suggested, and try again. 

 
Posted : 04/02/2024 10:13 am
(@wiscochris)
Posts: 28
Member
Power Member
Topic starter
 

@admin Thanks for the redirect on VS. I was trying to figure out what you are using and though it was VS. VS code is much nicer :).
@husein I attempted to pip install openai and get this error https://app.screencast.com/W9zrbbK4gGXtT 🙁 
@ssadvisor thanks again for the idea to put this on github. If it would be helpful to you guys I could share a private git that includes my apis if that would help. I would need guidance on what emails to invite. 

 
Posted : 04/02/2024 12:05 pm
SSAdvisor
(@ssadvisor)
Posts: 916
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@wiscochris I just checked @Hasan's repository and he forgot to include a requirements.txt file. You are probably missing many of the required modules because of that.

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

 
Posted : 04/02/2024 12:57 pm
(@wiscochris)
Posts: 28
Member
Power Member
Topic starter
 

@hasan if you happen to have the referenced “modules” I’d really appreciate it. I’d really like to add the this tool to the saas store that I am building. Thanks much 🙂

 
Posted : 04/03/2024 2:08 am
(@husein)
Posts: 262
Member Moderator
Premium Member
Prompt Engineer
Pythonista Prodigy Badge
API Entrepreneur
Power Member
 

@wiscochris Try running the following in the terminal:

pip install typing pydantic instructor streamlit requests selenium selenium-stealth
 
Posted : 04/03/2024 10:59 am
(@wiscochris)
Posts: 28
Member
Power Member
Topic starter
 

Thanks @hasan for the reply.  

When I run: pip install typing pydantic instructor streamlit requests selenium selenium-stealth
I get: 

PS C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main> pip install typing pydantic instructor streamlit requests selenium selenium-stealth
Collecting typing
  Using cached typing-3.7.4.3.tar.gz (78 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pydantic in c:\python36\lib\site-packages (1.8.2)
ERROR: Could not find a version that satisfies the requirement instructor (from versions: none)
ERROR: No matching distribution found for instructor

As a reminder:
I first tried to run: python app.py
and got:

PS C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main> python app.py
Traceback (most recent call last):
  File "app.py", line 1, in <module>
    from openai_functions import analyze_image_basic,generate_with_response_model
  File "C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main\openai_functions.py", line 1, in <module>
    from openai import OpenAI
ImportError: cannot import name 'OpenAI'

I then tried to run: pip install openai
and got:

PS C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main> pip install openai
Requirement already satisfied: openai in c:\python36\lib\site-packages (0.8.0)
Requirement already satisfied: requests>=2.20 in c:\python36\lib\site-packages (from openai) (2.27.1)
Requirement already satisfied: tqdm in c:\python36\lib\site-packages (from openai) (4.62.3)
Requirement already satisfied: idna<4,>=2.5 in c:\python36\lib\site-packages (from requests>=2.20->openai) (3.3)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\python36\lib\site-packages (from requests>=2.20->openai) (2.0.10)
Requirement already satisfied: certifi>=2017.4.17 in c:\python36\lib\site-packages (from requests>=2.20->openai) (2021.10.8)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\python36\lib\site-packages (from requests>=2.20->openai) (1.26.8)
Requirement already satisfied: colorama in c:\python36\lib\site-packages (from tqdm->openai) (0.4.4)

any further guidance would be appreciated 🙂

 
Posted : 04/03/2024 2:45 pm
(@wiscochris)
Posts: 28
Member
Power Member
Topic starter
 

I'm sorry, I meant to at mention @husein in that post. 

 
Posted : 04/03/2024 3:22 pm
SSAdvisor
(@ssadvisor)
Posts: 916
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@wiscochris do you have a file or folder named openai? That could present the problem you're seeing.

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

 
Posted : 04/03/2024 4:15 pm
(@wiscochris)
Posts: 28
Member
Power Member
Topic starter
 

Hi again,

You can see all of the files and folders that I have here: (I created that earlier per your suggestion)   https://github.com/christojuan2/AI-Marketing-Army-Tester-main2  

thanks for you continued engagement on this.

 
Posted : 04/04/2024 12:38 am
SSAdvisor
(@ssadvisor)
Posts: 916
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@wiscochris I mean anywhere on your disk. Maybe you have multiple versions of OpenAI installed. Be sure to use a virtual environment and be sure that it is active when you run the code.

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

 
Posted : 04/04/2024 2:39 am
(@husein)
Posts: 262
Member Moderator
Premium Member
Prompt Engineer
Pythonista Prodigy Badge
API Entrepreneur
Power Member
 

@wiscochris I tried right now to uninstall openai and install it again, and it worked perfectly. Import problems, in this case, might be caused by having an openai.py file in the same folder as your project. Check that and let us know.

By the way, are you still using visual studio or VS code?

 
Posted : 04/04/2024 10:52 am
Hasan Aboul Hasan
(@admin)
Posts: 954
Member Admin
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@wiscochris can you try creating a virtual environment then install the packages.

Commands:

python -m venv venv

Then, if you are on windows, run:

venv\Scripts\activate

if you are on a mac, run :

source venv/bin/activate

 

Then, install the packages. this will isolate the problem somehow. 

let us know what happens. 

 
Posted : 04/04/2024 11:14 am
(@wiscochris)
Posts: 28
Member
Power Member
Topic starter
 

Thank you @admin, I played around a bit and figured out how to get openai installed. My next issue is as follows:

As you can see openai is already installed. Even when I try the python -m venv venv approach I am unble to install instructor (note also that I see not instructor related file in the file folders.) below is the VS code, code. and here is a screenshot of the same for easier reading  https://app.screencast.com/kAMDAYD8cABy4 . your continued help is appreciated.

PS C:\Users\bazoo> pip install openai
Requirement already satisfied: openai in c:\python36\lib\site-packages (0.8.0)
Requirement already satisfied: requests>=2.20 in c:\python36\lib\site-packages (from openai) (2.27.1)
Requirement already satisfied: tqdm in c:\python36\lib\site-packages (from openai) (4.62.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\python36\lib\site-packages (from requests>=2.20->openai) (1.26.8)
Requirement already satisfied: certifi>=2017.4.17 in c:\python36\lib\site-packages (from requests>=2.20->openai) (2021.10.8)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\python36\lib\site-packages (from requests>=2.20->openai) (2.0.10)
Requirement already satisfied: idna<4,>=2.5 in c:\python36\lib\site-packages (from requests>=2.20->openai) (3.3)
Requirement already satisfied: colorama in c:\python36\lib\site-packages (from tqdm->openai) (0.4.4)
PS C:\Users\bazoo> python app.py
C:\Python36\python.exe: can't open file 'app.py': [Errno 2] No such file or directory
PS C:\Users\bazoo> cd C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main
PS C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main> python app.py
Traceback (most recent call last):
  File "app.py", line 1, in <module>
    from openai_functions import analyze_image_basic,generate_with_response_model
  File "C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main\openai_functions.py", line 2, in <module>
    import instructor
ModuleNotFoundError: No module named 'instructor'
PS C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main> pip install instructor
ERROR: Could not find a version that satisfies the requirement instructor (from versions: none)
ERROR: No matching distribution found for instructor
PS C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main> python -m venv venv
PS C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main> venv\Scripts\activate
(venv) PS C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main> pip install instructor
Collecting instructor
  Could not find a version that satisfies the requirement instructor (from versions: )
No matching distribution found for instructor
You are using pip version 18.1, however version 21.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
(venv) PS C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main> 
 
Posted : 04/06/2024 11:50 am
SSAdvisor
(@ssadvisor)
Posts: 916
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

@wiscochris

  • activate your virtual environment
  • python -m pip install --upgrade pip
  • pip install -U instructor

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

 
Posted : 04/06/2024 12:25 pm
(@wiscochris)
Posts: 28
Member
Power Member
Topic starter
 

@ssadvisor thanks for that additional Guidiance. here is the error result 
https://app.screencast.com/BqIwlW5AbMdZV   
I'd appreciate any additional guidance.

(venv) PS C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main> python -m pip install --upgrade pip
Collecting pip
  Using cached  https://files.pythonhosted.org/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl 
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
Successfully installed pip-21.3.1
(venv) PS C:\Users\bazoo\Downloads\AI-Marketing-Army-Tester-main2\AI-Marketing-Army-Tester-main> pip install -U instructor
ERROR: Could not find a version that satisfies the requirement instructor (from versions: none)
ERROR: No matching distribution found for instructor
 
Posted : 04/06/2024 1:45 pm
Page 1 / 2
Share: