尝试安装gpt-2-simple时出现“错误:regex的构建轮失败” Windows 10

问题描述

我正在尝试在python 3.5上安装gpt-2-simple,但是当我运行命令py -3.5 -m pip install gpt-2-simple时,它会显示以下输出:

Collecting gpt-2-simple
  Using cached gpt_2_simple-0.7.1.tar.gz (24 kB)
Collecting regex
  Downloading regex-2020.7.14.tar.gz (690 kB)
     |████████████████████████████████| 690 kB 3.3 MB/s
Collecting requests
  Using cached requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting tqdm
  Downloading tqdm-4.48.2-py2.py3-none-any.whl (68 kB)
     |████████████████████████████████| 68 kB 4.5 MB/s
Requirement already satisfied: numpy in c:\users\17_es\appdata\local\programs\python\python35\lib\site-packages (from gpt-2-simple) (1.18.5)
Collecting toposort
  Using cached toposort-1.5-py2.py3-none-any.whl (7.6 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
Collecting chardet<4,>=3.0.2
  Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Using cached urllib3-1.25.10-py2.py3-none-any.whl (127 kB)
Collecting idna<3,>=2.5
  Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Building wheels for collected packages: gpt-2-simple,regex
  Building wheel for gpt-2-simple (setup.py) ... done
  Created wheel for gpt-2-simple: filename=gpt_2_simple-0.7.1-py3-none-any.whl size=23583 sha256=a21616c1d86838d8adf9a06b2ae6b0e9c0c0dbb83016c5c6c5e2356dd8fb6607
  Stored in directory: c:\users\17_es\appdata\local\pip\cache\wheels\15\12\62\827e1180423289d92d6bdfea72981ae5f65b7f27e746f125b1
  Building wheel for regex (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\17_es\AppData\Local\Programs\Python\Python35\python.exe' -u -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'C:\\Users\\17_es\\AppData\\Local\\Temp\\pip-install-njzqms9s\\regex\\setup.py'"'"'; __file__='"'"'C:\\Users\\17_es\\AppData\\Local\\Temp\\pip-install-njzqms9s\\regex\\setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\17_es\AppData\Local\Temp\pip-wheel-6txekdc_'
       cwd: C:\Users\17_es\AppData\Local\Temp\pip-install-njzqms9s\regex\
  Complete output (19 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.5
  creating build\lib.win-amd64-3.5\regex
  copying regex_3\__init__.py -> build\lib.win-amd64-3.5\regex
  copying regex_3\regex.py -> build\lib.win-amd64-3.5\regex
  copying regex_3\_regex_core.py -> build\lib.win-amd64-3.5\regex
  copying regex_3\test_regex.py -> build\lib.win-amd64-3.5\regex
  running build_ext
  building 'regex._regex' extension
  creating build\temp.win-amd64-3.5
  creating build\temp.win-amd64-3.5\Release
  creating build\temp.win-amd64-3.5\Release\regex_3
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX64\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\17_es\AppData\Local\Programs\Python\Python35\include -IC:\Users\17_es\AppData\Local\Programs\Python\Python35\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include" /Tcregex_3\_regex.c /Fobuild\temp.win-amd64-3.5\Release\regex_3\_regex.obj
  _regex.c
  C:\Users\17_es\AppData\Local\Programs\Python\Python35\include\pyconfig.h(68): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX64\\x64\\cl.exe' failed with exit status 2
  ----------------------------------------
  ERROR: Failed building wheel for regex
  Running setup.py clean for regex
Successfully built gpt-2-simple
Failed to build regex
DEPRECATION: Could not build wheels for regex which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: regex,certifi,chardet,urllib3,idna,requests,tqdm,toposort,gpt-2-simple
    Running setup.py install for regex ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\17_es\AppData\Local\Programs\Python\Python35\python.exe' -u -c 'import sys,'"'"'exec'"'"'))' install --record 'C:\Users\17_es\AppData\Local\Temp\pip-record-dieg40uq\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\17_es\AppData\Local\Programs\Python\Python35\Include\regex'
         cwd: C:\Users\17_es\AppData\Local\Temp\pip-install-njzqms9s\regex\
    Complete output (19 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.5
    creating build\lib.win-amd64-3.5\regex
    copying regex_3\__init__.py -> build\lib.win-amd64-3.5\regex
    copying regex_3\regex.py -> build\lib.win-amd64-3.5\regex
    copying regex_3\_regex_core.py -> build\lib.win-amd64-3.5\regex
    copying regex_3\test_regex.py -> build\lib.win-amd64-3.5\regex
    running build_ext
    building 'regex._regex' extension
    creating build\temp.win-amd64-3.5
    creating build\temp.win-amd64-3.5\Release
    creating build\temp.win-amd64-3.5\Release\regex_3
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX64\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\17_es\AppData\Local\Programs\Python\Python35\include -IC:\Users\17_es\AppData\Local\Programs\Python\Python35\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include" /Tcregex_3\_regex.c /Fobuild\temp.win-amd64-3.5\Release\regex_3\_regex.obj
    _regex.c
    C:\Users\17_es\AppData\Local\Programs\Python\Python35\include\pyconfig.h(68): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX64\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\17_es\AppData\Local\Programs\Python\Python35\python.exe' -u -c 'import sys,'"'"'exec'"'"'))' install --record 'C:\Users\17_es\AppData\Local\Temp\pip-record-dieg40uq\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\17_es\AppData\Local\Programs\Python\Python35\Include\regex' Check the logs for full command output.

如您所见,它表示已成功构建gpt-2-simple,但未构建正则表达式。我已经试图找到一种解决方案,但是大多数答案都说要获取python3-dev,这不适用于Windows。我该如何解决这个问题?

更新:现在,当我运行文件(使用gpt_2_simple)时,tensorflow.python.util.compat出现了问题-它说它没有属性“ v1”,但是在gpt-2-simple文件中,该行被广泛使用。这是错误:

Traceback (most recent call last):
  File "C:\Users\17_es\OneDrive\Documents\gpt-project\generator.py",line 1,in <module>
    import gpt_2_simple as gpt2
  File "C:\Users\17_es\AppData\Local\Programs\Python\Python35\lib\site-packages\gpt_2_simple\__init__.py",in <module>
    from .gpt_2 import *
  File "C:\Users\17_es\AppData\Local\Programs\Python\Python35\lib\site-packages\gpt_2_simple\gpt_2.py",line 24,in <module>
    from gpt_2_simple.src import model,sample,encoder,memory_saving_gradients
  File "C:\Users\17_es\AppData\Local\Programs\Python\Python35\lib\site-packages\gpt_2_simple\src\memory_saving_gradients.py",line 13,in <module>
    setattr(tf.compat.v1.GraphKeys,"VARIABLES","variables")
AttributeError: module 'tensorflow.python.util.compat' has no attribute 'v1'

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...