0

Most of you may know OpenAI playground, so I built an function generator app and followed all the instructions but I can't launch it via venv-python. I can actually install the requirements using pip while venv is not active and can launch the site with flask, but when I try to install requirements after activating venv, I get this error;

User@lalec  ~
$ cd openai-quickstart-python

User@lalec  ~/openai-quickstart-python (master)
$ . venv/Scripts/activate

(venv)
User@lalec  ~/openai-quickstart-python (master)
$ pip install -r requirements.txt
Fatal error in launcher: Unable to create process using '"C:\Users\celal\openai-quickstart-python\venv\Scripts\python.exe"  "C:\Users\User\openai-quickstart-python\venv\Scripts\pip.exe" install -r requirements.txt': The system cannot find the file specified.

How do I fix this? I added every possible script locations into PATH I thought it would help but no result.

I just realized two directories in the error doesn't match, and "C:\Users\celal\openai-quickstart-python\venv\Scripts\python.exe" actually does not even exist. Maybe that's the problem... How can I change this ??

Sorry if I'm asking dumb questions I'm new to all this... Also, I don't get why I need venv activated while I can just launch it by accessing the directory and type flask run in cmd, would appreciate any answers.

ss of the project's directory

ss of venv/Scripts/

ss of bash screen with errors

celo
  • 41
  • 4

2 Answers2

2

Check your activate script - look at VIRTUAL_ENV variable. In my case, I was in the wrong path when I created my venv and the VIRTUAL_ENV variable was wrong.

0

The error message suggests that the requirements.txt file can't be read. Check that you definitely can read it and it's in the expected location.

The perferred command for running pip is:

python3 -m pip install -r requirements.txt

This makes sure that you know which python3 binary you're running pip with - some systems have more than one python3 binary in various locations.

You could achieve similar without activating the virtual environment:

./venv/bin/python3 -m pip install -r requirements.txt
moo
  • 1,597
  • 1
  • 14
  • 29
  • yes, the requirements.txt can be readable, I can open it. I tried using the first command you suggested after activating venv and came up with another error that say: $ python3 -m pip install -r requirements.txt Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases. But I'm pretty sure I have python installed. For the second command; I can already launch the site without activating virtual environment but I thought venv is some how necessary for security purpose or idk really that's why I askd – celo Feb 24 '22 at 20:25
  • Have you definitely installed pip and created the virtual environment? You don't need to have a virtual environment if you're only using python for one or two things. More info is available here: https://docs.python-guide.org/dev/virtualenvs/ – moo Feb 25 '22 at 06:40
  • Firstly, thank you for your answers. I have python and pip installed, I've been using both for long, the actual problem is starting when venv activated. I've applied the instructions in the OpenAI docs multiple times to make sure everything is fine. After activating venv, venv can be succesfully activated but can't use any scripts after that. I checked the site you referred and applied the installation tests, both seems fine when venv is deactivated. Been searching up the internet for too long but I can't find no similar problem... – celo Feb 25 '22 at 17:50
  • this is what I'm trying to explain https://i.stack.imgur.com/k83IC.png maybe 1 activation is enough then you don't need to activate it? – celo Feb 25 '22 at 17:56
  • 1
    Try using the commands `which python3` and `which pip3` to see where the Python binary it's trying to execute. It looks like you might be experiencing a similar problem to this: https://stackoverflow.com/questions/39202912/how-to-activate-virtualenv-in-cygwin-after-copying-the-virtualenv-folder – moo Feb 26 '22 at 07:50