-1

I am new with this stuff but I am trying to set up flask app using Render's web service and I have problem with requirements.txt file and deploying keeps failing.

I have created virtual environment with conda and made requirement file using "conda list -e > requirements.txt" command but can't seem to make it work. As build command in server side I tried default option: $ pip install -r requirements.txt which didnt work and $ conda install --file requirements.txt but it didn't recognize conda command. What should I do?

1 Answers1

1

conda export and pip export don't have the same format. If you want to export dependencies in pip format use:

pip freeze > requirements.txt

And then just use pip install -r requirements.txt

If you want to make a new env that will use requirements.txt file exported by conda, use:

conda list -e > requirements.txt

and then:

conda create --name <your-new-env> --file <requirements file>

But if you need to install dependencies in an existing env, use the:

conda install --file <requirements file>

As to why it didn't recognize conda command, please update your question with more info, and I will edit my answer accordingly.

kaumnen
  • 127
  • 2
  • 12
  • When given build command: conda install --file requirements.txt and build command in web service: pip install -r requirements.txt it gave error ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/C:/ci_311/certifi_1676421629969/work/certifi' – Kasinaama Apr 17 '23 at 12:30
  • 1
    Apparently command: pip list --format=freeze > requirements.txt worked! I still don't know why I can't use conda in Render's web service – Kasinaama Apr 17 '23 at 12:41
  • yeah regarding that certify weird thing, just delete the whole line, shouldn't produce an error after that. unfortunately, im not familiar with Render's web service – kaumnen Apr 17 '23 at 13:56
  • Sorry, I didn't quite understand, delete what line? – Kasinaama Apr 18 '23 at 14:36
  • that certifi_... thing – kaumnen Apr 19 '23 at 21:15