Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage example not working #8

Closed
danieljuschus opened this issue Mar 24, 2023 · 17 comments
Closed

Usage example not working #8

danieljuschus opened this issue Mar 24, 2023 · 17 comments

Comments

@danieljuschus
Copy link

danieljuschus commented Mar 24, 2023

The usage example is not currently working for me. No errors, but the 3D model is not shown.

There is also a deprecation warning: PyVistaDeprecationWarning: pythreejs backend is deprecated and is planned for future removal.

The examples on the page on the Streamlit Community Cloud don't work either anymore: https://stpyvista.streamlit.app/,

Windows 10, Python 3.11, pyvista 0.38.5, stpyvista 0.0.5, streamlit 1.20.0

@edsaac
Copy link
Owner

edsaac commented Mar 24, 2023

Indeed, pyvista's pythreejs backend is getting deprecated in favor of trame . I was moving to the panel backend, which is arguably better than pythreejs, but that one is also deprecated now so never merged that branch. :/

@edsaac edsaac closed this as completed Mar 24, 2023
@edsaac edsaac reopened this Mar 24, 2023
@edsaac
Copy link
Owner

edsaac commented Mar 24, 2023

Sorry, didn't mean to close the issue. I'll try to port stpyvista to trame eventually in a next version. For now, fixing pyvista to a previous version (maybe 0.36.0) should do the trick, but cannot confirm that yet.

@anciaux
Copy link

anciaux commented Mar 25, 2023

I cannot find any combination fixing the pyvista version to something older that fixes the issue. Could someone do it ?

if so could I get the version of all packages ?

Also, the trame is interesting when do plan to have this included ? Do you need help somehow ?

@edsaac
Copy link
Owner

edsaac commented Mar 26, 2023

I tried many version combinations and could not figure out the problem. My guess now is that something is broken in the threejs library and I gave up. So I released version 0.0.6 of stpyvista to just use the panel backend, which --although deprecate-- still works!

You can upgrade to version 0.0.6 via pip (pip install stpyvista -U). Tests seem to be passing in st.pyvista.streamlit.app but lmk if something else broke.

@anciaux
Copy link

anciaux commented Mar 27, 2023

Thanks you so much. It indeed worked!

@danieljuschus
Copy link
Author

Not working for me unfortunately, I keep getting errors like

File "C:\Users\jusc_da\Documents\AirFuCS\airfucs-calc\venv\Lib\site-packages\panel\io\save.py", line 295, in save
    with io.open(filename, mode="w", encoding="utf-8") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\______\\AppData\\Local\\Temp\\tmpz13yuo84.html'

@edsaac
Copy link
Owner

edsaac commented Mar 27, 2023

That looks like a permissions configuration issue with your computer, when panel attempts to create temporal files.

@jeac1771
Copy link

Hello, I have the same problem, how did you solve it?: PermissionError: [Errno 13] Permission denied:.

Thanks you

@danieljuschus
Copy link
Author

I have not yet found a solution. Unfortunately I am currently restricted to a Windows machine without admin rights. Are you in the same situation perhaps?

@edsaac
Copy link
Owner

edsaac commented Mar 28, 2023

That might be fixed using a io.BytesIO object instead of a tempfile for storing the exported panel view. I'll update when I modify that in stpyvista.

@jaedong27
Copy link

jaedong27 commented Mar 29, 2023

I think that this problem results from accessing temp file in "root/stpyvista/panel/io/save.py", line 295 when NamedTemporaryFile in "root/stpyvista/__init__.py", line 84 hold the temp file.
To handle this problem, I changed "root/stpyvista/__init__.py", line 83 ~ 86

        # Create HTML file
        with NamedTemporaryFile(mode='a+', suffix='.html') as model_html:
            geo_pan_pv.save(model_html.name, resources=INLINE)
            panel_html = model_html.read()

To

        # Create HTML file
        temp_path = ""
        with NamedTemporaryFile(mode='a+', suffix='.html') as model_html:
            temp_path = model_html.name
        geo_pan_pv.save(temp_path, resources=INLINE)
        with open(temp_path, 'r', encoding="utf-8") as model_html:
            panel_html = model_html.read()

This code just get temp file name from NamedTemporaryFile and release that temp file.
Then it process next things.

@edsaac
Copy link
Owner

edsaac commented Mar 29, 2023

I got rid of the whole temporary file in version 0.0.7 of stpyvista. Test seem to be passing at https://stpyvista.streamlit.app/, so you should be good after upgrading (pip install stpyvista -U). But again, lmk if something failed!

@jaedong27
Copy link

jaedong27 commented Mar 30, 2023

I checked working about version 0.0.7. Thank you!
(Window 10, python 3.8.0)

@danieljuschus
Copy link
Author

Works for me too, thanks! Shall we open a new issue for trame?

@edsaac
Copy link
Owner

edsaac commented Mar 30, 2023

Sounds good 👍

@edsaac edsaac closed this as completed Mar 30, 2023
@danieljuschus
Copy link
Author

Is it just me or is the translation of the view using the middle mouse button not working anymore with the panel backend?

@edsaac
Copy link
Owner

edsaac commented Mar 31, 2023

Shift + click does the panning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants