Installing pandas on Heroku crashes - python

An python script I am deploying to Heroku is crashing every time it tries to build the deployment because of pandas dependencies. I have tried changing python runtime versions, leaving the version off of the requirements.txt and it still doesn't work. How do we get pandas installed?
Here is the log:
-----> Building on the Heroku-22 stack
-----> Using buildpack: heroku/python
-----> Python app detected
-----> Using Python version specified in runtime.txt
!
! A Python security update is available! Upgrade as soon as possible to: python-3.9.16
! See: https://devcenter.heroku.com/articles/python-runtimes
!
-----> Python version has changed from python-3.10.9 to python-3.9.13, clearing cache
-----> Requirements file has been changed, clearing cached dependencies
-----> Installing python-3.9.13
-----> Installing pip 22.3.1, setuptools 63.4.3 and wheel 0.37.1
-----> Installing SQLite3
-----> Installing requirements with pip
Collecting discord
Downloading discord-2.1.0-py3-none-any.whl (1.1 kB)
Collecting discord.py
Downloading discord.py-2.1.0-py3-none-any.whl (1.1 MB)
Collecting pandas
Downloading pandas-1.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.2 MB)
Collecting py-tda-api
Downloading py_tda_api-0.1.2-py3-none-any.whl (46 kB)
Collecting bdateutil
Downloading bdateutil-0.1.tar.gz (24 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting python-dotenv
Downloading python_dotenv-0.21.1-py3-none-any.whl (19 kB)
Collecting pytz
Downloading pytz-2022.7.1-py2.py3-none-any.whl (499 kB)
Collecting requests
Downloading requests-2.28.2-py3-none-any.whl (62 kB)
Collecting tda-api
Downloading tda_api-1.6.0-py2.py3-none-any.whl (95 kB)
Collecting aiohttp<4,>=3.7.4
Downloading aiohttp-3.8.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB)
Collecting python-dateutil>=2.8.1
Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting numpy>=1.20.3
Downloading numpy-1.24.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)
Collecting websockets>=9.1
Downloading websockets-10.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (106 kB)
Collecting dataclasses>=0.6
Downloading dataclasses-0.6-py3-none-any.whl (14 kB)
INFO: pip is looking at multiple versions of py-tda-api to determine which version is compatible with other requirements. This could take a while.
Collecting py-tda-api
Downloading py_tda_api-0.1.1-py3-none-any.whl (56 kB)
INFO: pip is looking at multiple versions of pandas to determine which version is compatible with other requirements. This could take a while.
Collecting pandas
Downloading pandas-1.5.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.2 MB)
Downloading pandas-1.5.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.2 MB)
Downloading pandas-1.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.2 MB)
Downloading pandas-1.4.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
Downloading pandas-1.4.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
Downloading pandas-1.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
Downloading pandas-1.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
INFO: pip is looking at multiple versions of pandas to determine which version is compatible with other requirements. This could take a while.
Downloading pandas-1.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
Downloading pandas-1.3.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
Downloading pandas-1.3.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
Downloading pandas-1.3.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
Downloading pandas-1.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
Downloading pandas-1.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.7 MB)
Downloading pandas-1.3.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (10.6 MB)
Downloading pandas-1.2.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (9.7 MB)
Downloading pandas-1.2.4-cp39-cp39-manylinux1_x86_64.whl (9.7 MB)
Downloading pandas-1.2.3-cp39-cp39-manylinux1_x86_64.whl (9.7 MB)
Downloading pandas-1.2.2-cp39-cp39-manylinux1_x86_64.whl (9.7 MB)
Downloading pandas-1.2.1-cp39-cp39-manylinux1_x86_64.whl (9.7 MB)
Downloading pandas-1.2.0-cp39-cp39-manylinux1_x86_64.whl (9.7 MB)
Downloading pandas-1.1.5-cp39-cp39-manylinux1_x86_64.whl (9.3 MB)
Downloading pandas-1.1.4-cp39-cp39-manylinux1_x86_64.whl (9.3 MB)
Downloading pandas-1.1.3-cp39-cp39-manylinux1_x86_64.whl (9.3 MB)
Downloading pandas-1.1.2.tar.gz (5.2 MB)
Installing build dependencies: started
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Downloading pandas-1.1.1.tar.gz (5.2 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Downloading pandas-1.1.0.tar.gz (5.2 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Downloading pandas-1.0.5.tar.gz (5.0 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
...
on-39/numpy/random/mtrand/mtrand.o.d" failed with exit status 1
remote: [end of output]
remote:
remote: note: This error originates from a subprocess, and is likely not a problem with pip.
remote: error: legacy-install-failure
remote:
remote: × Encountered error while trying to install package.
remote: ╰─> numpy
remote:
remote: note: This is an issue with the package mentioned above, not pip.
remote: hint: See above for output from the failure.
remote:
remote: [notice] A new release of pip available: 22.3.1 -> 23.0
remote: [notice] To update, run: pip install --upgrade pip
remote: [end of output]
remote:
remote: note: This error originates from a subprocess, and is likely not a problem with pip.
remote: error: subprocess-exited-with-error
remote:
remote: × pip subprocess to install build dependencies did not run successfully.
remote: │ exit code: 1
remote: ╰─> See above for output.
remote:
remote: note: This error originates from a subprocess, and is likely not a problem with pip.
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
Changing versions does nothing.

Apparently removing another module bdateutil solves the problem as there seems to be a conflict with the date-util in pandas.

Related

AttributeError: 'PosixPath' object has no attribute 'read_text' while building heroku app

I am getting AttributeError: 'PosixPath' object has no attribute 'read_text' when trying to deploy a django app to heroku. The problem occurs when pip is installing pathlib python library after running the git push heroku main command on the command line. Is there something I am doing wrong?
The following is the log generated on heroku, which is similar to what I saw on the command line:
-----> Building on the Heroku-20 stack
-----> Using buildpacks:
1. https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
2. heroku/python
-----> ffmpeg app detected
-----> Installing ffmpeg
Variable FFMPEG_DOWNLOAD_URL isn't set, using default value
Downloading https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz
Unpacking the archive
Installation successful
-----> Python app detected
-----> Using Python version specified in runtime.txt
! Python has released a security update! Please consider upgrading to python-3.7.13
Learn More: https://devcenter.heroku.com/articles/python-runtimes
-----> Python version has changed from python-3.9.10 to python-3.7.10, clearing cache
-----> Requirements file has been changed, clearing cached dependencies
-----> Installing python-3.7.10
-----> Installing pip 22.0.4, setuptools 60.10.0 and wheel 0.37.1
-----> Installing SQLite3
-----> Installing requirements with pip
Collecting asgiref==3.5.0
Downloading asgiref-3.5.0-py3-none-any.whl (22 kB)
Collecting attrs==21.4.0
Downloading attrs-21.4.0-py2.py3-none-any.whl (60 kB)
Collecting autobahn==22.2.2
Downloading autobahn-22.2.2.tar.gz (375 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting Automat==20.2.0
Downloading Automat-20.2.0-py2.py3-none-any.whl (31 kB)
Collecting blinker==1.4
Downloading blinker-1.4.tar.gz (111 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting cachetools==5.0.0
Downloading cachetools-5.0.0-py3-none-any.whl (9.1 kB)
Collecting certifi==2021.10.8
Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting cffi==1.15.0
Downloading cffi-1.15.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (427 kB)
Collecting channels==3.0.4
Downloading channels-3.0.4-py3-none-any.whl (38 kB)
Collecting charset-normalizer==2.0.12
Downloading charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Collecting constantly==15.1.0
Downloading constantly-15.1.0-py2.py3-none-any.whl (7.9 kB)
Collecting cryptography==36.0.1
Downloading cryptography-36.0.1-cp36-abi3-manylinux_2_24_x86_64.whl (3.6 MB)
Collecting daphne==3.0.2
Downloading daphne-3.0.2-py3-none-any.whl (26 kB)
Collecting Django==3.2.12
Downloading Django-3.2.12-py3-none-any.whl (7.9 MB)
Collecting djangorestframework==3.13.1
Downloading djangorestframework-3.13.1-py3-none-any.whl (958 kB)
Collecting ffmpeg-python==0.2.0
Downloading ffmpeg_python-0.2.0-py3-none-any.whl (25 kB)
Collecting future==0.18.2
Downloading future-0.18.2.tar.gz (829 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting google-api-core==2.7.2
Downloading google_api_core-2.7.2-py3-none-any.whl (114 kB)
Collecting google-api-python-client==2.44.0
Downloading google_api_python_client-2.44.0-py2.py3-none-any.whl (8.3 MB)
Collecting google-auth==2.6.4
Downloading google_auth-2.6.4-py2.py3-none-any.whl (156 kB)
Collecting google-auth-httplib2==0.1.0
Downloading google_auth_httplib2-0.1.0-py2.py3-none-any.whl (9.3 kB)
Collecting google-auth-oauthlib==0.5.1
Downloading google_auth_oauthlib-0.5.1-py2.py3-none-any.whl (19 kB)
Collecting googleapis-common-protos==1.56.0
Downloading googleapis_common_protos-1.56.0-py2.py3-none-any.whl (241 kB)
Collecting httplib2==0.20.4
Downloading httplib2-0.20.4-py3-none-any.whl (96 kB)
Collecting hyperlink==21.0.0
Downloading hyperlink-21.0.0-py2.py3-none-any.whl (74 kB)
Collecting idna==3.3
Downloading idna-3.3-py3-none-any.whl (61 kB)
Collecting incremental==21.3.0
Downloading incremental-21.3.0-py2.py3-none-any.whl (15 kB)
Collecting mega.py==1.0.8
Downloading mega.py-1.0.8-py2.py3-none-any.whl (19 kB)
Collecting oauthlib==3.2.0
Downloading oauthlib-3.2.0-py3-none-any.whl (151 kB)
Collecting protobuf==3.20.0
Downloading protobuf-3.20.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.0 MB)
Collecting pyasn1==0.4.8
Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
Collecting pyasn1-modules==0.2.8
Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
Collecting pycparser==2.21
Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
Collecting pycryptodome==3.14.1
Downloading pycryptodome-3.14.1-cp35-abi3-manylinux2010_x86_64.whl (2.0 MB)
Collecting pyOpenSSL==22.0.0
Downloading pyOpenSSL-22.0.0-py2.py3-none-any.whl (55 kB)
Collecting pyparsing==3.0.8
Downloading pyparsing-3.0.8-py3-none-any.whl (98 kB)
Collecting pytz==2022.1
Downloading pytz-2022.1-py2.py3-none-any.whl (503 kB)
Collecting requests==2.27.1
Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting requests-oauthlib==1.3.1
Downloading requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)
Collecting rsa==4.8
Downloading rsa-4.8-py3-none-any.whl (39 kB)
Collecting service-identity==21.1.0
Downloading service_identity-21.1.0-py2.py3-none-any.whl (12 kB)
Collecting six==1.16.0
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting sqlparse==0.4.2
Downloading sqlparse-0.4.2-py3-none-any.whl (42 kB)
Collecting tenacity==5.1.5
Downloading tenacity-5.1.5-py2.py3-none-any.whl (34 kB)
Collecting Twisted==22.2.0
Downloading Twisted-22.2.0-py3-none-any.whl (3.1 MB)
Collecting txaio==22.2.1
Downloading txaio-22.2.1-py2.py3-none-any.whl (30 kB)
Collecting typing_extensions==4.1.1
Downloading typing_extensions-4.1.1-py3-none-any.whl (26 kB)
Collecting uritemplate==4.1.1
Downloading uritemplate-4.1.1-py2.py3-none-any.whl (10 kB)
Collecting urllib3==1.26.9
Downloading urllib3-1.26.9-py2.py3-none-any.whl (138 kB)
Collecting zope.interface==5.4.0
Downloading zope.interface-5.4.0-cp37-cp37m-manylinux2010_x86_64.whl (251 kB)
Collecting twisted[tls]>=18.7
Downloading Twisted-22.4.0-py3-none-any.whl (3.1 MB)
Collecting pathlib==1.0.1
Downloading pathlib-1.0.1.tar.gz (49 kB)
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
╰─> [20 lines of output]
Traceback (most recent call last):
File "<string>", line 36, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-fwxp6f5v/pathlib_5dc29fdd1ec44473b4d7032f8a49d94d/setup.py", line 30, in <module>
url='https://pathlib.readthedocs.org/',
File "/app/.heroku/python/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 109, in setup
_setup_distribution = dist = klass(attrs)
File "/app/.heroku/python/lib/python3.7/site-packages/setuptools/dist.py", line 457, in __init__
for ep in metadata.entry_points(group='distutils.setup_keywords'):
File "/app/.heroku/python/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 999, in entry_points
return SelectableGroups.load(eps).select(**params)
File "/app/.heroku/python/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 449, in load
ordered = sorted(eps, key=by_group)
File "/app/.heroku/python/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 997, in <genexpr>
dist.entry_points for dist in unique(distributions())
File "/app/.heroku/python/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 609, in entry_points
return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self)
File "/app/.heroku/python/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 917, in read_text
return self._path.joinpath(filename).read_text(encoding='utf-8')
AttributeError: 'PosixPath' object has no attribute 'read_text'
[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
I found a solution that worked for me; I removed the packages mega and pathlib form the requirements.txt file.

Install of PySuperTuxKartData getting stuck

I am trying to install PySuperTuxKart onto my windows 10 computer via anaconda.
However every time I try to install PySuperTuxKart, PySuperTuxKart installs fine but PySuperTuxKartData seems to hang. I have let it sit for 5 minutes with no progress being made. My metric is that the loading animation just gets stuck this whole time and does not move. I have tried this on python versions 3.9-3.7. It installs fine in a venv that is version 3.10 but I need a package that is only available up to python 3.9. I enabled the verbose flag on the pip install and this is the output.
Using pip 22.0.4 from C:\Users\<user>\Anaconda3\envs\test\lib\site-packages\pip (python 3.7)
Collecting PySuperTuxKart
Using cached PySuperTuxKart-1.1.2-cp37-cp37m-win_amd64.whl (2.7 MB)
Collecting PySuperTuxKartData
Using cached PySuperTuxKartData-1.0.0.tar.gz (2.6 kB)
Installing build dependencies ... Running command pip subprocess to install build dependencies
Collecting setuptools>=42
Using cached setuptools-62.1.0-py3-none-any.whl (1.1 MB)
Collecting requests
Using cached requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting wheel
Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Collecting idna<4,>=2.5
Using cached idna-3.3-py3-none-any.whl (61 kB)
Collecting certifi>=2017.4.17
Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting charset-normalizer~=2.0.0
Using cached charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Collecting urllib3<1.27,>=1.21.1
Using cached urllib3-1.26.9-py2.py3-none-any.whl (138 kB)
Installing collected packages: certifi, wheel, urllib3, setuptools, idna, charset-normalizer, requests
Successfully installed certifi-2021.10.8 charset-normalizer-2.0.12 idna-3.3 requests-2.27.1 setuptools-62.1.0 urllib3-1.26.9 wheel-0.37.1
done
Getting requirements to build wheel ... Running command Getting requirements to build wheel
running egg_info
writing PySuperTuxKartData.egg-info\PKG-INFO
writing dependency_links to PySuperTuxKartData.egg-info\dependency_links.txt
writing requirements to PySuperTuxKartData.egg-info\requires.txt
writing top-level names to PySuperTuxKartData.egg-info\top_level.txt
reading manifest file 'PySuperTuxKartData.egg-info\SOURCES.txt'
writing manifest file 'PySuperTuxKartData.egg-info\SOURCES.txt'
done
Preparing metadata (pyproject.toml) ... Running command Preparing metadata (pyproject.toml)
running dist_info
creating C:\Users\<user>\AppData\Local\Temp\pip-modern-metadata-lz0lblhq\PySuperTuxKartData.egg-info
writing C:\Users\<user>\AppData\Local\Temp\pip-modern-metadata-lz0lblhq\PySuperTuxKartData.egg-info\PKG-INFO
writing dependency_links to C:\Users\<user>\AppData\Local\Temp\pip-modern-metadata-lz0lblhq\PySuperTuxKartData.egg-info\dependency_links.txt
writing requirements to C:\Users\<user>\AppData\Local\Temp\pip-modern-metadata-lz0lblhq\PySuperTuxKartData.egg-info\requires.txt
writing top-level names to C:\Users\<user>\AppData\Local\Temp\pip-modern-metadata-lz0lblhq\PySuperTuxKartData.egg-info\top_level.txt
writing manifest file 'C:\Users\<user>\AppData\Local\Temp\pip-modern-metadata-lz0lblhq\PySuperTuxKartData.egg-info\SOURCES.txt'
reading manifest file 'C:\Users\<user>\AppData\Local\Temp\pip-modern-metadata-lz0lblhq\PySuperTuxKartData.egg-info\SOURCES.txt'
writing manifest file 'C:\Users\<user>\AppData\Local\Temp\pip-modern-metadata-lz0lblhq\PySuperTuxKartData.egg-info\SOURCES.txt'
creating 'C:\Users\<user>\AppData\Local\Temp\pip-modern-metadata-lz0lblhq\PySuperTuxKartData-1.0.0.dist-info'
done
Collecting requests
Using cached requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting urllib3<1.27,>=1.21.1
Using cached urllib3-1.26.9-py2.py3-none-any.whl (138 kB)
Collecting charset-normalizer~=2.0.0
Using cached charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\<user>\anaconda3\envs\test\lib\site-packages (from requests->PySuperTuxKartData->PySuperTuxKart) (2021.10.8)
Collecting idna<4,>=2.5
Using cached idna-3.3-py3-none-any.whl (61 kB)
Building wheels for collected packages: PySuperTuxKartData
Building wheel for PySuperTuxKartData (pyproject.toml) ... Running command Building wheel for PySuperTuxKartData (pyproject.toml)
running bdist_wheel
running build
running build_py
creating build
creating build\lib
creating build\lib\pystk_data
copying .\setup.py -> build\lib\pystk_data
copying .\__init__.py -> build\lib\pystk_data
running fetch_data
It hangs on the running fetch_data step. Any suggestions?

Successful build of Heroku Python App but execution is unsuccessful and open app throws error

I recently successfully deployed a Heroku app(view log below for details), but when I try to access my app through a browser, it returns with An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command heroku logs --tail. Furthermore, my app was for a Discord.Py bot, and the bot was not online like it should be.
Logs:
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/python
-----> Python app detected
-----> No Python version was specified. Using the same version as the last build: python-3.9.9
To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
-----> Requirements file has been changed, clearing cached dependencies
-----> Installing python-3.9.9
-----> Installing pip 21.3.1, setuptools 57.5.0 and wheel 0.37.0
-----> Installing SQLite3
-----> Installing requirements with pip
Collecting discord.py==1.6.0
Downloading discord.py-1.6.0-py3-none-any.whl (779 kB)
Collecting Flask==2.0.2
Downloading Flask-2.0.2-py3-none-any.whl (95 kB)
Collecting dnspython==1.16.0
Downloading dnspython-1.16.0-py2.py3-none-any.whl (188 kB)
Collecting PyNaCl==1.3.0
Downloading PyNaCl-1.3.0-cp34-abi3-manylinux1_x86_64.whl (759 kB)
Collecting async-timeout==3.0.1
Downloading async_timeout-3.0.1-py3-none-any.whl (8.2 kB)
Collecting aiohttp<3.8.0,>=3.6.0
Downloading aiohttp-3.7.4.post0-cp39-cp39-manylinux2014_x86_64.whl (1.4 MB)
Collecting Jinja2>=3.0
Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
Collecting itsdangerous>=2.0
Downloading itsdangerous-2.0.1-py3-none-any.whl (18 kB)
Collecting Werkzeug>=2.0
Downloading Werkzeug-2.0.2-py3-none-any.whl (288 kB)
Collecting click>=7.1.2
Downloading click-8.0.3-py3-none-any.whl (97 kB)
Collecting cffi>=1.4.1
Downloading cffi-1.15.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (444 kB)
Collecting six
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting yarl<2.0,>=1.0
Downloading yarl-1.7.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (304 kB)
Collecting attrs>=17.3.0
Downloading attrs-21.4.0-py2.py3-none-any.whl (60 kB)
Collecting chardet<5.0,>=2.0
Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
Collecting typing-extensions>=3.6.5
Downloading typing_extensions-4.0.1-py3-none-any.whl (22 kB)
Collecting multidict<7.0,>=4.5
Downloading multidict-5.2.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (174 kB)
Collecting pycparser
Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
Collecting MarkupSafe>=2.0
Downloading MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (30 kB)
Collecting idna>=2.0
Downloading idna-3.3-py3-none-any.whl (61 kB)
Installing collected packages: multidict, idna, yarl, typing-extensions, pycparser, MarkupSafe, chardet, attrs, async-timeout, Werkzeug, six, Jinja2, itsdangerous, click, cffi, aiohttp, PyNaCl, Flask, dnspython, discord.py
Successfully installed Flask-2.0.2 Jinja2-3.0.3 MarkupSafe-2.0.1 PyNaCl-1.3.0 Werkzeug-2.0.2 aiohttp-3.7.4.post0 async-timeout-3.0.1 attrs-21.4.0 cffi-1.15.0 chardet-4.0.0 click-8.0.3 discord.py-1.6.0 dnspython-1.16.0 idna-3.3 itsdangerous-2.0.1 multidict-5.2.0 pycparser-2.21 six-1.16.0 typing-extensions-4.0.1 yarl-1.7.2
-----> Discovering process types
Procfile declares types -> worker
-----> Compressing...
Done: 62M
-----> Launching...
Released v5
https://app.herokuapp.com/ deployed to Heroku
Your application is a worker (Procfile declares types -> worker) so it does respond to HTTP requests.
Change to web and make sure you bind the PORT provided by Heroku.
BTW BOTs can run as workers (without dealing with incoming requests) if they poll the server for messages/updates. This is a viable option too (keep it as worker) but ensure the BOT logs what it does at startup.

Heroku cant detect Procfile (Pycharm)

I have also tried using the echo command and i have it on github also but for some reason it wont be detected.
Here is what i have inside Procfile `"worker: python main.py"
Here is the build log:
-----> Python app detected
-----> Installing python-3.8.5
-----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
-----> Installing SQLite3
-----> Installing requirements with pip
Collecting certifi==2020.6.20
Downloading certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
Collecting chardet==3.0.4
Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting idna==2.10
Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
Collecting oauthlib==3.1.0
Downloading oauthlib-3.1.0-py2.py3-none-any.whl (147 kB)
Collecting PySocks==1.7.1
Downloading PySocks-1.7.1-py3-none-any.whl (16 kB)
Collecting requests==2.24.0
Downloading requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting requests-oauthlib==1.3.0
Downloading requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB)
Collecting six==1.15.0
Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting tweepy==3.9.0
Downloading tweepy-3.9.0-py2.py3-none-any.whl (30 kB)
Collecting urllib3==1.25.10
Downloading urllib3-1.25.10-py2.py3-none-any.whl (127 kB)
Installing collected packages: certifi, chardet, idna, oauthlib, PySocks, urllib3, requests, requests-oauthlib, six, tweepy
Successfully installed PySocks-1.7.1 certifi-2020.6.20 chardet-3.0.4 idna-2.10 oauthlib-3.1.0 requests-2.24.0 requests-oauthlib-1.3.0 six-1.15.0 tweepy-3.9.0 urllib3-1.25.10
-----> Discovering process types
-----> Compressing...
Done: 53.2M
-----> Launching...
Released v3
https://twitterbot1k.herokuapp.com/ deployed to Heroku
`
Have you added requirements.txt file in your root directory? I faced similar issue when I forgot to add requirements.txt. Please create empty file if you don't need any extra packages. It tells Heroku that your application is written in Python.

Herokuapp fails to compile

My app has compiled before, but now when I attempt to push new changes, it gives a warning of invalid fragment for a spacy model language package:
Installing dependencies from Pipfile.lock (afd0bd)…
remote: WARNING: Invalid fragment string egg=en-core-web-sm==2.1.0
remote: ABORTING INSTALL... You will have to reinstall any packages that failed to install.
remote: You may have to manually run pipenv lock when you are finished.
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to captain-hp-bot.
Here is my pipfile:
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
chatterbot = {editable = true,git = "https://github.com/mmoore7/ChatterBot.git"}
en-core-web-sm = {file = "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.1.0/en_core_web_sm-2.1.0.tar.gz"}
pymongo = "*"
flask = "*"
flask-wtf = "*"
flask-bcrypt = "*"
flask-login = "*"
dnspython = "*"
gunicorn = "*"
pandas = "*"
botbuilder-core = "*"
asyncio = "*"
html2text = "*"
[requires]
python_version = "3.8"
I think it has to do with the version of pipenv it's using to install the packages, which is version 2018.5.18. I had an with that exact package on an older version of pipenv (can't quite remember which version but it's a recent one), which I traced to this issue: Issue #4318. It was fixed in the latest version, which I'm now using on my machine, version 2020.6.2.
If this is the issue, how can I get it to use an update version of pipenv to complete the compilation? Or is my syntax wrong in the pipfile for that package (it's been fine that way for awhile).
I tried clearing the cache and then pushing, but I still get the same error.
Here's the whole log:
Enumerating objects: 20, done.
Counting objects: 100% (20/20), done.
Delta compression using up to 12 threads
Compressing objects: 100% (10/10), done.
Writing objects: 100% (11/11), 14.39 KiB | 1.20 MiB/s, done.
Total 11 (delta 7), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.8.3
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 2018.5.18…
remote: Installing -e git+https://github.com/mmoore7/ChatterBot.git#egg=chatterbot…
remote: Obtaining chatterbot from git+https://github.com/mmoore7/ChatterBot.git#egg=chatterbot
remote: Cloning https://github.com/mmoore7/ChatterBot.git to ./src/chatterbot
remote: Collecting mathparse<0.2,>=0.1 (from chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/c3/e5/4910fb85950cb960fcf3f5aabe1c8e55f5c9201788a1c1302b570a7e1f84/mathparse-0.1.2-py3-none-any.whl
remote: Collecting nltk<4.0,>=3.2 (from chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/92/75/ce35194d8e3022203cca0d2f896dbb88689f9b3fce8e9f9cff942913519d/nltk-3.5.zip (1.4MB)
remote: Collecting pint>=0.8.1 (from chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/3f/1c/95b113bd8da60e2aeecb4988c007a867682c739c721cb3ab16de77913040/Pint-0.12-py2.py3-none-any.whl (192kB)
remote: Collecting python-dateutil<2.9,>=2.8 (from chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
remote: Collecting pyyaml<5.4,>=5.3 (from chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz (269kB)
remote: Collecting spacy<2.2,>=2.1 (from chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/1f/e2/46650d03c7ff2b57ed7af211d41c3f606540f7adea92b5af65fcf9f605c0/spacy-2.1.9.tar.gz (30.7MB)
remote: Collecting sqlalchemy<1.4,>=1.3 (from chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/05/ca/4c3ccb306fdec0e105a84c7d156e5bdd9c86a86923b05fd47877cddc62ed/SQLAlchemy-1.3.17-cp38-cp38-manylinux1_x86_64.whl (1.3MB)
remote: Collecting pytz (from chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/4f/a4/879454d49688e2fad93e59d7d4efda580b783c745fd2ec2a3adf87b0808d/pytz-2020.1-py2.py3-none-any.whl (510kB)
remote: Collecting click (from nltk<4.0,>=3.2->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82kB)
remote: Collecting joblib (from nltk<4.0,>=3.2->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/b8/a6/d1a816b89aa1e9e96bcb298eb1ee1854f21662ebc6d55ffa3d7b3b50122b/joblib-0.15.1-py3-none-any.whl (298kB)
remote: Collecting regex (from nltk<4.0,>=3.2->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/8e/0a/6c702a8bb8fd025306b5109130f8e3489ba48b49033b37ca9e1227ec1b02/regex-2020.6.8-cp38-cp38-manylinux1_x86_64.whl (673kB)
remote: Collecting tqdm (from nltk<4.0,>=3.2->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/f3/76/4697ce203a3d42b2ead61127b35e5fcc26bba9a35c03b32a2bd342a4c869/tqdm-4.46.1-py2.py3-none-any.whl (63kB)
remote: Requirement already satisfied: setuptools in ./.heroku/python/lib/python3.8/site-packages (from pint>=0.8.1->chatterbot)
remote: Requirement already satisfied: six>=1.5 in ./.heroku/python/lib/python3.8/site-packages (from python-dateutil<2.9,>=2.8->chatterbot)
remote: Collecting numpy>=1.15.0 (from spacy<2.2,>=2.1->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/01/c6/87592f924246da1e58673cf708a2748754517c5cf050726238d6cfbd8df4/numpy-1.18.5-cp38-cp38-manylinux1_x86_64.whl (20.6MB)
remote: Collecting murmurhash<1.1.0,>=0.28.0 (from spacy<2.2,>=2.1->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/20/2d/798d60fdfdf4fcc16b9c73d9450183fb61fdb89e8d475fa94d07edfcd3b7/murmurhash-1.0.2-cp38-cp38-manylinux1_x86_64.whl
remote: Collecting cymem<2.1.0,>=2.0.2 (from spacy<2.2,>=2.1->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/41/2d/d24b1b980da72883a6a8dc5f9bdf48bcb892f3ac1579fb300045771693c3/cymem-2.0.3-cp38-cp38-manylinux1_x86_64.whl
remote: Collecting preshed<2.1.0,>=2.0.1 (from spacy<2.2,>=2.1->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/0b/14/c9aa735cb9c131545fc9e23031baccb87041ac9215b3d75f99e3cf18f6a3/preshed-2.0.1.tar.gz (113kB)
remote: Collecting thinc<7.1.0,>=7.0.8 (from spacy<2.2,>=2.1->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/92/39/ea2a3d5b87fd52fc865fd1ceb7b91dca1f85e227d53e7a086d260f6bcb93/thinc-7.0.8.tar.gz (1.9MB)
remote: Collecting blis<0.3.0,>=0.2.2 (from spacy<2.2,>=2.1->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/59/9e/84a83616cbe5daa94909da38b780e93bf566dc2113c3dc35d7b4cad52f63/blis-0.2.4.tar.gz (1.5MB)
remote: Collecting plac<1.0.0,>=0.9.6 (from spacy<2.2,>=2.1->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/9e/9b/62c60d2f5bc135d2aa1d8c8a86aaf84edb719a59c7f11a4316259e61a298/plac-0.9.6-py2.py3-none-any.whl
remote: Collecting requests<3.0.0,>=2.13.0 (from spacy<2.2,>=2.1->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/1a/70/1935c770cb3be6e3a8b78ced23d7e0f3b187f5cbfab4749523ed65d7c9b1/requests-2.23.0-py2.py3-none-any.whl (58kB)
remote: Collecting wasabi<1.1.0,>=0.2.0 (from spacy<2.2,>=2.1->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/21/e1/e4e7b754e6be3a79c400eb766fb34924a6d278c43bb828f94233e0124a21/wasabi-0.6.0-py3-none-any.whl
remote: Collecting srsly<1.1.0,>=0.0.6 (from spacy<2.2,>=2.1->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/1e/18/eff2f26419bf99a0a18acfe287d98a0bedb1a65618f86bdbe95c5acd580b/srsly-1.0.2-cp38-cp38-manylinux1_x86_64.whl (185kB)
remote: Requirement already satisfied: certifi>=2017.4.17 in ./.heroku/python/lib/python3.8/site-packages (from requests<3.0.0,>=2.13.0->spacy<2.2,>=2.1->chatterbot)
remote: Collecting chardet<4,>=3.0.2 (from requests<3.0.0,>=2.13.0->spacy<2.2,>=2.1->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
remote: Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests<3.0.0,>=2.13.0->spacy<2.2,>=2.1->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/e1/e5/df302e8017440f111c11cc41a6b432838672f5a70aa29227bf58149dc72f/urllib3-1.25.9-py2.py3-none-any.whl (126kB)
remote: Collecting idna<3,>=2.5 (from requests<3.0.0,>=2.13.0->spacy<2.2,>=2.1->chatterbot)
remote: Downloading https://files.pythonhosted.org/packages/89/e3/afebe61c546d18fb1709a61bee788254b40e736cff7271c7de5de2dc4128/idna-2.9-py2.py3-none-any.whl (58kB)
remote: Building wheels for collected packages: nltk, pyyaml, spacy, preshed, thinc, blis
remote: Running setup.py bdist_wheel for nltk: started
remote: Running setup.py bdist_wheel for nltk: finished with status 'done'
remote: Stored in directory: /app/.cache/pip/wheels/ae/8c/3f/b1fe0ba04555b08b57ab52ab7f86023639a526d8bc8d384306
remote: Running setup.py bdist_wheel for pyyaml: started
remote: Running setup.py bdist_wheel for pyyaml: finished with status 'done'
remote: Stored in directory: /app/.cache/pip/wheels/a7/c1/ea/cf5bd31012e735dc1dfea3131a2d5eae7978b251083d6247bd
remote: Running setup.py bdist_wheel for spacy: started
remote: Running setup.py bdist_wheel for spacy: still running...
remote: Running setup.py bdist_wheel for spacy: still running...
remote: Running setup.py bdist_wheel for spacy: still running...
remote: Running setup.py bdist_wheel for spacy: still running...
remote: Running setup.py bdist_wheel for spacy: finished with status 'done'
remote: Stored in directory: /app/.cache/pip/wheels/08/fe/7f/19f370eb24ed7d428a7531429b20e6ea9195f320209a2295d8
remote: Running setup.py bdist_wheel for preshed: started
remote: Running setup.py bdist_wheel for preshed: finished with status 'done'
remote: Stored in directory: /app/.cache/pip/wheels/22/66/7a/672369bfbf391c645f57e937786f7a9c1ed4f225a4a73b0673
remote: Running setup.py bdist_wheel for thinc: started
remote: Running setup.py bdist_wheel for thinc: finished with status 'done'
remote: Stored in directory: /app/.cache/pip/wheels/f2/32/f0/fe1467f30fde6dd38ef58010310d2f114b99db79391ff8c0cb
remote: Running setup.py bdist_wheel for blis: started
remote: Running setup.py bdist_wheel for blis: still running...
remote: Running setup.py bdist_wheel for blis: still running...
remote: Running setup.py bdist_wheel for blis: still running...
remote: Running setup.py bdist_wheel for blis: finished with status 'done'
remote: Stored in directory: /app/.cache/pip/wheels/06/4a/3f/264f84e713c1e95acfcdb144f46cda3807ab314a864944690e
remote: Successfully built nltk pyyaml spacy preshed thinc blis
remote: Installing collected packages: mathparse, click, joblib, regex, tqdm, nltk, pint, python-dateutil, pyyaml, numpy, murmurhash, cymem, preshed, blis, wasabi, srsly, plac, thinc, chardet, urllib3, idna, requests, spacy, sqlalchemy, pytz, chatterbot
remote: Running setup.py develop for chatterbot
remote: Successfully installed blis-0.2.4 chardet-3.0.4 chatterbot click-7.1.2 cymem-2.0.3 idna-2.9 joblib-0.15.1 mathparse-0.1.2 murmurhash-1.0.2 nltk-3.5 numpy-1.18.5 pint-0.12 plac-0.9.6 preshed-2.0.1 python-dateutil-2.8.1 pytz-2020.1 pyyaml-5.3.1 regex-2020.6.8 requests-2.23.0 spacy-2.1.9 sqlalchemy-1.3.17 srsly-1.0.2 thinc-7.0.8 tqdm-4.46.1 urllib3-1.25.9 wasabi-0.6.0
remote:
remote: Adding -e git+https://github.com/mmoore7/ChatterBot.git#egg=chatterbot to Pipfile's [packages]…
remote: Creating a virtualenv for this project…
remote: Using /app/.heroku/python/bin/python (3.8.3) to create virtualenv…
remote: created virtual environment CPython3.8.3.final.0-64 in 792ms
remote: creator CPython3Posix(dest=/app/.local/share/virtualenvs/build_71e6813d471b0b6c3faf122c18c08200-75mJ028V, clear=False, global=False)
remote: seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/app/.local/share/virtualenv/seed-app-data/v1.0.1)
remote: activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
remote:
remote: Virtualenv location: /app/.local/share/virtualenvs/build_71e6813d471b0b6c3faf122c18c08200-75mJ028V
remote: Installing dependencies from Pipfile.lock (afd0bd)…
remote: WARNING: Invalid fragment string egg=en-core-web-sm==2.1.0
remote: ABORTING INSTALL... You will have to reinstall any packages that failed to install.
remote: You may have to manually run pipenv lock when you are finished.
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to captain-hp-bot.
remote:
To https://git.heroku.com/captain-hp-bot.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/captain-hp-bot.git'
So I think the pipenv version is the reason why it fails. There's a bug in the version it's using that prevents the app from compiling. The solution was to use a requirements.txt so heroku uses pip instead. Even after clearing the app's cache, it still would use the Pipfile from somewhere, so destroying the app and re-creating it with requirements.txt file resolved the issue.

Categories

Resources