Page 1 of 1

py4lab and jupyter lab

Posted: Tue Oct 11, 2022 7:36 am
by bratinag
Hi,
For some reason plots generated by py4lab within jupyter notebook appear as blank cells. No error message is produced. The plot is generated as per the recipe in py4vasp manual:

import py4vasp as p4v
calc = p4v.Calculation.from_path("./bulk/3_dos")
calc.dos.plot("total,s,p")

Regards.

Gvido

Re: py4lab and jupyter lab

Posted: Tue Oct 11, 2022 7:55 am
by martin.schlipf
Please check if your browser has javascript enabled. You can also try a minimal example of the plotly library

Code: Select all

# x and y given as array_like objects
import plotly.express as px
fig = px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])
fig.show()
If you find that plotly works but py4vasp does not, we need to figure out why that is the case. If you cannot make plotly work at all, you can try to export the pictures

Code: Select all

import py4vasp as p4v
calc = p4v.Calculation.from_path("./bulk/3_dos")
calc.dos.to_image("total,s,p")

Re: py4lab and jupyter lab

Posted: Tue Oct 11, 2022 12:30 pm
by bratinag
Thanks for the help.

1. Javascript is enabled
2. The minimal example exhibits the same behavior as py4vasp, i.e. blank cell of the size of graph.

I've checked this on Chrome and Safari (OSX 12.6 with latest updates).

I've installed py4vasp via conda within an environment with the necessary packages installed (the list is too long for the post on the forum).

Exporting to image works.

Regards.

Gvido

Re: py4lab and jupyter lab

Posted: Wed Oct 12, 2022 8:00 am
by bratinag
Solved the problem by reinstalling completely conda and jupyterlab, and installing all packages from conda-forge.

Important: downgrade ipywidgets from 8.02 to 7.7.

Gvido

Re: py4lab and jupyter lab

Posted: Wed Oct 12, 2022 9:48 am
by martin.schlipf
Great that it works now.

Perhaps, I should add to the documentation how to install specific versions of py4vasp in the future. In our development environment, we freeze all dependencies to specific versions to avoid these conflicts. The installation is a bit more involved than the simple pip install, but may solve these issues. For the record, we currently use ipywidgets 7.7.1.