2017-06-01 166 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'的模塊 –

相關問題