I try to install asyncio for python but it is failed I don't know if the failure is "overlapped.c:68: error: 'PyExc_ConnectionRefusedError' undeclared" or "error: command 'c:\mingw\bin\gcc.exe' failed with exit status 1" and what the solution...
the command:
C:\Users\AA>pip install asyncio
the output:
Collecting asyncio
Using cached asyncio-3.4.3.tar.gz
Installing collected packages: asyncio
Running setup.py install for asyncio ... error
Complete output from command C:\Python27\python.exe -u -c "import setuptools
, tokenize;__file__='c:\\users\\ait\\appdata\\local\\temp\\pip-build-eucukh\\asy
ncio\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replac
e('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --recor
d c:\users\ait\appdata\local\temp\pip-4yjfsw-record\install-record.txt --single-
version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-2.7
creating build\lib.win32-2.7\asyncio
copying asyncio\base_events.py -> build\lib.win32-2.7\asyncio
copying asyncio\base_subprocess.py -> build\lib.win32-2.7\asyncio
copying asyncio\constants.py -> build\lib.win32-2.7\asyncio
copying asyncio\coroutines.py -> build\lib.win32-2.7\asyncio
copying asyncio\events.py -> build\lib.win32-2.7\asyncio
copying asyncio\futures.py -> build\lib.win32-2.7\asyncio
copying asyncio\locks.py -> build\lib.win32-2.7\asyncio
copying asyncio\log.py -> build\lib.win32-2.7\asyncio
copying asyncio\proactor_events.py -> build\lib.win32-2.7\asyncio
copying asyncio\protocols.py -> build\lib.win32-2.7\asyncio
copying asyncio\queues.py -> build\lib.win32-2.7\asyncio
copying asyncio\selectors.py -> build\lib.win32-2.7\asyncio
copying asyncio\selector_events.py -> build\lib.win32-2.7\asyncio
copying asyncio\sslproto.py -> build\lib.win32-2.7\asyncio
copying asyncio\streams.py -> build\lib.win32-2.7\asyncio
copying asyncio\subprocess.py -> build\lib.win32-2.7\asyncio
copying asyncio\tasks.py -> build\lib.win32-2.7\asyncio
copying asyncio\test_support.py -> build\lib.win32-2.7\asyncio
copying asyncio\test_utils.py -> build\lib.win32-2.7\asyncio
copying asyncio\transports.py -> build\lib.win32-2.7\asyncio
copying asyncio\unix_events.py -> build\lib.win32-2.7\asyncio
copying asyncio\windows_events.py -> build\lib.win32-2.7\asyncio
copying asyncio\windows_utils.py -> build\lib.win32-2.7\asyncio
copying asyncio\__init__.py -> build\lib.win32-2.7\asyncio
running build_ext
building 'asyncio._overlapped' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
c:\mingw\bin\gcc.exe -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -
c overlapped.c -o build\temp.win32-2.7\Release\overlapped.o
overlapped.c: In function 'SetFromWindowsErr':
overlapped.c:68: error: 'PyExc_ConnectionRefusedError' undeclared (first use
in this function)
overlapped.c:68: error: (Each undeclared identifier is reported only once
overlapped.c:68: error: for each function it appears in.)
overlapped.c:71: error: 'PyExc_ConnectionAbortedError' undeclared (first use
in this function)
overlapped.c: At top level:
overlapped.c:83: error: expected '=', ',', ';', 'asm' or '__attribute__' bef
ore 'Py_AcceptEx'
overlapped.c:84: error: expected '=', ',', ';', 'asm' or '__attribute__' bef
ore 'Py_ConnectEx'
overlapped.c:85: error: expected '=', ',', ';', 'asm' or '__attribute__' bef
ore 'Py_DisconnectEx'
overlapped.c: In function 'initialize_function_pointers':
overlapped.c:96: error: 'WSAID_ACCEPTEX' undeclared (first use in this funct
ion)
overlapped.c:97: error: 'WSAID_CONNECTEX' undeclared (first use in this func
tion)
overlapped.c:98: error: 'WSAID_DISCONNECTEX' undeclared (first use in this f
unction)
overlapped.c:109: error: 'Py_AcceptEx' undeclared (first use in this functio
n)
overlapped.c:110: error: 'Py_ConnectEx' undeclared (first use in this functi
on)
overlapped.c:111: error: 'Py_DisconnectEx' undeclared (first use in this fun
ction)
overlapped.c: In function 'overlapped_RegisterWaitWithQueue':
overlapped.c:271: warning: implicit declaration of function 'RegisterWaitFor
SingleObject'
overlapped.c:272: error: 'WAITORTIMERCALLBACK' undeclared (first use in this
function)
overlapped.c:272: error: expected ')' before 'PostToQueueCallback'
overlapped.c: In function 'overlapped_UnregisterWait':
overlapped.c:298: warning: implicit declaration of function 'UnregisterWait'
overlapped.c: In function 'overlapped_UnregisterWaitEx':
overlapped.c:321: warning: implicit declaration of function 'UnregisterWaitE
x'
overlapped.c: In function 'Overlapped_dealloc':
overlapped.c:580: warning: unknown conversion type character 'R' in format
overlapped.c:580: warning: too many arguments for format
overlapped.c: In function 'Overlapped_ReadFile':
overlapped.c:714: warning: implicit declaration of function 'Py_MIN'
overlapped.c:716: warning: implicit declaration of function 'Py_MAX'
overlapped.c: In function 'Overlapped_AcceptEx':
overlapped.c:948: warning: implicit declaration of function 'Py_AcceptEx'
overlapped.c: In function 'Overlapped_ConnectEx':
overlapped.c:1035: warning: implicit declaration of function 'Py_ConnectEx'
overlapped.c: In function 'Overlapped_DisconnectEx':
overlapped.c:1075: warning: implicit declaration of function 'Py_DisconnectE
x'
overlapped.c: In function 'ConnectPipe':
overlapped.c:1145: warning: implicit declaration of function 'PyUnicode_AsWi
deCharString'
overlapped.c:1145: warning: assignment makes pointer from integer without a
cast
overlapped.c: At top level:
overlapped.c:1287: error: variable 'overlapped_module' has initializer but i
ncomplete type
overlapped.c:1288: error: 'PyModuleDef_HEAD_INIT' undeclared here (not in a
function)
overlapped.c:1288: warning: excess elements in struct initializer
overlapped.c:1288: warning: (near initialization for 'overlapped_module')
overlapped.c:1289: warning: excess elements in struct initializer
overlapped.c:1289: warning: (near initialization for 'overlapped_module')
overlapped.c:1290: warning: excess elements in struct initializer
overlapped.c:1290: warning: (near initialization for 'overlapped_module')
overlapped.c:1291: warning: excess elements in struct initializer
overlapped.c:1291: warning: (near initialization for 'overlapped_module')
overlapped.c:1292: warning: excess elements in struct initializer
overlapped.c:1292: warning: (near initialization for 'overlapped_module')
overlapped.c:1293: warning: excess elements in struct initializer
overlapped.c:1293: warning: (near initialization for 'overlapped_module')
overlapped.c:1294: warning: excess elements in struct initializer
overlapped.c:1294: warning: (near initialization for 'overlapped_module')
overlapped.c:1295: warning: excess elements in struct initializer
overlapped.c:1295: warning: (near initialization for 'overlapped_module')
overlapped.c:1297: warning: excess elements in struct initializer
overlapped.c:1297: warning: (near initialization for 'overlapped_module')
overlapped.c: In function 'PyInit__overlapped':
overlapped.c:1310: warning: 'return' with a value, in function returning voi
d
overlapped.c:1314: warning: 'return' with a value, in function returning voi
d
overlapped.c:1317: warning: 'return' with a value, in function returning voi
d
overlapped.c:1319: warning: implicit declaration of function 'PyModule_Creat
e'
overlapped.c:1319: warning: assignment makes pointer from integer without a
cast
overlapped.c:1321: warning: 'return' with a value, in function returning voi
d
overlapped.c:1333: error: 'SO_UPDATE_CONNECT_CONTEXT' undeclared (first use
in this function)
overlapped.c:1336: warning: 'return' with a value, in function returning voi
d
error: command 'c:\\mingw\\bin\\gcc.exe' failed with exit status 1
----------------------------------------
Command "C:\Python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\
\users\\ait\\appdata\\local\\temp\\pip-build-eucukh\\asyncio\\setup.py';f=getatt
r(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close(
);exec(compile(code, __file__, 'exec'))" install --record c:\users\ait\appdata\l
ocal\temp\pip-4yjfsw-record\install-record.txt --single-version-externally-manag
ed --compile" failed with error code 1 in c:\users\ait\appdata\local\temp\pip-bu
ild-eucukh\asyncio\
when I try to install trollius, I get this error:
C:\Users\Administrator\Downloads\trollius-2.1>c:\Python27\python.exe setup.py bdist_wheel upload
!!! WARNING !!! The Trollius project is now deprecated!
running bdist_wheel
running build
running build_py/
running build_ext
building 'trollius._overlapped' extension
c:\mingw\bin\gcc.exe -mdll -O -Wall -Ic:\Python27\include -Ic:\Python27\PC -c overlapped.c -o build\temp.win32-2.7\
Release\overlapped.o
overlapped.c:99: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Py_AcceptEx'
overlapped.c:100: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Py_ConnectEx'
overlapped.c:101: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Py_DisconnectEx'
overlapped.c: In function 'initialize_function_pointers':
overlapped.c:112: error: 'WSAID_ACCEPTEX' undeclared (first use in this function)
overlapped.c:112: error: (Each undeclared identifier is reported only once
overlapped.c:112: error: for each function it appears in.)
overlapped.c:113: error: 'WSAID_CONNECTEX' undeclared (first use in this function)
overlapped.c:114: error: 'WSAID_DISCONNECTEX' undeclared (first use in this function)
overlapped.c:125: error: 'Py_AcceptEx' undeclared (first use in this function)
overlapped.c:126: error: 'Py_ConnectEx' undeclared (first use in this function)
overlapped.c:127: error: 'Py_DisconnectEx' undeclared (first use in this function)
overlapped.c: In function 'overlapped_RegisterWaitWithQueue':
overlapped.c:287: warning: implicit declaration of function 'RegisterWaitForSingleObject'
overlapped.c:288: error: 'WAITORTIMERCALLBACK' undeclared (first use in this function)
overlapped.c:288: error: expected ')' before 'PostToQueueCallback'
overlapped.c: In function 'overlapped_UnregisterWait':
overlapped.c:314: warning: implicit declaration of function 'UnregisterWait'
overlapped.c: In function 'overlapped_UnregisterWaitEx':
overlapped.c:337: warning: implicit declaration of function 'UnregisterWaitEx'
overlapped.c: In function 'Overlapped_dealloc':
overlapped.c:600: warning: unknown conversion type character 'R' in format
overlapped.c:600: warning: too many arguments for format
overlapped.c: In function 'Overlapped_AcceptEx':
overlapped.c:976: warning: implicit declaration of function 'Py_AcceptEx'
overlapped.c: In function 'Overlapped_ConnectEx':
overlapped.c:1062: warning: implicit declaration of function 'Py_ConnectEx'
overlapped.c: In function 'Overlapped_DisconnectEx':
overlapped.c:1102: warning: implicit declaration of function 'Py_DisconnectEx'
overlapped.c: In function 'ConnectPipe':
overlapped.c:1165: warning: unused variable 'AddressObj'
overlapped.c: In function '_init_overlapped':
overlapped.c:1379: error: 'SO_UPDATE_CONNECT_CONTEXT' undeclared (first use in this function)
error: command 'c:\\mingw\\bin\\gcc.exe' failed with exit status 1
2 Answers
Yes if u want to use asyncio install python3 . Install python3 and make python 3 default by below command
alias python=/usr/bin/python3 Write this command in your ~/.bash_aliases file sudo nano ~/.bash_aliases This will automatically set python path to python 3 when u open ur terminal
asyncio is a built-in package in python 3, and it is not available in python 2, not even through pip installing. If you seriously need to use coroutines, it’s time to switch to using python 3.
Other then that, there is also a port of asyncio for python 2 called trollius, you can use that if you want (still usable, but now deprecated). But I still recommend updating to python 3.
As you can see, the package you’re installing , is for python 3.3+ that doesn’t have asyncio pre-installed, not meant as a replacement for asyncio in python 2.