py4vasp issue

Problems running VASP: crashes, internal errors, "wrong" results.

Moderators: Global Moderator, Moderator

Locked
Message
Author
shirin_akter1
Newbie
Newbie
Posts: 5
Joined: Wed Dec 28, 2022 9:16 am

py4vasp issue

#1 Post by shirin_akter1 » Thu Jan 12, 2023 2:27 pm

hello dear
I am trying to Vizualize the structure at each step using py4vasp! in jupyter lab as per guideline link "tutorials/latest/molecules/part2/" under section 5.3. but i am facing problem to run following instruction.



Command apply in jupyter console
=============================

import py4vasp
my_calc = py4vasp.Calculation.from_path("./e05_CO-bond")
my_calc.structure[:].plot()




Error
=================================




AttributeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 import py4vasp
2 my_calc = py4vasp.Calculation.from_path("./e05_CO-bond")
4 my_calc.structure[:].plot()

File ~/.local/lib/python3.8/site-packages/py4vasp/__init__.py:3
1 # Copyright © VASP Software GmbH,
2 # Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
----> 3 from .calculation import Calculation
4 from py4vasp._third_party.interactive import set_error_handling
6 __version__ = "0.4.0"

File ~/.local/lib/python3.8/site-packages/py4vasp/calculation.py:16
3 """Provide the tools to manage VASP calculations.
4
5 This is the main user interface if you want to simply investigate the results of VASP
(...)
13 >>> calc.structure.print() # to print the structure in a POSCAR format
14 """
15 import inspect
---> 16 import py4vasp.data
17 import py4vasp.exceptions as exception
18 import py4vasp.control

File ~/.local/lib/python3.8/site-packages/py4vasp/data/__init__.py:33
31 from .projector import Projector
32 from .topology import Topology
---> 33 from .viewer3d import Viewer3d
34 from .structure import Structure
35 from .system import System

File ~/.local/lib/python3.8/site-packages/py4vasp/data/viewer3d.py:6
4 import py4vasp.exceptions as exception
5 import collections
----> 6 import nglview
7 import mrcfile
8 import numpy as np

File ~/.local/lib/python3.8/site-packages/nglview/__init__.py:4
1 import warnings
3 # for doc
----> 4 from . import adaptor, datafiles, show, widget
5 from ._version import get_versions
6 from .adaptor import *

File ~/.local/lib/python3.8/site-packages/nglview/show.py:13
3 from . import datafiles
4 from .adaptor import (ASEStructure, ASETrajectory, BiopythonStructure,
5 FileStructure, HTMDTrajectory, IODataStructure,
6 IOTBXStructure, MDAnalysisTrajectory, MDTrajTrajectory,
(...)
11 RdkitStructure,
12 TextStructure)
---> 13 from .widget import NGLWidget
15 __all__ = [
16 'demo',
17 'show_pdbid',
(...)
40 'show_biopython',
41 ]
44 def show_pdbid(pdbid, **kwargs):

File ~/.local/lib/python3.8/site-packages/nglview/widget.py:19
15 from traitlets import (Bool, CaselessStrEnum, Dict, Instance, Int, Integer,
16 List, Unicode, observe, validate)
17 import traitlets
---> 19 from . import color, interpolate
20 from .adaptor import Structure, Trajectory
21 from .component import ComponentViewer

File ~/.local/lib/python3.8/site-packages/nglview/color.py:114
110 else:
111 raise ValueError(f"{obj} must be either list of list or string")
--> 114 ColormakerRegistry = _ColormakerRegistry()

File ~/.local/lib/python3.8/site-packages/nglview/base.py:10, in _singleton.<locals>.getinstance()
8 def getinstance():
9 if cls not in instances:
---> 10 instances[cls] = cls()
11 return instances[cls]

File ~/.local/lib/python3.8/site-packages/nglview/color.py:47, in _ColormakerRegistry.__init__(self, *args, **kwargs)
45 try:
46 get_ipython() # only display in notebook
---> 47 self._ipython_display_()
48 except NameError:
49 pass

File ~/.local/lib/python3.8/site-packages/nglview/color.py:54, in _ColormakerRegistry._ipython_display_(self, **kwargs)
52 if self._ready:
53 return
---> 54 super()._ipython_display_(**kwargs)

AttributeError: 'super' object has no attribute '_ipython_display_'

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

Re: py4vasp issue

#2 Post by martin.schlipf » Fri Jan 13, 2023 12:47 pm

The issue is caused by a recent upgrade to ipywidgets that broke the nglview package. To fix this you can

Code: Select all

pip uninstall ipywidgets
pip install ipywidgets==7.7
You can follow-up if there are further developments here.

shirin_akter1
Newbie
Newbie
Posts: 5
Joined: Wed Dec 28, 2022 9:16 am

Re: py4vasp issue

#3 Post by shirin_akter1 » Sat Jan 14, 2023 5:57 am

hello dear
Thank you for your help.
Now getting another error for command

Command
=========================

import py4vasp
my_calc = py4vasp.Calculation.from_path("./")

my_calc.structure[:].plot()

Error
=========================

FileNotFoundError: [Errno 2] Unable to open file (unable to open file: name = '/home/leotech/vasp/tutorial/get_started/e05_CO-bond/vaspout.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)


The above exception was the direct cause of the following exception:

FileAccessError: Error opening /home/leotech/vasp/tutorial/get_started/e05_CO-bond/vaspout.h5 to read the data. Please check that you already completed the Vasp calculation and that the file is indeed in the directory. Please also check whether you are running the Python script in the same directory or pass the appropriate filename including the path.

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

Re: py4vasp issue

#4 Post by martin.schlipf » Mon Jan 16, 2023 7:48 am

Well, does the file mentioned in the error message exist?

Locked