Open dhabbyc opened 3 years ago
Thanks for the thorough report @dhabbyc but I am unable to reproduce this issue at the moment. Note that I am using an EDM environment and EDM eggs instead of a virtual environment and eggs from PyPI.
> python
Enthought Deployment Manager -- https://www.enthought.com
Python 3.6.12 |Enthought, Inc. (x86_64)| (remotes/origin/update-build-num:20e9974, Sep 16 2020, 22:26:10) [MSC v.1900 64 bit (AMD64)] on win32
>>> import tvtk
>>> from tvtk.tools import visual
>>> visual.vector(1, 2, 3)
MVector([1., 2., 3.])
>>> import numpy
>>> numpy.__version__
'1.17.4'
@rahulporuri you are correct. My mistake, I did not check the code on neither 1.7.x nor 1.4.x (only through documentation).
Nevertheless, I can state that on numpy 1.19.0 the crash occurs:
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tvtk
>>> from tvtk.tools import visual
>>> visual.vector(1,2,3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python36\lib\site-packages\tvtk\tools\visual.py", line 375, in __new__
order = False)
TypeError: order must be str, not bool
>>> import numpy
>>> numpy.__version__
'1.19.0'
>>> import mayavi
>>> mayavi.__version__
'4.7.2'
Nevertheless, I can state that on numpy 1.19.0 the crash occurs:
I can reproduce what you're seeing with python 3.6.12 (via EDM) on windows. Note that I only used pip i.e. pip install numpy==1.19.0
and pip install mayavi
afterwards is what I did to reproduce the issue.
But, I don't see this issue with numpy 1.17.4 (installed using pip)
Enthought Deployment Manager -- https://www.enthought.com
Python 3.6.12 |Enthought, Inc. (x86_64)| (remotes/origin/update-build-num:20e9974, Sep 16 2020, 22:26:10) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from tvtk.tools import visual
>>> visual.vector(1, 2, 3)
MVector([1., 2., 3.])
>>> import mayavi
>>> mayavi.__version__
'4.7.2'
>>> import numpy
>>> numpy.__version__
'1.17.4'
xref https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray
Finally. Looks like mayavi was depending on behavior that was deprecated in numpy in 1.11.0 - which was finally removed in numpy 1.18.0. Ref https://numpy.org/doc/stable/release/1.18.0-notes.html#expired-deprecations
Array order only accepts ‘C’, ‘F’, ‘A’, and ‘K’. More permissive options were deprecated in NumPy 1.11. (https://github.com/numpy/numpy/pull/14596)
Enthought Deployment Manager -- https://www.enthought.com
Python 3.6.12 |Enthought, Inc. (x86_64)| (remotes/origin/update-build-num:20e9974, Sep 16 2020, 22:26:10) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mayavi
>>> mayavi.__version__
'4.7.2'
>>> import numpy
>>> numpy.__version__
'1.18.0'
>>> from tvtk.tools import visual
>>> visual.vector(1, 2, 3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\rporuri\.edm\envs\mayavi-test\lib\site-packages\tvtk\tools\visual.py", line 375, in __new__
order = False)
ValueError: Non-string object detected for the array ordering. Please pass in 'C', 'F', 'A', or 'K' instead
@dhabbyc i updated the issue title to reflect the issue better.
I'm not entirely sure what the right fix is here. I don't know if we can simply remove order
completely or set it to the appropriate values. @prabhuramachandran
I downgraded to NumPy 1.17.5, but the problem persists. Is there an easy solution?
Current version of class constructor `(tvtk.visual.MVector):
The "order" parameter on
numpy.ndarray.__new__
should be "C" or "F" or None, according to numpy's documentation. Current version crashes on any call of tvtk.visual.vector:Tested on Mayavi 4.6.x, 4.7,x using numpy 1.19.x, 1.17.x, 1.14.x on a Python 3.6.8 (windows).