gpt-pilot icon indicating copy to clipboard operation
gpt-pilot copied to clipboard

[BUG]: VSCode extension cannot set up Python environment on Windows

Open senko opened this issue 2 years ago • 42 comments

When setting up GPT-Pilot VSCode extension in windows, one of the steps is to create the Python virtual environment (venv).

This can fail (for as of yet unknown reason), and this is what the users see:

image

Temporary workaround:

  1. open command line in the gpt-pilot sub-directory of the folder which you selected for the installation of GPT Pilot (there should be requirements.txt file already there)
  2. create the virtual environment with python -m venv pilot-env
  3. activate the environment with pilot-env\Scripts\activate
  4. install packages with pip install -r requirements.txt
  5. go to the pilot subdirectory (not pilot-env, just pilot). If there is gpt-pilot file in that subdirectory delete it (that is sqlite database) and then run python db_init.py to initialize new database

After doing the above steps, the VSCode extension should start working.

senko avatar Dec 22 '23 00:12 senko

This is likely caused by the way we chain commands to go to the directory, create the env and set it up in the VSCode extension installer script.

senko avatar Dec 22 '23 00:12 senko

I am having the same error except when I try to do your workaround I get a long list of errors that flash on the screen and then disapear image

To me it looks like

python db_init.py

Was unsuccessful. When I run the command should it have any output? (I have no output but also no errors)

Eforen avatar Dec 22 '23 04:12 Eforen

Hi, Issue still persists even after workaround. I did a video on it https://youtu.be/ZtOBOHf5lTs?si=VXP2hbYKGcuzJhlN

fahdmirza avatar Dec 22 '23 04:12 fahdmirza

When setting up GPT-Pilot VSCode extension in windows, one of the steps is to create the Python virtual environment (venv).

This can fail (for as of yet unknown reason), and this is what the users see:

image

Temporary workaround:

1. open command line in the `gpt-pilot` sub-directory of the folder which you selected for the installation of GPT Pilot (there should be `requirements.txt` file already there)

2. create the virtual environment with `python -m venv pilot-env`

3. activate the environment with `pilot-env\Scripts\activate`

4. install packages with `pip install -r requirements.txt`

5. go to the `pilot` subdirectory (not `pilot-env`, just `pilot`), then run `python db_init.py` to initialize the database

After doing the above steps, the VSCode extension should start working.

This worked for me

jdavid82 avatar Dec 22 '23 05:12 jdavid82

We've just published an update to the VSCode extension (version 0.0.21) that fixes this.

After you install the update, you'll need to go to Settings (in the extension) and choose a different (new) directory for gpt-pilot installation. This is because the old folder has incomplete install, which gives that error. Alternatively you can just remove that gpt-pilot folder in the windows explorer and start the extension which will try to re-initialize it.

@Eforen @fahdmirza @jdavid82 please try it out and let us know if that fixes it for you.

senko avatar Dec 22 '23 08:12 senko

image I am still getting this error this morning.

SerenityNrrd avatar Dec 22 '23 14:12 SerenityNrrd

image I am still getting this error this morning.

same

dreamrec avatar Dec 22 '23 15:12 dreamrec

Just adding this to see if it helps locate the cause of this issue. After the install, I get this error: Traceback (most recent call last): File "c:\AI\gpt-pilot\workspace/gpt-pilot/pilot/main.py", line 8, in from dotenv import load_dotenv ModuleNotFoundError: No module named 'dotenv'

See image

I did try deleting the workspace directory and letting it re-initialize it. This caused an error because the last slash in the path was incorrect, (see image) which made it just loop. I manually created the directories and it did re-initialize the workspace, but didn't fix the above error.

Brian

New app error workspace

brain1961 avatar Dec 22 '23 16:12 brain1961

Just adding this to see if it helps locate the cause of this issue. After the install, I get this error: Traceback (most recent call last): File "c:\AI\gpt-pilot\workspace/gpt-pilot/pilot/main.py", line 8, in from dotenv import load_dotenv ModuleNotFoundError: No module named 'dotenv'

See image

I did try deleting the workspace directory and letting it re-initialize it. This caused an error because the last slash in the path was incorrect, (see image) which made it just loop. I manually created the directories and it did re-initialize the workspace, but didn't fix the above error.

Brian

New app error workspace

Having this same issue on Windows.

MikeTheBard avatar Dec 22 '23 19:12 MikeTheBard

Didn't have to manaully go in and fix the install to get to the same point but still the same result.

Eforen avatar Dec 22 '23 19:12 Eforen

Screenshot 2023-12-22 at 12 56 11 PM

Having the same issue on M2 Mac

FreddyCi avatar Dec 22 '23 20:12 FreddyCi

Guys any update ? I also have the same dotenv error as others stated.

sidhellman avatar Dec 22 '23 22:12 sidhellman

Hi guys,

we're still working on the issue. In the meantime please try the workaround steps from the description, while making sure you're in the right directory.

senko avatar Dec 22 '23 23:12 senko

Screenshot 2023-12-23 005106

I just don't understand why Youtubers are reviewing this app when it just doesn't work. ffs!

