Flask application not deploying to Heroku (Problem with "ikp3db"?) - python

I was trying to deploy my app to Heroku the other day and I came across this error:
Collecting ikp3db==1.4
Could not find a version that satisfies the requirement ikp3db==1.4
What does ikp3db==1.4 mean? I tried removing it from my requirements.txt file and successfully pushed, although the default page ended up loading very slowly.
How do I fix this so that I can properly deploy my application?
For context, I am trying to push a Flask Application with Socket.io in it.
Here is the relevant part of the deploy log:
remote: -----> Python app detected
remote: -----> Installing requirements with pip
remote: Collecting ikp3db==1.4 (from -r /tmp/build_6a70450c1a3e03480c6a367846a7a630/requirements.txt (line 37))
remote: Could not find a version that satisfies the requirement ikp3db==1.4 (from -r /tmp/build_6a70450c1a3e03480c6a367846a7a630/requirements.txt (line 37)) (from versions: 1.0, 1.1, 1.1.2, 1.1.3, 1.1.4)
remote: No matching distribution found for ikp3db==1.4 (from -r /tmp/build_6a70450c1a3e03480c6a367846a7a630/requirements.txt (line 37))
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed

From its PyPI page:
IKP3db is a Python 3 debugger.
Generally speaking, debuggers shouldn't be deployed to production servers. They represent a significant security risk.
I tried removing it from my requirements.txt file and successfully pushed, although the default page ended up loading very slowly.
Removing a debugger wouldn't cause your application to be slow. There's something else going on. Start by looking at your browser's devtools to see if you can determine which part of the application is slow. Depending on what information you log, the heroku logs command may also be helpful here.

Related

Heroku installing wrong python version

My application(discord bot - discord.py-v2) works fine locally.
I have given python-3.10.4 in the runtime.txt file.
When I try to push the changes to Heroku, it says Installing python-3.6.13. There are errors during the execution of the requirements.txt file.
Another app with the same requirements.txt file and python3.10 works fine on SparkedHost.
requirements.txt
aiohttp>=3.7.4,<4
aiosignal==1.2.0
async-timeout
attrs==21.4.0
autopep8==1.6.0
discord-ext-bot==1.0.1
discord-py-interactions==4.2.1
discord-py-slash-command==4.2.1
discord.py # git+https://github.com/Rapptz/discord.py#1ba290d8c6884daa8a8548ab203fb12bd736576d
import-expression==1.1.4
msgpack==1.0.3
multidict==6.0.2
python-dotenv==0.20.0
python-lsp-jsonrpc==1.0.0
python-lsp-server==1.4.1
pytz==2022.2.1
requests==2.27.1
Errors:
remote: ERROR: Could not find a version that satisfies the requirement discord-ext-bot==1.0.1 (from versions: none)
remote: ERROR: No matching distribution found for discord-ext-bot==1.0.1
If I remove discord-ext-bot==1.0.1, discord-py-interactions==4.2.1, and discord-py-slash-command from the file, it says error in discord.py version
You need a runtime.txt and specify the python version there.
Edit: Heroku only supports certain python versions:
python-3.10.6 on all supported stacks (recommended)
python-3.9.13 on all supported stacks
python-3.8.13 on Heroku-18 and Heroku-20 only
python-3.7.13 on Heroku-18 and Heroku-20 only
Try using python-3.10.6
See here

Failed to build python app in Heroku; can't find newscatcher

In trying to push to heroku I am getting a "build failed" error.
In checking the logs I see it's because of the following:
ERROR: Could not find a version that satisfies the requirement newscatcher==0.1.0 (from -r /tmp/build_3ad91c7bdb0b7ae3e65e7d3b8ae455f7/requirements.txt (line 13)) (from versions: none)
ERROR: No matching distribution found for newscatcher==0.1.0 (from -r /tmp/build_3ad91c7bdb0b7ae3e65e7d3b8ae455f7/requirements.txt (line 13))
! Push rejected, failed to compile Python app.
! Push failed
It looks like there's an incorrect version of the "newscatcher" library I am trying to use. However, this is the correct version according to PyPi.
In addition I have already performed a pip3 freeze > requirements.txt in order to collect all dependencies I know to be relevant. How come the correct version of a git supported pip package is throwing this error? How do I fix this?

Why can't Heroku find a version of 'os' that satisfies the requirement?

I am trying to deploy my bot on Heroku through GitHub.
In requirements.txt, I have 'os'. I tried to deploy the bot so Heroku would recognise the Procfile. It gave me this error.
Collecting os (from -r /tmp/build_e656b8b6627c307b02ef77c47e6bb725/requirements.txt (line 3))
Could not find a version that satisfies the requirement os (from -r /tmp/build_e656b8b6627c307b02ef77c47e6bb725/requirements.txt (line 3)) (from versions: )
No matching distribution found for os (from -r /tmp/build_e656b8b6627c307b02ef77c47e6bb725/requirements.txt (line 3))
! Push rejected, failed to compile Python app.
! Push failed
How to fix it?
You don't need to include os in your requirements.txt - it's a built-in module. Just remove it.
You don't need to install/require os. It isn't on the package index, it's a built-in package.
Simply remove the os line from your requirements.txt file to fix this issue.

Gemfury build fails with SyntaxError

I followed the initial setup at the Gemfurey Dev docs and when trying to push to the fury master branch, the build is triggered and fails with SyntaxError
remote: Resolving deltas: 100% (86/86)
remote: Initializing build: done.
remote: -----> Building package...
remote: Python package build detected
remote: File "setup.py", line 17
remote: README: str = Path(HERE, "README.rst").read_text(encoding='utf-8')
remote: ^
remote: SyntaxError: invalid syntax
remote: -----> Problem building package!
I assume that the problem here is an incorrect version of python being run to build the package. I tried to check whether it is possible to configure the build to use the correct python version -- in this case 3.6 -- but there is no hint of such possibility.
Anything I can do to make these automatic builds work or is my only option to build the package locally and upload it to the fury index?
Thanks!
Unfortunately, ​Gemfury's current "git push" builder only supports Python 2 and there's no way to configure the runtime. If you're limited by this, I suggest building it locally or using another CI/CD solution to build and push it into your Gemfury account.

heroku can't find pip when I push app to it

When I try to push my django app to heroku it fails right at the beginning:
remote: -----> Python app detected
remote: -----> Installing python-3.5.1
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote: /app/tmp/buildpacks/779a8bbfbbe7e1b715476c0b23fc63a2103b3e4131eda558669aba8fb5e6e05682419376144189b29beb5dee6d7626b4d3385edb0954bffea6c67d8cf622fd51/
bin/steps/pip-install: line 5: /app/.heroku/python/bin/pip:
No such file or directory
remote: ! Push rejected, failed to compile Python app.
remote:
I apparently do something wrong, but I did the same thing many times before. What's wrong?
I had this exact same problem yesterday and it was really frustrating as I had deployed to Django before under the exact same settings with no problem.
In your runtime.txt file change it from:
python-3.5.1
to
python-3.6.1
Why changing the Python version on Heroku matters beats me but it worked like a charm.

Categories

Resources