0

I'm attempting to put deploy my discord bot on heroku, but I keep running into this error when I try to do my first commit. My theory is theres something missing in the requirements.txt file but I'm not sure cause I can't tell what the error is telling me. I'm a bit unsure on how to fill in the requirements.txt file, but I typed in the names of each library I am using in the full program such as selenium, discord.py, and dotenv.

    C:\Users\luked\PycharmProjects\invasionbot>git commit -am "first commit"
    On branch master
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
            .idea/

    nothing added to commit but untracked files present (use "git add" to track)

    C:\Users\luked\PycharmProjects\invasionbot>git add .
    warning: LF will be replaced by CRLF in .idea/workspace.xml.
    The file will have its original line endings in your working directory

    C:\Users\luked\PycharmProjects\invasionbot>git push heroku master
    Enumerating objects: 14, done.
    Counting objects: 100% (14/14), done.
    Delta compression using up to 12 threads
    Compressing objects: 100% (12/12), done.
    Writing objects: 100% (14/14), 4.20 MiB | 1.03 MiB/s, done.
    Total 14 (delta 2), reused 0 (delta 0), pack-reused 0
    remote: Compressing source files... done.
    remote: Building source:
    remote:
    remote: -----> Python app detected
    remote: -----> Installing python-3.6.10
    remote: -----> Installing pip
    remote: -----> Installing SQLite3
    remote: -----> Installing requirements with pip
    remote:        Collecting selenium
    remote:          Downloading selenium-3.141.0-py2.py3-none-any.whl (904 kB)
    remote:        Collecting discord
    remote:          Downloading discord-1.0.1-py3-none-any.whl (1.1 kB)
    remote:        Collecting dotenv
    remote:          Downloading dotenv-0.0.5.tar.gz (2.4 kB)
    remote:            ERROR: Command errored out with exit status 1:
    remote:             command: /app/.heroku/python/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-s0g44jdw/dotenv/setup.py'"'"'; __file__='"'"'/tmp/pip-install-s0g44jdw/dotenv/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-s0g44jdw/dotenv/pip-egg-info
    remote:                 cwd: /tmp/pip-install-s0g44jdw/dotenv/
    remote:            Complete output (68 lines):
    remote:            Traceback (most recent call last):
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
    remote:                yield saved
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/sandbox.py", line 194, in setup_context
    remote:                __import__('setuptools')
    remote:              File "/tmp/easy_install-sj4nzrau/distribute-0.7.3/setuptools/__init__.py", line 2, in <module>
    remote:              File "/tmp/easy_install-sj4nzrau/distribute-0.7.3/setuptools/extension.py", line 5, in <module>
    remote:              File "/tmp/easy_install-sj4nzrau/distribute-0.7.3/setuptools/dist.py", line 7, in <module>
    remote:              File "/tmp/easy_install-sj4nzrau/distribute-0.7.3/setuptools/command/__init__.py", line 8, in <module>
    remote:              File "/tmp/easy_install-sj4nzrau/distribute-0.7.3/setuptools/command/install_scripts.py", line 3, in <module>
    remote:              File "/tmp/easy_install-sj4nzrau/distribute-0.7.3/pkg_resources.py", line 1518, in <module>
    remote:            AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
    remote:
    remote:            During handling of the above exception, another exception occurred:
    remote:
    remote:            Traceback (most recent call last):
    remote:              File "<string>", line 1, in <module>
    remote:              File "/tmp/pip-install-s0g44jdw/dotenv/setup.py", line 23, in <module>
    remote:                scripts=['scripts/dotenv']
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/__init__.py", line 128, in setup
    remote:                _install_setup_requires(attrs)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/__init__.py", line 123, in _install_setup_requires
    remote:                dist.fetch_build_eggs(dist.setup_requires)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/dist.py", line 513, in fetch_build_eggs
    remote:                replace_conflicting=True,
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/pkg_resources/__init__.py", line 774, in resolve
    remote:                replace_conflicting=replace_conflicting
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1057, in best_match
    remote:                return self.obtain(req, installer)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1069, in obtain
    remote:                return installer(requirement)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/dist.py", line 580, in fetch_build_egg
    remote:                return cmd.easy_install(req)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 673, in easy_install
    remote:                return self.install_item(spec, dist.location, tmpdir, deps)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 699, in install_item
    remote:                dists = self.install_eggs(spec, download, tmpdir)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 884, in install_eggs
    remote:                return self.build_and_install(setup_script, setup_base)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1152, in build_and_install
    remote:                self.run_setup(setup_script, setup_base, args)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1138, in run_setup
    remote:                run_setup(setup_script, args)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/sandbox.py", line 233, in run_setup
    remote:                with setup_context(setup_dir):
    remote:              File "/app/.heroku/python/lib/python3.6/contextlib.py", line 81, in __enter__
    remote:                return next(self.gen)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
    remote:                yield
    remote:              File "/app/.heroku/python/lib/python3.6/contextlib.py", line 99, in __exit__
    remote:                self.gen.throw(type, value, traceback)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/sandbox.py", line 166, in save_modules
    remote:                saved_exc.resume()
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/sandbox.py", line 141, in resume
    remote:                six.reraise(type, exc, self._tb)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/_vendor/six.py", line 685, in reraise
    remote:                raise value.with_traceback(tb)
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
    remote:                yield saved
    remote:              File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/sandbox.py", line 194, in setup_context
    remote:                __import__('setuptools')
    remote:              File "/tmp/easy_install-sj4nzrau/distribute-0.7.3/setuptools/__init__.py", line 2, in <module>
    remote:              File "/tmp/easy_install-sj4nzrau/distribute-0.7.3/setuptools/extension.py", line 5, in <module>
    remote:              File "/tmp/easy_install-sj4nzrau/distribute-0.7.3/setuptools/dist.py", line 7, in <module>
    remote:              File "/tmp/easy_install-sj4nzrau/distribute-0.7.3/setuptools/command/__init__.py", line 8, in <module>
    remote:              File "/tmp/easy_install-sj4nzrau/distribute-0.7.3/setuptools/command/install_scripts.py", line 3, in <module>
    remote:              File "/tmp/easy_install-sj4nzrau/distribute-0.7.3/pkg_resources.py", line 1518, in <module>
    remote:            AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
    remote:            ----------------------------------------
    remote:        ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    remote:  !     Push rejected, failed to compile Python app.
    remote:
    remote:  !     Push failed
    remote: Verifying deploy...
    remote:
    remote: !       Push rejected to tooncogbot.
    remote:
    To https://git.heroku.com/tooncogbot.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'https://git.heroku.com/tooncogbot.git

