2017-06-01 136 views
0

我想部署他们在入门部分提到的应用程序。但是我收到错误ModuleNotFoundError: No module named 'six'。整个构建日志如下:将django应用程序部署到Heroku时导入错误

-----> Python app detected 
-----> Installing python-3.6.1 
-----> Installing pip 
-----> Installing requirements with pip 
     Collecting dj-database-url==0.4.1 (from -r /tmp/build_1900e0c2c9d2dd1135d0cd7b517175ae/requirements.txt (line 1)) 
     Downloading dj-database-url-0.4.1.tar.gz 
     Collecting Django==1.9.7 (from -r /tmp/build_1900e0c2c9d2dd1135d0cd7b517175ae/requirements.txt (line 2)) 
     Downloading Django-1.9.7-py2.py3-none-any.whl (6.6MB) 
     Collecting gunicorn==19.6.0 (from -r /tmp/build_1900e0c2c9d2dd1135d0cd7b517175ae/requirements.txt (line 3)) 
     Downloading gunicorn-19.6.0-py2.py3-none-any.whl (114kB) 
     Collecting psycopg2==2.6.2 (from -r /tmp/build_1900e0c2c9d2dd1135d0cd7b517175ae/requirements.txt (line 4)) 
     Downloading psycopg2-2.6.2.tar.gz (376kB) 
     Collecting whitenoise==2.0.6 (from -r /tmp/build_1900e0c2c9d2dd1135d0cd7b517175ae/requirements.txt (line 5)) 
     Downloading whitenoise-2.0.6-py2.py3-none-any.whl 
     Installing collected packages: dj-database-url, Django, gunicorn, psycopg2, whitenoise 
     Running setup.py install for dj-database-url: started 
      Running setup.py install for dj-database-url: finished with status 'error' 
      Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-vkji1x5w/dj-database-url/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-e09119wj-record/install-record.txt --single-version-externally-managed --compile: 
      running install 
      running build 
      running build_py 
      creating build 
      creating build/lib 
      copying dj_database_url.py -> build/lib 
      running egg_info 
      writing dj_database_url.egg-info/PKG-INFO 
      writing dependency_links to dj_database_url.egg-info/dependency_links.txt 
      writing top-level names to dj_database_url.egg-info/top_level.txt 
      reading manifest file 'dj_database_url.egg-info/SOURCES.txt' 
      writing manifest file 'dj_database_url.egg-info/SOURCES.txt' 
      running install_lib 
      copying build/lib/dj_database_url.py -> /app/.heroku/python/lib/python3.6/site-packages 
      byte-compiling /app/.heroku/python/lib/python3.6/site-packages/dj_database_url.py to dj_database_url.cpython-36.pyc 
      running install_egg_info 
      Copying dj_database_url.egg-info to /app/.heroku/python/lib/python3.6/site-packages/dj_database_url-0.4.1-py3.6.egg-info 
      running install_scripts 
      Traceback (most recent call last): 
      File "<string>", line 1, in <module> 
      File "/tmp/pip-build-vkji1x5w/dj-database-url/setup.py", line 89, in <module> 
       'Programming Language :: Python :: 3.5', 
      File "/app/.heroku/python/lib/python3.6/distutils/core.py", line 148, in setup 
       dist.run_commands() 
      File "/app/.heroku/python/lib/python3.6/distutils/dist.py", line 955, in run_commands 
       self.run_command(cmd) 
      File "/app/.heroku/python/lib/python3.6/distutils/dist.py", line 974, in run_command 
       cmd_obj.run() 
      File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run 
       return orig.install.run(self) 
      File "/app/.heroku/python/lib/python3.6/distutils/command/install.py", line 557, in run 
       self.run_command(cmd_name) 
      File "/app/.heroku/python/lib/python3.6/distutils/cmd.py", line 313, in run_command 
       self.distribution.run_command(command) 
      File "/app/.heroku/python/lib/python3.6/distutils/dist.py", line 974, in run_command 
       cmd_obj.run() 
      File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/command/install_scripts.py", line 17, in run 
       import setuptools.command.easy_install as ei 
      File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 49, in <module> 
       from setuptools.py27compat import rmtree_safe 
      File "/app/.heroku/python/lib/python3.6/site-packages/setuptools/py27compat.py", line 7, in <module> 
       import six 
      ModuleNotFoundError: No module named 'six' 

      ---------------------------------------- 
     Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-vkji1x5w/dj-database-url/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-e09119wj-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-vkji1x5w/dj-database-url/ 
!  Push rejected, failed to compile Python app. 
!  Push failed 

我甚至已经安装了six模块,但它不工作。

+2

它看起来好像是在setuptools中触发[此问题](https://github.com/pypa/setuptools/issues/1042)。 – Alasdair

+0

你可以尝试把'six'放在requirements.txt文件的顶部 –

+0

我试过了,但它没有安装它并直接移动到第二个依赖项。 –

回答

0

你(非常久远了很多其他人的)都面临着this issue

upgrade your CI environment to just short of v36 with the following pre-install command:

pip install --upgrade "setuptools < 36" 

然后,确保即将被创建的virtualenv继承该版本具有以下环境变量:

VIRTUALENV_NO_DOWNLOAD=1 

另一解决方法是通过安装模块six之前运行任何其他命令。

Github回购的官方回应是它将尽快修复。 希望它有效。干杯!

+0

我安装了六个模块,然后完成了从一开始的所有步骤,但它也给出了错误。 –

+0

是否与以前一样? – TheDarkKnight

+0

是 - > ModuleNotFoundError:没有名为'six'的模块 –

相关问题