RFARREY avatar Dec 22 '23 23:12 RFARREY

The workaround still lands at the dotenv not found error. Any other workaround other than what is posted above ?

sidhellman avatar Dec 22 '23 23:12 sidhellman

Solved with this steps:

  • Delete the 'gpt-pilot' folder.
  • Install another version of the plugin and select 0.0.20.
  • Use the plugin until the error occurs.
  • Delete the 'gpt-pilot' folder.
  • Update to new version

coelhomultimedia avatar Dec 22 '23 23:12 coelhomultimedia

Screenshot 2023-12-23 005106

I just don't understand why Youtubers are reviewing this app when it just doesn't work. ffs!

because the youtubers use mac computers

Eforen avatar Dec 23 '23 05:12 Eforen

@Siddharth1988 @FreddyCi @RFARREY I was getting the missing dotenv issue at first.

I got this working on a fresh version of the extension I downloaded yesterday. You might want to try uninstalling + deleting your current extension (and the entire GPT-Pilot folder) and redownloading / starting over if you have been having issues up to this point.

Make sure you have a recent version of Python installed, I am using python 3.10.6 on Windows 11 Make sure you can run the python command from inside your terminal in vscode and the expected version initializes (pretty sure it needs to be greater than version 3.9. I use 3.10.6 because stable diffusion required it)

To start, when I opened my terminal in VSCode. It brought me to C:\Users\aaron\PycharmProjects\GPT_Pilot\gpt-pilot\workspace This is correct, but notice the \workspace. If you are there, cd .. up a level into \gpt-pilot

In the gpt-pilot dir, confirm there is a requirements.txt file in that directory using dir or ls. Also confirm there is a directory there called \pilot-env If that directory already exists, run ./pilot-env/Scripts/activate if not, run

python -m venv pilot-env
./pilot-env/Scripts/activate

Once the virtual environment is activated, install required packages with pip install -r requirements.txt go to the pilot subdirectory (not pilot-env, just pilot), cd pilot, then run python db_init.py to initialize the database.

Once you have done all of this, reopen the gpt-pilot extension using the icon on the left panel in vscode. signin, and select new project. It should initialize correctly now.

aaronjolson avatar Dec 23 '23 16:12 aaronjolson

Getting this error with @aaronjolson's steps.

37Vtgcr

MikeTheBard avatar Dec 23 '23 18:12 MikeTheBard

@Siddharth1988 @FreddyCi @RFARREY

I got this working on a fresh version of the extension I downloaded yesterday. You might want to try uninstalling + deleting your current extension (and the entire GPT-Pilot folder) and redownloading / starting over if you have been having issues up to this point.

Make sure you have a recent version of Python installed, I am using python 3.10.6 on Windows 11 Make sure you can run the python command from inside your terminal in vscode and the expected version initializes (pretty sure it needs to be greater than version 3.9. I use 3.10.6 because stable diffusion required it)

To start, when I opened my terminal in VSCode. It brought me to C:\Users\aaron\PycharmProjects\GPT_Pilot\gpt-pilot\workspace This is correct, but notice the \workspace. If you are there, cd .. up a level into \gpt-pilot

In the gpt-pilot dir, confirm there is a requirements.txt file in that directory using dir or ls. Also confirm there is a directory there called \pilot-env If that directory already exists, run ./pilot-env/Scripts/activate if not, run

python -m venv pilot-env
./pilot-env/Scripts/activate

Once the virtual environment is activated, install required packages with pip install -r requirements.txt go to the pilot subdirectory (not pilot-env, just pilot), cd pilot, then run python db_init.p to initialize the database.

Once you have done all of this, reopen the gpt-pilot extension using the icon on the left panel in vscode. signin, and select new project. It should initialize correctly now.

There's a slight typo here, missing the last character of the last file extension to run. Should be "db_init.py" (that got me working)

Bundbary avatar Dec 23 '23 20:12 Bundbary

@Siddharth1988 @FreddyCi @RFARREY I got this working on a fresh version of the extension I downloaded yesterday. You might want to try uninstalling + deleting your current extension (and the entire GPT-Pilot folder) and redownloading / starting over if you have been having issues up to this point. Make sure you have a recent version of Python installed, I am using python 3.10.6 on Windows 11 Make sure you can run the python command from inside your terminal in vscode and the expected version initializes (pretty sure it needs to be greater than version 3.9. I use 3.10.6 because stable diffusion required it) To start, when I opened my terminal in VSCode. It brought me to C:\Users\aaron\PycharmProjects\GPT_Pilot\gpt-pilot\workspace This is correct, but notice the \workspace. If you are there, cd .. up a level into \gpt-pilot In the gpt-pilot dir, confirm there is a requirements.txt file in that directory using dir or ls. Also confirm there is a directory there called \pilot-env If that directory already exists, run ./pilot-env/Scripts/activate if not, run

python -m venv pilot-env
./pilot-env/Scripts/activate

