Ask Your Question

py-opencv import error in Bash for Windows 10

asked 2016-10-06 18:42:53 -0500

ajayramesh gravatar image


I installed py-opencv using the following command on Bash for Windows 10:

conda install -c conda-forge opencv

I try importing cv2 in my Python3 interpreter and get the following error:

ImportError: cannot enable executable stack as shared object requires: Invalid argument

This works fine in regular Ubuntu but for some reason it doesn't work in Bash for Windows 10. If anyone has a work around it would be much appreciated!

edit retag flag offensive close merge delete



Hmm keep in mind that bash and windows 10 are still not fully functional and does not provide the same functionality as in Ubuntu. That is why installing OpenCV in Windows is done in a different manner!

StevenPuttemans gravatar imageStevenPuttemans ( 2016-10-07 04:35:21 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-12-05 20:30:46 -0500

tobyerbailey gravatar image

I have just managed to get this working. The trick was to use execstack to modify the .so files associated with opencv.

This is what I did:

  1. sudo apt-get install execstack
  2. sudo /usr/sbin/execstack -c /usr/local/lib/libopen.s i.e. modify all the opencv .so files

That seemed to do the trick for me with opencv 3.1.0

edit flag offensive delete link more


here is the actual command sudo /usr/sbin/execstack -c /usr/local/lib/libopencv_* and this works great with 3.2.0 as well

Antony gravatar imageAntony ( 2016-12-28 22:59:28 -0500 )edit

Question Tools



Asked: 2016-10-06 18:42:53 -0500

Seen: 1,814 times

Last updated: Dec 05 '16