Closed Anagabrielamantilla closed 2 weeks ago
Hi, I might have introduced a bug in the dev version .... Is the error also showing up in the released version?
pip uninstall vedo
pip install vedo -U
it did not work. I got this error now:
ImportError: cannot import name 'Volume' from 'vedo' (unknown location)
I think there must be something else going wrong there.. you should post a minimal script with the complete error message, e.g
from vedo import Volume
vol= Volume()
print(vol)
Does it work from command line eg.
vedo --run numpy2volume0
sure, here is my complete code:
import numpy as np
from vedo import Volume
from vedo.applications import Slicer3DPlotter
import matplotlib.pyplot as plt
f = open('data.bin', 'rb')
content = f.read()
f.close()
data = np.frombuffer(content, np.float32)
print(data)
data_3d = data.reshape((200,200,700),order='F')
vol = Volume(data_3d)
plot3D = Slicer3DPlotter(vol)
plot3D.show()
I have numpy 1.26.4, vedo 2024.5.1 and matplotlib 3.8.4
You did not show the exact error message. Can you reproduce this?
import numpy as np
from vedo import Volume
from vedo.applications import Slicer3DPlotter
data = np.zeros([70, 80, 90], dtype=np.uint8)
data[ 0:30, 0:30, 0:30] = 1
data[30:50, 30:60, 30:70] = 2
data[50:70, 60:80, 70:90] = 3
vol = Volume(data)
plot3D = Slicer3DPlotter(vol)
plot3D.show()
I reproduced your code in spyder with vedo 2024.5.1 and I get the following error:
AttributeError: 'NoneType' object has no attribute 'pos'
If I use:
pip uninstall vedo
pip install vedo -U
and run the same code with spyder I get the following error: ImportError: cannot import name 'Volume' from 'vedo' (unknown location)
The second error message points to a problem in your anaconda installation. I just run the above script in a spyder version 5 console and it runs normally..
Let me know if need further help on this. I'm closing the issue for the moment.
Hi, I installed vedo2024.5.1+dev14 a I was trying to do a 3D plot. However, I got this error:
AttributeError: 'NoneType' object has no attribute 'pos'
If I run my script from anaconda prompt the plot showed without problems, but if I use an IDE as spyder or visual studio code the error appears. The specific line where the error appears is:
plot3D = Slicer3DPlotter(vol)
plt.show()
Can you please help me to fix the error? I am using anaconda on Windows 11