Hello,
I recently installed the python3 beta of houdini and I wanted to use pytorch and matplotlib.
After placing all the packages into /install/python/lib/python3.7/site-packages I can call both library without triggering any error.
However the tutorial I was following used matplotlib.pylot to show a graph (pictures). So I call pyplot.imshow() and pyplot.show() and the image shows up in a separate window so I can play around with it.
The issue is that houdini freeze as soon as the figure window opens and even after I close it. My only option is use grep and kill to restart houdini.
Is anyone having the same issue ?
Any help appreciated, thanks.
houdini, python3 and matplotlib
2533 6 3- Edmond BG
- Member
- 45 posts
- Joined: Nov. 2019
- Offline
- canonball900
- Member
- 36 posts
- Joined: Dec. 2016
- Offline
- tshead
- Member
- 62 posts
- Joined: Sept. 2014
- Offline
Try Toyplot, https://toyplot.readthedocs.io [toyplot.readthedocs.io] … it can send your plots to a web browser, and won’t interfere with the Houdini UI.
And yes, I admit it - I’m the original Toyplot developer.
Cheers,
Tim
And yes, I admit it - I’m the original Toyplot developer.
Cheers,
Tim
- Edmond BG
- Member
- 45 posts
- Joined: Nov. 2019
- Offline
- Edmond BG
- Member
- 45 posts
- Joined: Nov. 2019
- Offline
tshead
Try Toyplot, https://toyplot.readthedocs.io [toyplot.readthedocs.io] … it can send your plots to a web browser, and won’t interfere with the Houdini UI.
And yes, I admit it - I’m the original Toyplot developer.
Cheers,
Tim
I used toyplot over week end and it worked great, thanks a lot.
However it seems that calling it from inside a PDG prevent it from creating a window in my browser.
If you have a work around that, that would be great.
I put the hip file in attachment, I moved back to houdini python2 atm and call python3 like canonball900 showed me here [www.sidefx.com].
Thanks again.
- canonball900
- Member
- 36 posts
- Joined: Dec. 2016
- Offline
Here's an implementation of ToyPlot that I tried out and worked for me:
def img_convert(tensor):
image = tensor.cpu().clone().detach().numpy()
image = image.transpose(1, 2, 0)
image = image * np.array((0.5, 0.5, 0.5)) + np.array((0.5, 0.5, 0.5))
image = image.clip(0, 1)
return image
img = Image.open('C:/Users/ryan/Documents/Current_Projects/Houdini_Projects/render/ML_PDG_v006_color.png')
img = transform(img)
img_show = img_convert(img)
canvas, mark = toyplot.image(img_show, width=300)
toyplot.browser.show(canvas)
def img_convert(tensor):
image = tensor.cpu().clone().detach().numpy()
image = image.transpose(1, 2, 0)
image = image * np.array((0.5, 0.5, 0.5)) + np.array((0.5, 0.5, 0.5))
image = image.clip(0, 1)
return image
img = Image.open('C:/Users/ryan/Documents/Current_Projects/Houdini_Projects/render/ML_PDG_v006_color.png')
img = transform(img)
img_show = img_convert(img)
canvas, mark = toyplot.image(img_show, width=300)
toyplot.browser.show(canvas)
- tshead
- Member
- 62 posts
- Joined: Sept. 2014
- Offline
kadeno
I used toyplot over week end and it worked great, thanks a lot.
However it seems that calling it from inside a PDG prevent it from creating a window in my browser.
If you have a work around that, that would be great.
Your file doesn’t work here, but my PDG-fu is not strong and I’m not sure how you debug out-of-process PDG. However my minimalist example (see attached) works from the Python shell as well as in-process and out-of-process PDGs. A couple of notes:
* Toyplot 0.18 is the last version to support Python 2, so you have to install it explicitly by version, unless you’re using Python 3 Houdini.
* I use Conda to manage Python instances, and you can see from the Python Shell in the screenshot that I’m pointing Houdini to load packages from my conda instance instead of copying packages into Houdini. This works fine for me on macOS, I can’t say whether it would work on other platforms.
Cheers,
Tim
Edited by tshead - May 25, 2020 21:06:25
-
- Quick Links