Import errors with cv2 on python
I am unable to import cv2 on either python2 or python3
when I call in python2 I get the following error
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: numpy.core.multiarray failed to import
and when I call in python3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/local/lib/python3.5/dist-packages/cv2.so: undefined
symbol: PyCObject_Type
I know it has something to do with the path and When I use the >>> print(sys.path) I get the following
['', '/home/nvidia/Downloads', '/usr/local/lib',
'/usr/local/lib/python3.5/dist-packages', '/usr/local/lib/cv2.po',
'//home/nvidia/src/opencv-3.4.2/build/lib/cv2.so',
'/home/nvidia/src/opencv-3.4.2/build/lib/cv2.so',
'/usr/local/lib/python3.5/dist-packages/cv2.so',
'/usr/lib/python35.zip', '/usr/lib/python3.5',
'/usr/lib/python3.5/plat-aarch64-linux-gnu', '/usr/lib/python3.5/lib-
dynload', '/usr/lib/python3/dist-packages']
I'm certain I have to remove some of the above paths but I do no want to risk anything without being sure. For the record I am using the Jetson TX2
Edit: attempted to fix the problem by updating numpy but the error persisted
Edit#2: These are the versions of numpy that I currently have install
python -c "import numpy; print(numpy.version.version)" 1.15.4
python3 -c "import numpy; print(numpy.version.version)" 1.15.4
python opencv python-import
|
show 2 more comments
I am unable to import cv2 on either python2 or python3
when I call in python2 I get the following error
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: numpy.core.multiarray failed to import
and when I call in python3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/local/lib/python3.5/dist-packages/cv2.so: undefined
symbol: PyCObject_Type
I know it has something to do with the path and When I use the >>> print(sys.path) I get the following
['', '/home/nvidia/Downloads', '/usr/local/lib',
'/usr/local/lib/python3.5/dist-packages', '/usr/local/lib/cv2.po',
'//home/nvidia/src/opencv-3.4.2/build/lib/cv2.so',
'/home/nvidia/src/opencv-3.4.2/build/lib/cv2.so',
'/usr/local/lib/python3.5/dist-packages/cv2.so',
'/usr/lib/python35.zip', '/usr/lib/python3.5',
'/usr/lib/python3.5/plat-aarch64-linux-gnu', '/usr/lib/python3.5/lib-
dynload', '/usr/lib/python3/dist-packages']
I'm certain I have to remove some of the above paths but I do no want to risk anything without being sure. For the record I am using the Jetson TX2
Edit: attempted to fix the problem by updating numpy but the error persisted
Edit#2: These are the versions of numpy that I currently have install
python -c "import numpy; print(numpy.version.version)" 1.15.4
python3 -c "import numpy; print(numpy.version.version)" 1.15.4
python opencv python-import
1
Possible duplicate of ImportError: numpy.core.multiarray failed to import
– Agile_Eagle
Nov 14 '18 at 17:17
After following the solution from the aforementioned problem, my error still persisted
– acceptablesimple7
Nov 14 '18 at 17:30
Please can you check what versions of numpy you are using following the instructions here stackoverflow.com/a/1520264/9794932 and edit this into your post. For both python 2 and python 3, and tell us which is which. Thanks!
– Rob Bricheno
Nov 14 '18 at 18:14
I just updated the post based on what you suggested
– acceptablesimple7
Nov 15 '18 at 0:11
It seems that you have two different problems. Firstly you have installed OpenCV for Python2 successfully, but thenumpy
libraries were not found while installation. Secondly, You haven't installed OpenCV forPyhton3
, hence thecv2.so not found
error. While installing OpenCV you have to specify the Python version you want to install the library for. It does not gets installed for both version simultaneoulsy. I think you have followed the instructions for installing OpenCV onPython2
but missed thenumpy
step.
– ZdaR
Nov 15 '18 at 5:43
|
show 2 more comments
I am unable to import cv2 on either python2 or python3
when I call in python2 I get the following error
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: numpy.core.multiarray failed to import
and when I call in python3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/local/lib/python3.5/dist-packages/cv2.so: undefined
symbol: PyCObject_Type
I know it has something to do with the path and When I use the >>> print(sys.path) I get the following
['', '/home/nvidia/Downloads', '/usr/local/lib',
'/usr/local/lib/python3.5/dist-packages', '/usr/local/lib/cv2.po',
'//home/nvidia/src/opencv-3.4.2/build/lib/cv2.so',
'/home/nvidia/src/opencv-3.4.2/build/lib/cv2.so',
'/usr/local/lib/python3.5/dist-packages/cv2.so',
'/usr/lib/python35.zip', '/usr/lib/python3.5',
'/usr/lib/python3.5/plat-aarch64-linux-gnu', '/usr/lib/python3.5/lib-
dynload', '/usr/lib/python3/dist-packages']
I'm certain I have to remove some of the above paths but I do no want to risk anything without being sure. For the record I am using the Jetson TX2
Edit: attempted to fix the problem by updating numpy but the error persisted
Edit#2: These are the versions of numpy that I currently have install
python -c "import numpy; print(numpy.version.version)" 1.15.4
python3 -c "import numpy; print(numpy.version.version)" 1.15.4
python opencv python-import
I am unable to import cv2 on either python2 or python3
when I call in python2 I get the following error
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: numpy.core.multiarray failed to import
and when I call in python3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/local/lib/python3.5/dist-packages/cv2.so: undefined
symbol: PyCObject_Type
I know it has something to do with the path and When I use the >>> print(sys.path) I get the following
['', '/home/nvidia/Downloads', '/usr/local/lib',
'/usr/local/lib/python3.5/dist-packages', '/usr/local/lib/cv2.po',
'//home/nvidia/src/opencv-3.4.2/build/lib/cv2.so',
'/home/nvidia/src/opencv-3.4.2/build/lib/cv2.so',
'/usr/local/lib/python3.5/dist-packages/cv2.so',
'/usr/lib/python35.zip', '/usr/lib/python3.5',
'/usr/lib/python3.5/plat-aarch64-linux-gnu', '/usr/lib/python3.5/lib-
dynload', '/usr/lib/python3/dist-packages']
I'm certain I have to remove some of the above paths but I do no want to risk anything without being sure. For the record I am using the Jetson TX2
Edit: attempted to fix the problem by updating numpy but the error persisted
Edit#2: These are the versions of numpy that I currently have install
python -c "import numpy; print(numpy.version.version)" 1.15.4
python3 -c "import numpy; print(numpy.version.version)" 1.15.4
python opencv python-import
python opencv python-import
edited Nov 15 '18 at 0:11
acceptablesimple7
asked Nov 14 '18 at 17:15
acceptablesimple7acceptablesimple7
235
235
1
Possible duplicate of ImportError: numpy.core.multiarray failed to import
– Agile_Eagle
Nov 14 '18 at 17:17
After following the solution from the aforementioned problem, my error still persisted
– acceptablesimple7
Nov 14 '18 at 17:30
Please can you check what versions of numpy you are using following the instructions here stackoverflow.com/a/1520264/9794932 and edit this into your post. For both python 2 and python 3, and tell us which is which. Thanks!
– Rob Bricheno
Nov 14 '18 at 18:14
I just updated the post based on what you suggested
– acceptablesimple7
Nov 15 '18 at 0:11
It seems that you have two different problems. Firstly you have installed OpenCV for Python2 successfully, but thenumpy
libraries were not found while installation. Secondly, You haven't installed OpenCV forPyhton3
, hence thecv2.so not found
error. While installing OpenCV you have to specify the Python version you want to install the library for. It does not gets installed for both version simultaneoulsy. I think you have followed the instructions for installing OpenCV onPython2
but missed thenumpy
step.
– ZdaR
Nov 15 '18 at 5:43
|
show 2 more comments
1
Possible duplicate of ImportError: numpy.core.multiarray failed to import
– Agile_Eagle
Nov 14 '18 at 17:17
After following the solution from the aforementioned problem, my error still persisted
– acceptablesimple7
Nov 14 '18 at 17:30
Please can you check what versions of numpy you are using following the instructions here stackoverflow.com/a/1520264/9794932 and edit this into your post. For both python 2 and python 3, and tell us which is which. Thanks!
– Rob Bricheno
Nov 14 '18 at 18:14
I just updated the post based on what you suggested
– acceptablesimple7
Nov 15 '18 at 0:11
It seems that you have two different problems. Firstly you have installed OpenCV for Python2 successfully, but thenumpy
libraries were not found while installation. Secondly, You haven't installed OpenCV forPyhton3
, hence thecv2.so not found
error. While installing OpenCV you have to specify the Python version you want to install the library for. It does not gets installed for both version simultaneoulsy. I think you have followed the instructions for installing OpenCV onPython2
but missed thenumpy
step.
– ZdaR
Nov 15 '18 at 5:43
1
1
Possible duplicate of ImportError: numpy.core.multiarray failed to import
– Agile_Eagle
Nov 14 '18 at 17:17
Possible duplicate of ImportError: numpy.core.multiarray failed to import
– Agile_Eagle
Nov 14 '18 at 17:17
After following the solution from the aforementioned problem, my error still persisted
– acceptablesimple7
Nov 14 '18 at 17:30
After following the solution from the aforementioned problem, my error still persisted
– acceptablesimple7
Nov 14 '18 at 17:30
Please can you check what versions of numpy you are using following the instructions here stackoverflow.com/a/1520264/9794932 and edit this into your post. For both python 2 and python 3, and tell us which is which. Thanks!
– Rob Bricheno
Nov 14 '18 at 18:14
Please can you check what versions of numpy you are using following the instructions here stackoverflow.com/a/1520264/9794932 and edit this into your post. For both python 2 and python 3, and tell us which is which. Thanks!
– Rob Bricheno
Nov 14 '18 at 18:14
I just updated the post based on what you suggested
– acceptablesimple7
Nov 15 '18 at 0:11
I just updated the post based on what you suggested
– acceptablesimple7
Nov 15 '18 at 0:11
It seems that you have two different problems. Firstly you have installed OpenCV for Python2 successfully, but the
numpy
libraries were not found while installation. Secondly, You haven't installed OpenCV for Pyhton3
, hence the cv2.so not found
error. While installing OpenCV you have to specify the Python version you want to install the library for. It does not gets installed for both version simultaneoulsy. I think you have followed the instructions for installing OpenCV on Python2
but missed the numpy
step.– ZdaR
Nov 15 '18 at 5:43
It seems that you have two different problems. Firstly you have installed OpenCV for Python2 successfully, but the
numpy
libraries were not found while installation. Secondly, You haven't installed OpenCV for Pyhton3
, hence the cv2.so not found
error. While installing OpenCV you have to specify the Python version you want to install the library for. It does not gets installed for both version simultaneoulsy. I think you have followed the instructions for installing OpenCV on Python2
but missed the numpy
step.– ZdaR
Nov 15 '18 at 5:43
|
show 2 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305541%2fimport-errors-with-cv2-on-python%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305541%2fimport-errors-with-cv2-on-python%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Possible duplicate of ImportError: numpy.core.multiarray failed to import
– Agile_Eagle
Nov 14 '18 at 17:17
After following the solution from the aforementioned problem, my error still persisted
– acceptablesimple7
Nov 14 '18 at 17:30
Please can you check what versions of numpy you are using following the instructions here stackoverflow.com/a/1520264/9794932 and edit this into your post. For both python 2 and python 3, and tell us which is which. Thanks!
– Rob Bricheno
Nov 14 '18 at 18:14
I just updated the post based on what you suggested
– acceptablesimple7
Nov 15 '18 at 0:11
It seems that you have two different problems. Firstly you have installed OpenCV for Python2 successfully, but the
numpy
libraries were not found while installation. Secondly, You haven't installed OpenCV forPyhton3
, hence thecv2.so not found
error. While installing OpenCV you have to specify the Python version you want to install the library for. It does not gets installed for both version simultaneoulsy. I think you have followed the instructions for installing OpenCV onPython2
but missed thenumpy
step.– ZdaR
Nov 15 '18 at 5:43