Apr-16-2020, 11:35 AM
Greetings, i wonder if anyone could help me to solve the following problem with python and following libraries: numpy, cv2, ctypes, pywin32 as they seem to conflict.
The stroy goes as follows: i always had cv2 with numpy on my machine in a system wide python installation, and i'm pretty sure i had pywin32 as well. However after downloading ctypes all of the above libraries suddenly
started to error in their init files mostly telling that the import of "windll" kept on failing. After a closer look at the isue i came across this post on github stating that ctypes could need to be "activated" by executing the postinstall file
in ctypes directory. After that windll succesefully apeared, however the lower and uppercase letters seem to differ from what numpy tried to import. and following that the ctypes directory immideatly went to previos state with no windll
after console session was closed from the cmd by typing quit(). At this point keeping ctypes is not important as i need to recover my previos projects. The following actions were already taken by me: Full python & packages reinstall [pip cache cleared],
making fully independednt virtual enviroment, removing packages and reinstalling cv2 and numpy with pip --force-reinstall, windows recovery and the only code that was attempted with the usage of ctypes related libraries was the following
'''
which interestingly enough never cleared the console and thus on every console output the following appears:
dbg success
displayname: clsid:A3189FC5-BA37-4EF5-BC41-102A87B07C00:
displayname: clsid:E0EC0F2B-773D-4DD7-BE6C-7D85D6AA6269:
displayname: !Personal-Monikers::FileSyncClient
displayname: !Personal-Monikers::ToastActivation
displayname: !Personal-Monikers::SyncEngineStorageProviderHandlerProxy
displayname: !Personal-Monikers::SyncEngineCOMServer
whether this actually affects anyhting im not sure, its usefull to mention that just for this script another editor was used called sublime text 3.
Besides, thats the error i keep on recieving:
The stroy goes as follows: i always had cv2 with numpy on my machine in a system wide python installation, and i'm pretty sure i had pywin32 as well. However after downloading ctypes all of the above libraries suddenly
started to error in their init files mostly telling that the import of "windll" kept on failing. After a closer look at the isue i came across this post on github stating that ctypes could need to be "activated" by executing the postinstall file
in ctypes directory. After that windll succesefully apeared, however the lower and uppercase letters seem to differ from what numpy tried to import. and following that the ctypes directory immideatly went to previos state with no windll
after console session was closed from the cmd by typing quit(). At this point keeping ctypes is not important as i need to recover my previos projects. The following actions were already taken by me: Full python & packages reinstall [pip cache cleared],
making fully independednt virtual enviroment, removing packages and reinstalling cv2 and numpy with pip --force-reinstall, windows recovery and the only code that was attempted with the usage of ctypes related libraries was the following
'''
import pythoncom import win32com.client print("dbg success") #must be 0 deal with it context = pythoncom.CreateBindCtx(0) #getting the objects running_coms = pythoncom.GetRunningObjectTable() #making an enum monikers = running_coms.EnumRunning() for element in monikers: print(f"displayname: {element.GetDisplayName(context, element)}")
`which interestingly enough never cleared the console and thus on every console output the following appears:
`dbg success
displayname: clsid:A3189FC5-BA37-4EF5-BC41-102A87B07C00:
displayname: clsid:E0EC0F2B-773D-4DD7-BE6C-7D85D6AA6269:
displayname: !Personal-Monikers::FileSyncClient
displayname: !Personal-Monikers::ToastActivation
displayname: !Personal-Monikers::SyncEngineStorageProviderHandlerProxy
displayname: !Personal-Monikers::SyncEngineCOMServer
` whether this actually affects anyhting im not sure, its usefull to mention that just for this script another editor was used called sublime text 3.
Besides, thats the error i keep on recieving:
`Error:Traceback (most recent call last):
File "homework.py", line 1, in <module>
import numpy as np
File "C:\Users\grass\EE_CS\lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import _distributor_init
File "C:\Users\grass\EE_CS\lib\site-packages\numpy\_distributor_init.py", line 9, in <module>
from ctypes import WinDLL
ImportError: cannot import name 'WinDLL'
`