Heroku installing wrong python version - python

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

Related

How to solve dependency conflicts in requirements.txt file in Django deployment

I am trying to deploy my Django app on GCP using google appengine.
First I deployed the app after testing on localhost by following this documentation by Google appengine.
deployed the app using gcloud app deploy
But there is some issue and the server is not running showing the error as 502 Bad Gateway
Then I checked the logs and then realized that I forgot to upload the requiremts.txt file.
the uploaded file and tried to deploy the app again.
But got an error as
ERROR: Cannot install -r requirements.txt (line 19), -r requirements.txt (line 21), -r requirements.txt (line 27) and grpcio==1.48.1 because these package versions have conflicting dependencies.
Here is some dependency conflict between modules Gcloud suggested a documentation https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts to solve this but I'm not getting it actually how to solve the conflict of modules in requirements.txt
Here is the requirements.txt file
APScheduler==3.6.3
asgiref==3.5.2
backports.zoneinfo==0.2.1
beautifulsoup4==4.11.1
cachetools==4.2.2
certifi==2022.6.15
charset-normalizer==2.1.1
dill==0.3.5.1
Django==4.0.6
django-environ==0.9.0
django-social-share==2.3.0
environ==1.0
google==3.0.0
google-api-core==2.10.0
google-auth==2.11.0
google-cloud-secret-manager==2.12.4
google-cloud-speech==2.15.1
googleapis-common-protos==1.56.4
grpc-google-iam-v1==0.12.4
grpcio==1.48.1
grpcio-status==1.48.1
idna==3.3
Pillow==9.2.0
proto-plus==1.22.1
protobuf==4.21.5
psycopg2==2.9.3
pulumi==3.39.3
pyasn1==0.4.8
pyasn1-modules==0.2.8
pytz==2022.2.1
pytz-deprecation-shim==0.1.0.post0
PyYAML==6.0
requests==2.28.1
rsa==4.9
semver==2.13.0
six==1.16.0
soupsieve==2.3.2.post1
sqlparse==0.4.2
tornado==6.2
tzdata==2022.1
tzlocal==4.2
urllib3==1.26.12
And an error log
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 7ac526d7-15d5-45f6-afe7-727b4216f79d status: FAILURE
.... This could take a while.
INFO: pip is looking at multiple versions of google-api-core to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of google to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of environ to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of django-social-share to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of django-environ to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of django to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of dill to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of charset-normalizer to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of certifi to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of cachetools to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of beautifulsoup4 to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of backports-zoneinfo to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of <Python from Requires-Python> to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of asgiref to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of apscheduler to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install -r requirements.txt (line 19), -r requirements.txt (line 21), -r requirements.txt (line 27) and grpcio==1.48.1 because these package versions have conflicting dependencies.
The conflict is caused by:
The user requested grpcio==1.48.1
grpc-google-iam-v1 0.12.4 depends on grpcio<2.0.0dev and >=1.0.0
grpcio-status 1.48.1 depends on grpcio>=1.48.1
pulumi 3.39.3 depends on grpcio==1.47
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
Please help me to solve this error
Thanks
I would use something like poetry to manage your dependencies while you work on your app. It will actually help you not to run into conflicts and solve most of them for you automatically.
Then when you are ready to deploy your app you can do:
poetry export -f requirements.txt --output requirements.txt
And poetry will generate a requirements.txt file that you can upload to GCP

Could not find a version that satisfies requirements aptural==0.5.2 in heroku

I trying to deploy heroku my django app and got a error like this I
don’t know why the says that could not find version in apturl version
in requirements.txt but there is apturl in there.And also I’m using a
ubuntu os to deploy to deploy this app.I have found a previous question
like this I tried that also and it didn’t work either.
ERROR: Could not find a version that satisfies the requirement
apturl==0.5.2 (from -r /tmp/build_750f707f/requirements.txt (line 1))
(from versions: none)
And also in my requirements.txt file has apturl==0.5.2 in first line.Please help in advance thanks.

can't find my packages from pycharm/heroku

I have deployed a package into https://pypi.org/project/core-lib/0.0.1.dev1/
But pycharm or heroku can't find my package with this error message
Can you help me, please?
Thank you
Pycharm
No matching package version found: 'core-lib==0.0.1.dev1' (required: ==0.0.1.dev1, installed: <nothing>, latest: <nothing>)
heroku deploy
-----> Installing requirements with pip
ERROR: Could not find a version that satisfies the requirement core-lib==0.0.0.8 (from -r /tmp/build_c6b601b1/requirements.txt (line 1)) (from versions: none)
ERROR: No matching distribution found for core-lib==0.0.0.8 (from -r /tmp/build_c6b601b1/requirements.txt (line 1))
! Push rejected, failed to compile Python app.
! Push failed
Installed your package from pypi using PyCharm, and I am able to find it
(randomtesting) C:\Users\User\PycharmProjects\randomtesting>pip list
Package Version
---------------------- -------------------
core-lib 0.0.1.dev1
Perhaps the file was released into pypi very recently?
And I checked the link again, now it has the latest version.
Maybe try this?
pip install core-lib
You've declared that your package must be used under Python >= 3.7. Please make sure you use Python with high enough version. For example, I tried to install the package with Python 2.7 and pip failed to find the project. With Python 3.7 it was installed successfully.

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?

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

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.

Categories

Resources