简体   繁体   中英

deploying flask app to heroku error

I have pushed this particular app so many times to heroku without any issues until today when it gave me errors like this

Counting objects: 14, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 2.49 KiB | 0 bytes/s, done.
Total 14 (delta 7), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.5.1
remote:  !     Requested runtime (python-3.5.1) is not available for this stack (heroku-16).
remote:  !     Aborting.  More info:https://devcenter.heroku.com/articles/python-support
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy....
remote:
remote: !       Push rejected to serene-temple-30062.
remote:
To https://git.heroku.com/serene-temple-30062.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/serene-temple-30062.git'

Then i changed the runtime.txt to python-3.6.0 since that was the supported runtime now i get errors like this

remote:          Found existing installation: appdirs 1.4.3
remote:            Uninstalling appdirs-1.4.3:
remote:              Successfully uninstalled appdirs-1.4.3
remote:          Rolling back uninstall of appdirs
remote:        Exception:
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/lib/python3.6/site-   packages/pkg_resources/__init__.py", line 2813, in _dep_ma
p
remote:            return self.__dep_map
remote:          File "/app/.heroku/python/lib/python3.6/site- packages/pkg_resources/__init__.py", line 2624, in __getat
tr__
remote:            raise AttributeError(attr)
remote:        AttributeError: _DistInfoDistribution__dep_map
remote:
remote:        During handling of the above exception, another exception occurred:
remote:
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/lib/python3.6/site- packages/pkg_resources/__init__.py", line 2804, in _parsed
_pkg_info
remote:            return self._pkg_info
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2624, in __getat
tr__
remote:            raise AttributeError(attr)
remote:        AttributeError: _pkg_info
remote:
remote:        During handling of the above exception, another exception    occurred:
remote:
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
remote:            status = self.run(options, args)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
remote:            prefix=options.prefix_path,
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
remote:            **kwargs
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/req/req_install.py", line 851, in install
remote:            self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/req/req_install.py", line 1064, in move_wheel
_files
remote:            isolated=self.isolated,
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/wheel.py", line 247, in move_wheel_files
remote:            prefix=prefix,
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/locations.py", line 140, in distutils_scheme
remote:            d = Distribution(dist_args)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/dist.py", line 320, in __init__
remote:            _Distribution.__init__(self, attrs)
remote:          File  "/app/.heroku/python/lib/python3.6/distutils/dist.py", line 281, in __init__
remote:            self.finalize_options()
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/dist.py", line 386, in finalize_option
s
remote:            ep.require(installer=self.fetch_build_egg)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2324, in require

remote:            items = working_set.resolve(reqs, env, installer, extras=self.extras)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pkg_resources/__init__.py", line 862, in resolve
remote:            new_requirements = dist.requires(req.extras)[::-1]
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2568, in require
s
remote:            dm = self._dep_map
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2815, in _dep_ma
p
remote:            self.__dep_map = self._compute_dependencies()
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2824, in _comput
e_dependencies
remote:            for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2806, in _parsed
_pkg_info
remote:            metadata = self.get_metadata(self.PKG_INFO)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1468, in get_met
adata
remote:            value = self._get(self._fn(self.egg_info, name))
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1577, in _get
remote:            with open(path, 'rb') as stream:
remote:        FileNotFoundError: [Errno 2] No such file or directory:  '/tmp/build_d5216bcdf3f42398e57859a9302dd93f/.her
oku/python/lib/python3.6/site-packages/appdirs-1.4.3.dist-info/METADATA'
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to serene-temple-30062.
remote:
To https://git.heroku.com/serene-temple-30062.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/serene-temple-30062.git'

Please any help is appreciated thank you

I faced this issue recently. This seems to be an issue particularly with appdirs. I've resolved this issue by just simply upgrading appdirs, updating my requirements.txt and then redeploying to heroku.

pip install appdirs --upgrade
pip freeze > requirements.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM