0

I'm trying to host my discord chatbot on Heroku, so I created a requirements.txt file and pushed it to github. I've connected my github account with Heroku, but I can't deploy the main branch correctly.

This is the content of requirements.txt.

aiohttp==3.7.4.post0
async-generator==1.10
async-timeout==3.0.1
attrs==22.1.0
beautifulsoup4==4.11.1
certifi==2022.6.15
cffi==1.15.1
chardet==4.0.0
charset-normalizer==2.1.0
cryptography==37.0.4
discord.py==1.7.3
h11==0.13.0
html5lib==1.1
idna==3.3
lxml==4.9.1
multidict==6.0.2
numpy==1.23.1
outcome==1.2.0
pandas==1.4.3
pycparser==2.21
pyOpenSSL==22.0.0
PySocks==1.7.1
python-dateutil==2.8.2
python-dotenv==0.20.0
pytz==2022.1
pywin32==304
requests==2.28.1
selenium==4.3.0
six==1.16.0
sniffio==1.2.0
sortedcontainers==2.4.0
soupsieve==2.3.2.post1
trio==0.21.0
trio-websocket==0.9.2
typing_extensions==4.3.0
urllib3==1.26.11
webencodings==0.5.1
wsproto==1.1.0
yarl==1.8.1

I googled and found that I should use pypiwin32==304 instead of pywin32==304.

So I changed it and start deploying, but another error occured.

       ERROR: Could not find a version that satisfies the requirement pypiwin32==304 (from versions: 219, 223)
       ERROR: No matching distribution found for pypiwin32==304
 !     Push rejected, failed to compile Python app.
 !     Push failed

So I changed the version to 223, then it says :

       ERROR: Could not find a version that satisfies the requirement pywin32>=223 (from pypiwin32) (from versions: none)
       ERROR: No matching distribution found for pywin32>=223
 !     Push rejected, failed to compile Python app.
 !     Push failed

Then I tried version 219, it says :

       Collecting pypiwin32==219
         Downloading pypiwin32-219.zip (4.8 MB)
         Preparing metadata (setup.py): started
         Preparing metadata (setup.py): finished with status 'error'
         error: subprocess-exited-with-error
         
         × python setup.py egg_info did not run successfully.
         │ exit code: 1
         ╰─> [7 lines of output]
             Traceback (most recent call last):
               File "<string>", line 2, in <module>
               File "<pip-setuptools-caller>", line 34, in <module>
               File "/tmp/pip-install-fvi5_cyx/pypiwin32_8ebb01f7f7fb4adfaea52be9c21493c7/setup.py", line 121
                 print "Building pywin32", pywin32_version
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
             [end of output]
         
         note: This error originates from a subprocess, and is likely not a problem with pip.
       error: metadata-generation-failed
       
       × Encountered error while generating package metadata.
       ╰─> See above for output.
       
       note: This is an issue with the package mentioned above, not pip.
       hint: See above for details.
 !     Push rejected, failed to compile Python app.
 !     Push failed

What happened here? I'm completely new to programming, what should I do to fix this error?

torek
  • 448,244
  • 59
  • 642
  • 775

1 Answers1

-2

I believe you will find your solution in reverting to a previous version of python in heroku.

It looks as though there is a conflict within the requirements. Reverting to an older version of python will be my best guess.

I had similar problems using chatbot, PyTorch, and other dependencies and experienced this issue after pip began checking for compatibility issues more thoroughly.

I used python 3.7 and my compatibility issues resolved.

  • Python 2.7 reached end of life two and a half years ago. Unless you're stuck maintaining an ancient, existing code base, there is no valid reason to use Python 2.7 in 2022. – ChrisGPT was on strike Sep 27 '22 at 15:42
  • Chris, you are correct, I believe I was using an unmaintained and older code base as you stated. However, I suspect a similar thing happening with one of the dependency’s in the ops original problem. Python 2.7 solved my personal problem. Specifying an earlier version in the runtime.txt for heroku might still be the solution. – John Sullivan Sep 27 '22 at 16:48
  • Except [Heroku doesn't support Python 2.7 anymore](https://devcenter.heroku.com/articles/python-support#supported-runtimes), either. You _might_ be able to use it but it isn't documented and they say, "Python 2 has reached its community-specified end of life and any apps still using it should be migrated to Python 3 as soon as possible." – ChrisGPT was on strike Sep 27 '22 at 17:00
  • The core issue here is that OP is trying to use a Windows-specific library on Heroku, which doesn't run Windows. Yes, it might also be for Python 2, but even with Python 2 that module won't install properly. – ChrisGPT was on strike Sep 27 '22 at 17:01
  • All this time I meant 3.7, my understanding is that an earlier version of python will solve the pip related dependency issue. – John Sullivan Sep 27 '22 at 17:22
  • Are you sure you mean 3.7? Because the `print "foo"` syntax, without parentheses, used in the error message above is from Python 2. – ChrisGPT was on strike Sep 27 '22 at 18:00