Once the virtual environment is activated, install required packages with pip install -r requirements.txt go to the pilot subdirectory (not pilot-env, just pilot), cd pilot, then run python db_init.p to initialize the database. Once you have done all of this, reopen the gpt-pilot extension using the icon on the left panel in vscode. signin, and select new project. It should initialize correctly now.

There's a slight typo here, missing the last character of the last file extension to run. Should be "db_init.py" (that got me working)

I followed these instructions and caught the typo, but still end up with my errors above.

MikeTheBard avatar Dec 23 '23 20:12 MikeTheBard

@MikeTheBard - what version of windows + python are you using? Did all the dependencies install correctly when you ran pip install -r requirements.txt ?

aaronjolson avatar Dec 23 '23 21:12 aaronjolson

Just adding this to see if it helps locate the cause of this issue. After the install, I get this error: Traceback (most recent call last): File "c:\AI\gpt-pilot\workspace/gpt-pilot/pilot/main.py", line 8, in from dotenv import load_dotenv ModuleNotFoundError: No module named 'dotenv'

See image

I did try deleting the workspace directory and letting it re-initialize it. This caused an error because the last slash in the path was incorrect, (see image) which made it just loop. I manually created the directories and it did re-initialize the workspace, but didn't fix the above error.

Brian

New app error workspace

@brain1961 - I can tell from you above you are definitely in the wrong path (wrong directory). You have went and created new directories inside of workspace. You shouldn't be inside of workspace at all. See my instructions https://github.com/Pythagora-io/gpt-pilot/issues/387#issuecomment-1868328940

aaronjolson avatar Dec 23 '23 21:12 aaronjolson

@MikeTheBard - what version of windows + python are you using? Did all the dependencies install correctly when you ran pip install -r requirements.txt ?

Windows 10 Pro 64-bit (10.0, Build 19045)

Yes, all installed correctly.

MikeTheBard avatar Dec 23 '23 21:12 MikeTheBard

@aaronjolson - You are correct. I had installed an earlier cli version of this and I didn't think about it when I installed the extension. I removed that folder and did a clean install and it now works great. My apologies for this and thanks for all your work.

brain1961 avatar Dec 24 '23 02:12 brain1961

Following above workarounds and still doesn't work. This project has still a long way to go to be even in Alpha. Thanks.

fahdmirza avatar Dec 24 '23 03:12 fahdmirza

When setting up GPT-Pilot VSCode extension in windows, one of the steps is to create the Python virtual environment (venv). This can fail (for as of yet unknown reason), and this is what the users see: image Temporary workaround:

1. open command line in the `gpt-pilot` sub-directory of the folder which you selected for the installation of GPT Pilot (there should be `requirements.txt` file already there)

2. create the virtual environment with `python -m venv pilot-env`

3. activate the environment with `pilot-env\Scripts\activate`

4. install packages with `pip install -r requirements.txt`

5. go to the `pilot` subdirectory (not `pilot-env`, just `pilot`), then run `python db_init.py` to initialize the database

After doing the above steps, the VSCode extension should start working.

This worked for me

This same workaround by jdavid82 above works for me as well on Windows 10 machine!

JS1920 avatar Dec 27 '23 04:12 JS1920

@Siddharth1988 @FreddyCi @RFARREY I got this working on a fresh version of the extension I downloaded yesterday. You might want to try uninstalling + deleting your current extension (and the entire GPT-Pilot folder) and redownloading / starting over if you have been having issues up to this point. Make sure you have a recent version of Python installed, I am using python 3.10.6 on Windows 11 Make sure you can run the python command from inside your terminal in vscode and the expected version initializes (pretty sure it needs to be greater than version 3.9. I use 3.10.6 because stable diffusion required it) To start, when I opened my terminal in VSCode. It brought me to C:\Users\aaron\PycharmProjects\GPT_Pilot\gpt-pilot\workspace This is correct, but notice the \workspace. If you are there, cd .. up a level into \gpt-pilot In the gpt-pilot dir, confirm there is a requirements.txt file in that directory using dir or ls. Also confirm there is a directory there called \pilot-env If that directory already exists, run ./pilot-env/Scripts/activate if not, run

python -m venv pilot-env
./pilot-env/Scripts/activate

Once the virtual environment is activated, install required packages with pip install -r requirements.txt go to the pilot subdirectory (not pilot-env, just pilot), cd pilot, then run python db_init.p to initialize the database. Once you have done all of this, reopen the gpt-pilot extension using the icon on the left panel in vscode. signin, and select new project. It should initialize correctly now.

There's a slight typo here, missing the last character of the last file extension to run. Should be "db_init.py" (that got me working)

This worked for me with Python 3.12.1

e404nothing avatar Dec 27 '23 05:12 e404nothing

Same problem, Windows 11 I followed all the suggestions above, nothing solved

Hopefully we get some kind soul to help

Thanks

Tokyofloripa avatar Dec 28 '23 04:12 Tokyofloripa

Same problem, Window

Same problem, Windows 11 I followed all the suggestions above, nothing solved

Hopefully we get some kind soul to help

Thanks

Are you on windows 11 with VScode?

e404nothing avatar Dec 28 '23 05:12 e404nothing