我已经将这个特定的应用程序多次推送到heroku而没有任何问题,直到今天它给了我这样的错误
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'
然后我将runtime.txt更改为python-3.6.0,因为那是支持的运行时现在我得到这样的错误
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'
请感谢任何帮助,谢谢
答案 0 :(得分:6)
我最近遇到了这个问题。这似乎是一个特别适用于appdirs的问题。我只是通过升级appdirs,更新我的requirements.txt然后重新部署到heroku来解决这个问题。
pip install appdirs --upgrade
pip freeze > requirements.txt