syntax error in py4vasp

Question on input files/tags, interpreting output, etc.

Please check whether the answer to your question is given in the VASP online manual or has been discussed in this forum previously!

Moderators: Global Moderator, Moderator

Locked
Message
Author
katsuaki_tanabe1
Newbie
Newbie
Posts: 10
Joined: Thu Feb 02, 2023 3:30 am

syntax error in py4vasp

#1 Post by katsuaki_tanabe1 » Wed Feb 22, 2023 1:01 am

Dear VASP users,

I am running VASP 6.3.2 on Ubuntu 22.04.1.
In carrying out the tutorial: 4.3 Calculation in tutorials/latest/molecules/part2/
for the part:
import py4vasp
my_calc = py4vasp.Calculation.from_path("./e04_O2-bond"),
I get a syntax error:
-bash: syntax error near unexpected token `('

I also tried with some different lines, referring
py4vasp/latest/calculation/
py4vasp/latest/
but got the same result, as seen in the attached stdout.

Probably it is a very trivial, beginner issue, but could anybody advise?

Thanks,
-Katsuaki
You do not have the required permissions to view the files attached to this post.

jonathan_lahnsteiner2
Global Moderator
Global Moderator
Posts: 149
Joined: Fri Jul 01, 2022 2:17 pm

Re: syntax error in py4vasp

#2 Post by jonathan_lahnsteiner2 » Wed Feb 22, 2023 8:20 am

Dear katsuaki_tanabe1,

I was checking your output file. The problem you are experiencing is because your are trying
to execute python3 commands in a bash shell.
For example the lines

Code: Select all

Tanabe_Dell7810% import py4vasp
Command 'import' not found, but can be installed with:
tell you that your executing the import command but the bash shell does not know this command
giving the Command not found error.
What you have to do is to execute the python3 commands either from a python shell,
a python script, a jupyter notebook....
If you want to use a python script, the easiest is to put your python commands in a txt file and then execute this script with python3 script_name.py. Please make sure before that py4vasp is installed properly. The installation guide can be found here
https://pypi.org/project/py4vasp/

I hope this helps to resolve your issue.

All the best Jonathan

katsuaki_tanabe1
Newbie
Newbie
Posts: 10
Joined: Thu Feb 02, 2023 3:30 am

Re: syntax error in py4vasp

#3 Post by katsuaki_tanabe1 » Mon Mar 13, 2023 1:32 am

Thank you Jonathan. As you correctly pointed out, the problem was on the disability of the "import" command in Ubuntu.
According to your advice, I installed py4vasp on Anaconda Powershell Prompt (anaconda3), and then tried importing py4vasp, but failed with an error:
ImportError: cannot import name 'expm' from 'scipy.linalg' (unknown location)

On the other hand, on Ubuntu, following the previous error message:
Command 'import' not found, but can be installed with:
sudo apt install graphicsmagick-imagemagick-compat # version 1.4+really1.3.38-1, or
sudo apt install imagemagick-6.q16 # version 8:6.9.11.60+dfsg-1.3build2
sudo apt install imagemagick-6.q16hdri # version 8:6.9.11.60+dfsg-1.3build2,
I activated the command "import" on Ubuntu, and then tried importing py4vasp there, but failed with an error:
import import: Unable to open XServer () [No such file or directory].

Thus, I failed to import py4vasp in both Anaconda Powershell and Ubuntu.
Which do you think easier to solve the issue, and also, which prompt would be more convenient in using VASP in the long run?
You do not have the required permissions to view the files attached to this post.

katsuaki_tanabe1
Newbie
Newbie
Posts: 10
Joined: Thu Feb 02, 2023 3:30 am

Re: syntax error in py4vasp

#4 Post by katsuaki_tanabe1 » Wed May 17, 2023 6:44 am

For the use of py4vasp, I eventually decided to use Anaconda Powershell Prompt, rather than Ubuntu because proper setup of an X server would be laborious.
After successfully installing py4vasp on Anaconda Powershell, I tried the command "import py4vasp" in the interactive mode, but still failed with errors as seen in the attachment.
Could anybody advise what to do?
You do not have the required permissions to view the files attached to this post.

jonathan_lahnsteiner2
Global Moderator
Global Moderator
Posts: 149
Joined: Fri Jul 01, 2022 2:17 pm

Re: syntax error in py4vasp

#5 Post by jonathan_lahnsteiner2 » Wed May 17, 2023 8:16 am

Dear katsuaki_tanabe1,

I was looking at your std output. In line 29 of your output you can see
that py4vasp is trying to import nglview and this package is trying to import ipywidgets.
To our knowledge python package nglview is not compatible with newer versions
of the ipywidgets package. The ipywidgets package is only supported up to version 7.7.x by nglview.
So what I recommend you to try is to type in your anaconda shell

Code: Select all

import nglview
If typing this command throws an error then you know it is the error described above.
The next step would then be to check your widget version by typing

Code: Select all

import ipywidgets
ipywidgets.version_info
If the version is above 7.7x please try installing a previous version of ipywidgets by

Code: Select all

pip uninstall ipywidgets
pip install ipywidgets==7.7
I hope this is of help. Otherwise please contact us again.
All the best Jonathan

katsuaki_tanabe1
Newbie
Newbie
Posts: 10
Joined: Thu Feb 02, 2023 3:30 am

Re: syntax error in py4vasp

#6 Post by katsuaki_tanabe1 » Thu May 18, 2023 12:13 am

Thank you very much Jonathan! Your detailed inspection and advice perfectly got the point, leading to my successful import of py4vasp.
As a potential reference for the future users in similar cases, I attached the stdout.
Regards, -Katsuaki
You do not have the required permissions to view the files attached to this post.

Locked