JeffH
JeffH

Reputation: 21

Numpy - ImportError: cannot import name shares_memory

I'm going to preface this by saying that I'm relatively new to Python and so please forgive me if I have difficulty understanding something.

I've recently been trying to install OpenCV on my computer following the "Installing OpenCV from prebuilt binaries" instructions found here:

http://docs.opencv.org/3.1.0/d5/de5/tutorial_py_setup_in_windows.html#gsc.tab=0

I initially tried to install OpenCV by itself, as I already had Python 3.5 and a working version of numpy. However, my attempts to import cv2 failed, and I eventually decided to uninstall Python and follow all the steps listed on the website. However, I now have this error when I try import numpy:

Traceback (most recent call last):
  File "C:/PythonProgramming/SLIC/src/SLICAlgorithm.py", line 1, in <module>
    import numpy
  File "C:\Python27\lib\site-packages\numpy\__init__.py", line 180, in <module>
    from . import add_newdocs
  File "C:\Python27\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "C:\Python27\lib\site-packages\numpy\lib\__init__.py", line 4, in <module>
    from type_check import *
  File "C:\Python27\lib\site-packages\numpy\lib\type_check.py", line 8, in <module>
    import numpy.core.numeric as _nx
  File "C:\Python27\lib\site-packages\numpy\core\__init__.py", line 20, in <module>
    import function_base
  File "C:\Python27\lib\site-packages\numpy\core\function_base.py", line 6, in <module>
    from .numeric import result_type, NaN, shares_memory, MAY_SHARE_BOUNDS, TooHardError
ImportError: cannot import name shares_memory

Process finished with exit code 1

Other people online seem to have no problem with these instructions, or at least not with numpy. What does this error mean, and what can I do to fix it? I have a 64-bit version of Windows 10 and am working in PyCharm. All help you can provide would be much appreciated.

Upvotes: 1

Views: 5388

Answers (1)

lrn2code
lrn2code

Reputation: 323

same problem, the following fix worked for me

pip install -I numpy --force-reinstall

Upvotes: 2

Related Questions