Python Forum
possible ctypes and numpy conflict?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
possible ctypes and numpy conflict?
#1
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


'''
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'
`
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  using ctypes to use a dll in a python module dauriac 3 390 Mar-06-2024, 04:38 PM
Last Post: dauriac
  Trying to debug segfault in ctypes binding to Fortran bthomas 1 608 Sep-01-2023, 11:26 AM
Last Post: bthomas
  ctypes juliolop 7 1,403 Apr-20-2023, 03:33 PM
Last Post: Larz60+
  Folium: Conflict with Font Awesome Kit jgomes_eu 0 1,225 Apr-23-2022, 03:18 PM
Last Post: jgomes_eu
  Issue while using ctypes in python GiggsB 6 2,796 Mar-27-2022, 03:38 AM
Last Post: GiggsB
  Ctypes and libffi.so.7 luxedo 1 6,064 Oct-23-2021, 09:24 PM
Last Post: DeaD_EyE
  How to order the Cronjobs to avoid overlap or conflict sadhaonnisa 1 1,839 Oct-10-2020, 10:26 AM
Last Post: DeaD_EyE
  Python 2.7 Import error. Directory and filename conflict petcoo00 2 2,393 Feb-02-2020, 08:46 PM
Last Post: snippsat
  PyInstaller and RStudio conflict rowdy 2 3,171 Jun-22-2019, 03:19 PM
Last Post: rowdy
  python kernell crash with a ctypes program Jstechg 1 3,502 Nov-24-2018, 02:37 PM
Last Post: Jstechg

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020