'

Zlorpo123
  • 47
  • 1
  • 6
  • Have you looked [here](https://stackoverflow.com/questions/22998190/push-rejected-failed-to-compile-python-app) to see if it fixes your issue? – Diggy. May 27 '20 at 18:18
  • 1
    Solved by grabbing the full version of each module. – Zlorpo123 May 27 '20 at 18:28
  • Alright, glad to hear it! Hope the hosting works out well for you :^) – Diggy. May 27 '20 at 18:28
  • 1
    Thank you! Only problem is that sadly, I don't think my bot will function how I want since I need to run chromedriver and I don't think thats possible on the linux server. :( – Zlorpo123 May 27 '20 at 18:33
  • If you're looking for something else, I'd recommend looking into [AWS EC2](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc) micro instances - you can get a 1 year free trial, and it's the one I'm currently using. Additionally, you can get an RDP to it, which can make it much more convenient than a CLI – Diggy. May 27 '20 at 18:37
  • 1
    Thanks for the suggestion. The thing is, my bot opens chrome and scrapes data once a certain function is called. I'm now realizing that it's probably not possible for chrome to be opened on the linux server and have info scraped from a website on there since it's not being opened in the first place. – Zlorpo123 May 27 '20 at 18:40
  • EC2 is on Windows :^) – Diggy. May 27 '20 at 18:41
  • 1
    Oh? Then I'll look into that! What about google cloud though? – Zlorpo123 May 27 '20 at 18:43
  • Can't say I've used it personally, so I wouldn't be able to say, but if you wanna give it a go, then feel free to - their free tier does look pretty tempting! – Diggy. May 27 '20 at 18:45

0 Answers0