There is a problem with the code, I can not find a solution - python

There is a problem with the code, I can not find a solution
C:\Users\sphe\justeat>git push heroku master
Enumerating objects: 61, done.
Counting objects: 100% (61/61), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (54/54), done.
Writing objects: 100% (61/61), 1015.17 KiB | 647.00 KIS/s, done.
Total 61 (delta 4), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: -----> Python app detected
remote:Requested runtime (python-3.5.2) is not available for this stack (heroku-18)
remote: More info: https://devcenter.heroku.co...
remote: ! Push failed
remote: Verifying deploy...
remote: ! Push rejected to enigmatic-spire-63168.
To https://git.heroku.com/enigm...
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/enigm...

Your Problem
remote:Requested runtime (python-3.5.2) is not available for this stack (heroku-18)
Solution:
by the official website of heroku, your python version (3.5.2) isn't compatible with heroku version 18.
From Developer Webpage:
Specifying a Python version
By default, newly created Python apps use the python-3.6.8 runtime. You can also specify a different supported Python version.
Supported runtimes
python-3.7.3 on all (heroku-16, and heroku-18) runtime stacks
python-3.6.8 on all (heroku-16, and heroku-18) runtime stacks
python-2.7.16 on all (heroku-16, and heroku-18) runtime stacks

Related

Build on Heroku , Git issue with Push Failed, error in message :)

me again...can I please have some help, going a little bonkers here..
I have a simple Python script that I would like to connect to a scheduler task in Heroku...Its all going fine until I try deploy to Heroku. Its super simple script and its doing my mind in trying to work out why I cant deploy it.
Followed the instructions exactly from here..
https://dashboard.heroku.com/apps/*********/deploy/heroku-git
Getting this error:
(base) simon#Simons-Air ********** % git push heroku master
Enumerating objects: 47, done.
Counting objects: 100% (47/47), done.
Delta compression using up to 8 threads
Compressing objects: 100% (47/47), done.
Writing objects: 100% (47/47), 4.11 MiB | 581.00 KiB/s, done.
Total 47 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: ! No default language could be detected for this app.
remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to **********.
remote:
To https://git.heroku.com/**********.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/**********.git'
Ive been into Heroku web interface and selected buildpack of Python (hoping that might be it), but still no luck.
Im on a Mac, using Visual Studio Code, with embedded terminal.
Any thoughts people?
Would be so grateful for any help.
Thanks again
Simon

problem pushing changes to GitHub because of file that's not really there

I have been trying to push changes to my GitHub repo but been facing this problem:
Uploading LFS objects: 100% (164/164), 153 MB | 0 B/s, done.
Enumerating objects: 25977, done.
Counting objects: 100% (25968/25968), done.
Delta compression using up to 4 threads
Compressing objects: 100% (18133/18133), done.
Writing objects: 100% (25955/25955), 146.83 MiB | 232.00 KiB/s, done.
Total 25955 (delta 6561), reused 25816 (delta 6463)
remote: Resolving deltas: 100% (6561/6561), completed with 4 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 9f797e9b5f7a1c01fca6706ad62e21ba
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File venv/lib/python3.6/site-packages/tensorflow_core/python/_pywrap_tensorflow_internal.so is 225.31 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/yovelcohen/nba-stats.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/yovelcohen/nba-stats.git'
(base) yovel#the-beastpad:~$ cd venv/lib/python3.6/site-packages/tensorflow_core/python/
bash: cd: venv/lib/python3.6/site-packages/tensorflow_core/python/_pywrap_tensorflow_internal.so: No such file or directory
I imported TensorFlow to the project but then removed it, when trying to delete it from the terminal it's not there (and when looking for it manually).
any help would be appreactied!
Since you should not push any generated binary file anyway, start first by removing them locally, commit and push:
git rm -r '*.so' -f
echo '*.so' >> .gitignore
But if that still fails, it means you are trying to push past commits (not just the latest one) with *.so files, even though the last commit no longer includes any such files.
If that is the case, since git filter-branch is soon deprecated, consider newren/git-filter-repo to remove any large files like those *.so ones, before pushing (or force pushing of that rewrites the content of past commits previously pushed).

I have a problem with pushing my bot files to heroku

I want to push my bot to heroku (used TechWithTim's tut) and don't know why it don't works...
i'm a begginer but i tried searching if everything is alright, idk what's the problem...
C:\Users\PC\Desktop\IGOR\PYTHON\BOTY>git push heroku master
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 4 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 2.86 KiB | 1.43 MiB/s, done.
Total 8 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to pomibot.
remote:
To https://git.heroku.com/pomibot.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/pomibot.git'
There's the error message in cmd.

git production , development environment

I have a project of python files on a network drive called "Development".
I create branches off Development for new features and then merge back into Development once finished. Others in future will also do this.
I want to push "Development" into another separate folder called "Production" and for the life of me cannot figure out how to do this.
Please any suggests? How to do this?
Thanks.
I get this error when attempting.
Pushing to G:\03 GIS RESOURCES\05 GIS PROGRAMMING\Production
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To G:\03 GIS RESOURCES\05 GIS PROGRAMMING\Production
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'G:\03 GIS RESOURCES\05 GIS PROGRAMMING\Production'
Option A
You can clone your Development project into another folder.
Synopsis:
git clone <repository> <directory>
Example:
git clone <path/to/Development> Production
Option B
Copy the content of folder Development (including .git folder) to folder Production.

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte when deploying to Heroku

I'm trying to follow this tutorial: http://tutorial.djangogirls.org/en/index.html
I'm up to this part: http://tutorial.djangogirls.org/en/deploy/README.html
Where I am to push it up to heroku via git. I'm familiar with git just not heroku and while I know python I'm a django beginner.
When I do the command git push heroku master i get this output which prevents the app from being deployed.
Here is the error I am receiving:
(myvenv) $> git push heroku master
Counting objects: 19, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (19/19), 3.81 KiB | 0 bytes/s, done.
Total 19 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing runtime (python-3.4.1)
remote: -----> Installing dependencies with pip
remote: Exception:
remote: Traceback (most recent call last):
remote: File "/app/.heroku/python/lib/python3.4/site-packages/pip- 6.0.6-py3.4.egg/pip/basecommand.py", lin
, in main
remote: status = self.run(options, args)
remote: File "/app/.heroku/python/lib/python3.4/site-packages/pip- 6.0.6-py3.4.egg/pip/commands/install.py"
e 321, in run
remote: finder=finder, options=options, session=session):
remote: File "/app/.heroku/python/lib/python3.4/site-packages/pip-6.0.6-py3.4.egg/pip/req/req_file.py", li
, in parse_requirements
remote: session=session,
remote: File "/app/.heroku/python/lib/python3.4/site-packages/pip- 6.0.6-py3.4.egg/pip/download.py", line 4
n get_file_content
remote: content = f.read()
remote: File "/app/.heroku/python/lib/python3.4/codecs.py", line 313, in decode
remote: (result, consumed) = self._buffer_decode(data, self.errors, final)
remote: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
remote:
remote:
remote: ! Push rejected, failed to compile Python app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to chsdjangoblog.
remote:
To https://git.heroku.com/chsdjangoblog.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/chsdjangoblog.git'
does anyone have any idea why this is occurring? heroku seems nice to use, is there a better alternative/what are the best use cases for heroku? I really just want to solve this issue so I can continue the tutorial. Learning django has been a goal of mine for a while as I'm sick of Word Press and PHP development and have been a long time Python lover.
After that error when I try the next step: heroku ps:scale web=1 i get this output:
Scaling dynos... failed
! App mus tbe deployed before dynos can be scaled.
Thanks in advance.
EDIT:
Here's my requirements.txt:
Django==1.8
dj-database-url==0.3.0
gunicorn==19.3.0
heroku==0.1.4
python-dateutil==1.5
requests==2.6.0
whitenoise==1.0.6
psycopg2==2.5.4`
I have tried saving as UTF-8, ANSI, UTF-16. Same message for all of them. I even rewrote it without copy paste. Why is my first byte always 0xff regardless of encoding? What is heroku expecting and is there a way/tool to check the bytes in a txt file?
On the shoulders of the other contributors to this question, it looks like your requirements.txt file is encoded as UTF-16 little endian.
0xFF is the first character of the Byte Order Mark for UTF-16-LE, the second character being 0xFE. The traceback states that the first character is 0xFF in position 0, and it is common in Windows for files to be stored as UTF-16 with the BOM.
Try saving the requirements.txt file as UTF-8 without BOM, or as ASCII. Simple old notepad.exe might do the trick.
Edit
Not working in notepad, so use Python 3 instead:
with open('requirements.txt', encoding='utf-16') as old, open('requirements_new.txt', 'w', encoding='utf-8') as new:
new.write(old.read())
requirements_new.txt will now be encoded as UTF-8 and should work (it will probably end up as ASCII anyway).
Note that this is based on the comments and answers of others which have suggested that the troublesome file is requirements.txt.
See this answer: Deploying Django/Python 3.4 to Heroku
pip is crashing because your requirements.txt file is encoded wrong. Save it in UTF-8 ANSI encoding.
I fixed it, the problem seemed to occur only when requirements.txt was generated on windows no matter what encoding I picked. I generated the file in ascii on Linux and it worked. I then transferred the file to windows and it worked there as well. Therefore the problem must be the requirements.txt encoding as was mentioned in comments. However, the correct encoding appears to be ASCII.

Categories

Resources