py4lab and jupyter lab

Queries about input and output files, running specific calculations, etc.


Moderators: Global Moderator, Moderator

Locked
Message
Author
bratinag
Newbie
Newbie
Posts: 13
Joined: Tue Sep 13, 2022 12:30 pm

py4lab and jupyter lab

#1 Post by bratinag » Tue Oct 11, 2022 7:36 am

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

martin.schlipf
Global Moderator
Global Moderator
Posts: 542
Joined: Fri Nov 08, 2019 7:18 am

Re: py4lab and jupyter lab

#2 Post by martin.schlipf » Tue Oct 11, 2022 7:55 am

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")

Martin Schlipf
VASP developer


bratinag
Newbie
Newbie
Posts: 13
Joined: Tue Sep 13, 2022 12:30 pm

Re: py4lab and jupyter lab

#3 Post by bratinag » Tue Oct 11, 2022 12:30 pm

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

bratinag
Newbie
Newbie
Posts: 13
Joined: Tue Sep 13, 2022 12:30 pm

Re: py4lab and jupyter lab

#4 Post by bratinag » Wed Oct 12, 2022 8:00 am

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

martin.schlipf
Global Moderator
Global Moderator
Posts: 542
Joined: Fri Nov 08, 2019 7:18 am

Re: py4lab and jupyter lab

#5 Post by martin.schlipf » Wed Oct 12, 2022 9:48 am

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.

Martin Schlipf
VASP developer


Locked