Little experience setting up environments_[solved]

hi all of you!
What is the easiest way to setup the environment to start the course.
Well, I have tried with a new virtual pipenv, but after installing “openai”, I have problems to import the dotenv module.

Any suggestion here or maybe indicate if anyone already posted about it? I also found hard to fin some topics in this forum

Thanks in advance!

below the error with “doenv”

Creating a virtualenv for this project…
Using /usr/bin/python3 (3.8.10) to create virtualenv…
⠋created virtual environment CPython3.8.10.final.0-64 in 120ms
creator CPython3Posix(dest=/home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm, clear=False, global=False)
seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, pkg_resources=latest, via=copy, app_data_dir=/home/felipe/.local/share/virtualenv/seed-app-data/v1.0.1.debian.1)
activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

Virtualenv location: /home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm
Creating a Pipfile for this project…
Installing dotenv…
Looking in indexes: Simple index
Collecting dotenv
Using cached dotenv-0.0.5.tar.gz (2.4 kB)

Error: An error occurred while installing dotenv!
ERROR: Command errored out with exit status 1:
command: /home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/bin/python -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-r9atj876/dotenv/setup.py’“'”‘; file=’“'”‘/tmp/pip-install-r9atj876/dotenv/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)(file);code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’“‘))’ egg_info --egg-base /tmp/pip-install-r9atj876/dotenv/pip-egg-info
cwd: /tmp/pip-install-r9atj876/dotenv/
Complete output (56 lines):
ERROR: Command errored out with exit status 1:
command: /home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '”‘"’/tmp/pip-wheel-q1798mrh/distribute/setup.py’“'”‘; file=’“'”‘/tmp/pip-wheel-q1798mrh/distribute/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)(file);code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ egg_info --egg-base /tmp/pip-wheel-q1798mrh/distribute/pip-egg-info
cwd: /tmp/pip-wheel-q1798mrh/distribute/
Complete output (20 lines):
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-wheel-q1798mrh/distribute/setuptools/init.py”, line 2, in
from setuptools.extension import Extension, Library
File “/tmp/pip-wheel-q1798mrh/distribute/setuptools/extension.py”, line 5, in
from setuptools.dist import _get_unpatched
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “/home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/lib/python3.8/site-packages/_virtualenv.py”, line 74, in exec_module
old(module)
File “/tmp/pip-wheel-q1798mrh/distribute/setuptools/dist.py”, line 7, in
from setuptools.command.install import install
File “/tmp/pip-wheel-q1798mrh/distribute/setuptools/command/init.py”, line 8, in
from setuptools.command import install_scripts
File “/tmp/pip-wheel-q1798mrh/distribute/setuptools/command/install_scripts.py”, line 3, in
from pkg_resources import Distribution, PathMetadata, ensure_directory
File “/tmp/pip-wheel-q1798mrh/distribute/pkg_resources.py”, line 1518, in
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module ‘importlib._bootstrap’ has no attribute ‘SourceFileLoader’
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Traceback (most recent call last):
File “/home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/lib/python3.8/site-packages/setuptools/installer.py”, line 128, in fetch_build_egg
subprocess.check_call(cmd)
File “/usr/lib/python3.8/subprocess.py”, line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[’/home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/bin/python’, ‘-m’, ‘pip’, ‘–disable-pip-version-check’, ‘wheel’, ‘–no-deps’, ‘-w’, ‘/tmp/tmp1_g4eynt’, ‘–quiet’, ‘distribute’]’ returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-r9atj876/dotenv/setup.py", line 13, in <module>
    setup(name='dotenv',
  File "/home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/lib/python3.8/site-packages/setuptools/__init__.py", line 144, in setup
    _install_setup_requires(attrs)
  File "/home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/lib/python3.8/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "/home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/lib/python3.8/site-packages/setuptools/dist.py", line 718, in fetch_build_eggs
    resolved_dists = pkg_resources.working_set.resolve(
  File "/home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/lib/python3.8/site-packages/pkg_resources/__init__.py", line 780, in resolve
    dist = best[req.key] = env.best_match(
  File "/home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1065, in best_match
    return self.obtain(req, installer)
  File "/home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1077, in obtain
    return installer(requirement)
  File "/home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/lib/python3.8/site-packages/setuptools/dist.py", line 777, in fetch_build_egg
    return fetch_build_egg(self, req)
  File "/home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/lib/python3.8/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
    raise DistutilsError(str(e))
distutils.errors.DistutilsError: Command '['/home/felipe/.local/share/virtualenvs/chatGpt_github-0VBkmuMm/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp1_g4eynt', '--quiet', 'distribute']' returned non-zero exit status 1.
----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

just a little update:
I have commented the lines that were giving me errors in order to continue, and it seems that the problem is that I don’t have enough quota in my chatGPT account (it is a free account).

import openai
# import dotenv
openai.api_key = "sk-4R72Vb9e****************PnbonYPOZjZBC"

# from dotenv import load_dotenv, find_dotenv
# _ = load_dotenv(find_dotenv())

# openai.api_key  = os.getenv('OPENAI_API_KEY')

def get_completion(prompt, model="gpt-3.5-turbo"):
    messages = [{"role": "user", "content": prompt}]
    response = openai.ChatCompletion.create(
        model=model,
        messages=messages,
        temperature=0, # this is the degree of randomness of the model's output
    )
    return response.choices[0].message["content"]


text = f"""
You should express what you want a model to do by \ 
providing instructions that are as clear and \ 
specific as you can possibly make them. \ 
This will guide the model towards the desired output, \ 
and reduce the chances of receiving irrelevant \ 
or incorrect responses. Don't confuse writing a \ 
clear prompt with writing a short prompt. \ 
In many cases, longer prompts provide more clarity \ 
and context for the model, which can lead to \ 
more detailed and relevant outputs.
"""
prompt = f"""
Summarize the text delimited by triple backticks \ 
into a single sentence.
```{text}```
"""
response = get_completion(prompt)
print(response)
# print("prueba")

ane here the error:
python3 test.py
Traceback (most recent call last):
File “test.py”, line 31, in
response = get_completion(prompt)
File “test.py”, line 12, in get_completion
response = openai.ChatCompletion.create(
File “/home/felipe/.local/share/virtualenvs/promtchat_pipenv-jPSa_LCf/lib/python3.8/site-packages/openai/api_resources/chat_completion.py”, line 25, in create
return super().create(*args, **kwargs)
File “/home/felipe/.local/share/virtualenvs/promtchat_pipenv-jPSa_LCf/lib/python3.8/site-packages/openai/api_resources/abstract/engine_api_resource.py”, line 153, in create
response, _, api_key = requestor.request(
File “/home/felipe/.local/share/virtualenvs/promtchat_pipenv-jPSa_LCf/lib/python3.8/site-packages/openai/api_requestor.py”, line 298, in request
resp, got_stream = self._interpret_response(result, stream)
File “/home/felipe/.local/share/virtualenvs/promtchat_pipenv-jPSa_LCf/lib/python3.8/site-packages/openai/api_requestor.py”, line 700, in _interpret_response
self._interpret_response_line(
File “/home/felipe/.local/share/virtualenvs/promtchat_pipenv-jPSa_LCf/lib/python3.8/site-packages/openai/api_requestor.py”, line 763, in _interpret_response_line
raise self.handle_error_response(
openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.

just saw is enoghth to run the jupiter notebook from the website :face_with_open_eyes_and_hand_over_mouth: