arrayfire-python icon indicating copy to clipboard operation
arrayfire-python copied to clipboard

Bugs in graphics functions

Open itsnarsi opened this issue 7 years ago • 14 comments

This my code: ` X = af.image.load_image(F[0],is_color=True)

win = af.Window(1280, 768, "imshow") win.image(X) `

It is throwing following error:


AttributeError Traceback (most recent call last) in () ----> 1 win.image(X)

/home/narsi/anaconda3/lib/python3.5/site-packages/arrayfire-3.5.0-py3.5.egg/arrayfire/graphics.py in image(self, img, title) 139 """ 140 _cell = _Cell(self._r, self._c, title, self._cmap) --> 141 safe_call(backend.get().af_draw_image(self._wnd, img.arr, c_pointer(_cell))) 142 143 def scatter(self, X, Y, Z=None, points=None, marker=MARKER.POINT, title=None):

/home/narsi/anaconda3/lib/python3.5/site-packages/arrayfire-3.5.0-py3.5.egg/arrayfire/util.py in safe_call(af_error) 77 err_len = c_dim_t(0) 78 backend.get().af_get_last_error(c_pointer(err_str), c_pointer(err_len)) ---> 79 raise RuntimeError(to_str(err_str)) 80 81 def get_version():

/home/narsi/anaconda3/lib/python3.5/site-packages/arrayfire-3.5.0-py3.5.egg/arrayfire/util.py in to_str(c_str) 70 71 def to_str(c_str): ---> 72 return str(c_str.value.decode('utf-8')) 73 74 def safe_call(af_error):

AttributeError: 'NoneType' object has no attribute 'decode'

Getting same error with fractal example too.

itsnarsi avatar Dec 06 '16 22:12 itsnarsi

@itsnarsi can you check if you can run the histogram example ? https://github.com/arrayfire/arrayfire-python/blob/devel/examples/graphics/histogram.py

pavanky avatar Dec 06 '16 23:12 pavanky

It is throwing following error:

Traceback (most recent call last): File "histogram.py", line 19, in raise RuntimeError("Expected to the image as the first argument") RuntimeError: Expected to the image as the first argument

itsnarsi avatar Dec 06 '16 23:12 itsnarsi

@itsnarsi thanks I'll look into it in a few hours.

pavanky avatar Dec 06 '16 23:12 pavanky

@itsnarsi Sorry about the delay. I tried both native python3 and python2 (I don't have access to anaconda). The code seems to work.

Can you print the output of af.info()?

pavanky avatar Dec 14 '16 06:12 pavanky

@itsnarsi can you also run the your program by setting the following environment variable:

AF_PRINT_ERRORS=1 python /path/to/example.py

pavanky avatar Dec 14 '16 06:12 pavanky

Hey @pavanky Sorry for the long delay.I was on a holiday trip and totally forgot about it.

Out of al.info():

af.info() ArrayFire v3.3.2 (OpenCL, 64-bit Linux, build f65dd97) [0] NVIDIA : GeForce 840M, 2002 MB

AF_PRINT_ERRORS=1 python /path/to/example.py

Traceback (most recent call last): File "loadimg.py", line 6, in win.image(X) File "/home/narsi/anaconda3/lib/python3.5/site-packages/arrayfire-3.5.0-py3.5.egg/arrayfire/graphics.py", line 141, in image safe_call(backend.get().af_draw_image(self._wnd, img.arr, c_pointer(_cell))) File "/home/narsi/anaconda3/lib/python3.5/site-packages/arrayfire-3.5.0-py3.5.egg/arrayfire/util.py", line 79, in safe_call raise RuntimeError(to_str(err_str)) File "/home/narsi/anaconda3/lib/python3.5/site-packages/arrayfire-3.5.0-py3.5.egg/arrayfire/util.py", line 72, in to_str return str(c_str.value.decode('utf-8')) AttributeError: 'NoneType' object has no attribute 'decode'

itsnarsi avatar Feb 02 '17 12:02 itsnarsi

@itsnarsi You are using arrayfire 3.3.2 libs. can you update to 3.4.2 ?

Can you also test with regular python instead of anaconda?

pavanky avatar Feb 02 '17 16:02 pavanky

@pavanky After update my code started working without any problem in regular python and anaconda. But histogram.py is still giving the same error. And plot3.py is giving following error:

[0] NVIDIA : GeForce 840M, 2002 MB Traceback (most recent call last): File "plot3.py", line 32, in win.plot3(Pts) File "/home/narsi/anaconda3/lib/python3.5/site-packages/arrayfire-3.5.0-py3.5.egg/arrayfire/graphics.py", line 296, in plot3 assert(line.numdims() == 3) AttributeError: 'NoneType' object has no attribute 'numdims'

itsnarsi avatar Feb 02 '17 22:02 itsnarsi

@itsnarsi Is the histogram issue resolved or did you close the issue because your original issue is resolved?

pavanky avatar Feb 06 '17 21:02 pavanky

@pavanky Cause my original and histogram issue is resolved. But plot3.py is still persistent.

itsnarsi avatar Feb 06 '17 21:02 itsnarsi

I am reopening the issue with a different name :)

I'll close if everything is resolved.

pavanky avatar Feb 06 '17 21:02 pavanky

I've been getting the same error as described above when trying to run the plot3.py example. Below is output.

$ python plot3.py 
ArrayFire v3.5.1 (CUDA, 64-bit Linux, build 0a675e8)
Platform: CUDA Toolkit 8, Driver: 384.90
[0] GeForce GTX 770M, 3018 MB, CUDA Compute 3.0
-1- GeForce GTX 770M, 3017 MB, CUDA Compute 3.0
Traceback (most recent call last):
  File "plot3.py", line 32, in <module>
    win.plot3(Pts)
  File "/usr/local/lib/python2.7/dist-packages/arrayfire-3.6.0-py2.7.egg/arrayfire/graphics.py", line 296, in plot3
    assert(line.numdims() == 3)
AttributeError: 'NoneType' object has no attribute 'numdims'

nanophd avatar Nov 03 '17 16:11 nanophd

I am getting similar error. No idea on how to debug it. Any help?

eli@jc-acer:~/gitee/arrayfire-python/examples/computer_vision$ AF_PRINT_ERRORS=1 python test.py 
ArrayFire v3.9.0 (CUDA, 64-bit Linux, build da1ae517)
Platform: CUDA Runtime 11.5, Driver: 510.47.03
[0] NVIDIA GeForce GTX 1060, 6079 MB, CUDA Compute 6.1
run win.image
Segmentation fault (core dumped)
eli@jc-acer:~/gitee/arrayfire-python/examples/computer_vision$ cat test.py 
import arrayfire as af
af.info()
X = af.image.load_image("cat.jpg")
win = af.Window(1280,760, "imshow")
print("run win.image")
win.image(X)
eli@jc-acer:~/gitee/arrayfire-python/examples/computer_vision$ 

3togo avatar Apr 06 '22 13:04 3togo

problem fixed after installing forge

3togo avatar Apr 07 '22 04:04 3togo