Forum in maintenance, we will back soon 🙂
[Solved] RE:Python error
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.
@wiscochris Can you please provide a screenshot of the error you're encountering
@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
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.
@wiscochris I just watched the video. To solve run in the terminal the following:
pip install openai
@wiscochris, why are you using Visual Studio?
Use VS code instead.
please try installing openai as @husein suggested, and try again.
@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.
@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
@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 🙂
@wiscochris Try running the following in the terminal:
pip install typing pydantic instructor streamlit requests selenium selenium-stealth
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 🙂
@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
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.
@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
@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?
@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.
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>
- 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
@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