Closed SANAULLAHMIR closed 7 months ago
Hi @SANAULLAHMIR, I can't really tell from this error message. Could you show me how you installed p2ptrans and what output you got?
Hello @ftherrien I have successfully installed the p2ptrans through Conda by clicking the command pip install git+https://github.com/ftherrien/p2ptrans It show me that p2ptrans is successfully installed, as you can see in the below snap
But further, when i am going to get help, by clicking command p2ptrans --help,,,, it give me the following error:
Can you check that /home/SanaUllah/anaconda3/lib/python3.9/site-packages/p2ptrans/fmodules.cpython-39-x86_64-linux-gnu.so
actually exists? If it does, can you try:
cd /home/SanaUllah/anaconda3/lib/python3.9/site-packages/p2ptrans/
python -c "import fmodules"
@SANAULLAHMIR If you fixed that, please, let me know.
Otherwise, @ftherrien , please try to install it from the scratch on another machine and you will face with the same error (99% sure). I have faced with the same error on Ubuntu, MacOS.
I do try to install it as it is written in README.md
. And when I try to just run p2ptrans -h
it gives me the same error as in the initial post of this issue.
I did try to dig deeply and tried to compile .so
library by hands (direct run of f2py
) and still the error is there.
I did try different gfortran
-s, intel compilers, different versions of python and numpy, but error is still there.
Here is the output when I tried to just run make
in the root folder:
rmbadname1: Replacing "char" with "char_bn".
rmbadname1: Replacing "char" with "char_bn".
appenddecl: "dimension" not implemented.
appenddecl: "dimension" not implemented.
appenddecl: "dimension" not implemented.
appenddecl: "dimension" not implemented.
And some more here
python3 -m numpy.f2py -c --f90exec=gfortran --fcompiler=gnu95 --f90flags="-Wall -g -Og -fbacktrace -fopenmp" -lgomp -m p2ptrans.fmodules source/lap.f90 source/utils.f90 source/tiling.f90 source/potential.f90 source/transform.f90 only: munkres free_trans rot_mat center eye norm split det sort sphere circle distance derivative closest fixed_tmat fixed_tmat_int intoptimization fastoptimization optimize_vec
running build
running config_cc
INFO: unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
INFO: unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
INFO: build_src
INFO: building extension "p2ptrans.fmodules" sources
INFO: f2py options: ['only:', 'munkres', 'free_trans', 'rot_mat', 'center', 'eye', 'norm', 'split', 'det', 'sort', 'sphere', 'circle', 'distance', 'derivative', 'closest', 'fixed_tmat', 'fixed_tmat_int', 'intoptimization', 'fastoptimization', 'optimize_vec', ':']
INFO: f2py:> /tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans/fmodulesmodule.c
creating /tmp/tmp7klu8d34/src.linux-x86_64-3.10
creating /tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans
Reading fortran codes...
Reading file 'source/lap.f90' (format:free)
Reading file 'source/utils.f90' (format:free)
Reading file 'source/tiling.f90' (format:free)
Reading file 'source/potential.f90' (format:free)
Reading file 'source/transform.f90' (format:free)
Post-processing...
Block: fmodules
Block: hungarian
Block: munkres
Block: utils
Block: free_trans
Block: rot_mat
Block: center
Block: eye
Block: norm
Block: split
Block: det
In: :fmodules:source/utils.f90:utils:det
analyzevars: prefix ('recursive') were not used
Block: sort
Block: tiling
Block: sphere
In: :fmodules:source/tiling.f90:tiling:sphere
get_parameters: got "eval() arg 1 must be a string, bytes or code object" on 8
Block: circle
In: :fmodules:source/tiling.f90:tiling:circle
get_parameters: got "eval() arg 1 must be a string, bytes or code object" on 8
Block: potential
Block: distance
Block: derivative
Block: transform
In: :fmodules:source/transform.f90:transform
get_parameters: got "eval() arg 1 must be a string, bytes or code object" on 8
Block: closest
Block: optimize_vec
Block: fastoptimization
In: :fmodules:source/transform.f90:transform:fastoptimization
get_parameters: got "eval() arg 1 must be a string, bytes or code object" on 8
Block: fixed_tmat
In: :fmodules:source/transform.f90:transform:fixed_tmat
get_parameters: got "eval() arg 1 must be a string, bytes or code object" on 8
Block: intoptimization
In: :fmodules:source/transform.f90:transform:intoptimization
get_parameters: got "eval() arg 1 must be a string, bytes or code object" on 8
Block: fixed_tmat_int
In: :fmodules:source/transform.f90:transform:fixed_tmat_int
get_parameters: got "eval() arg 1 must be a string, bytes or code object" on 8
Post-processing (stage 2)...
Block: fmodules
Block: unknown_interface
Block: hungarian
Block: munkres
Block: utils
Block: free_trans
Block: rot_mat
Block: center
Block: eye
Block: norm
Block: split
Block: det
Block: sort
Block: tiling
Block: sphere
Block: circle
Block: potential
Block: distance
Block: derivative
Block: transform
Block: closest
Block: optimize_vec
Block: fastoptimization
Block: fixed_tmat
Block: intoptimization
Block: fixed_tmat_int
Building modules...
Building module "fmodules"...
Constructing F90 module support for "hungarian"...
Constructing wrapper function "hungarian.munkres"...
sumsol,jsol = munkres(c,[n])
Constructing F90 module support for "utils"...
Creating wrapper for Fortran function "free_trans"("free_trans")...
Constructing wrapper function "utils.free_trans"...
free_trans = free_trans(pos,mat,vec)
Creating wrapper for Fortran function "rot_mat"("rot_mat")...
Constructing wrapper function "utils.rot_mat"...
r = rot_mat(angles)
Constructing wrapper function "utils.center"...
center(pos,[n])
Creating wrapper for Fortran function "eye"("eye")...
Constructing wrapper function "utils.eye"...
a = eye()
Creating wrapper for Fortran function "norm"("norm")...
Constructing wrapper function "utils.norm"...
norm = norm(a)
Creating wrapper for Fortran function "split"("split")...
Constructing wrapper function "utils.split"...
split = split(a,char_bn)
Creating wrapper for Fortran function "det"("det")...
Constructing wrapper function "utils.det"...
accumulation = det(a,[n])
Creating wrapper for Fortran function "sort"("sort")...
Constructing wrapper function "utils.sort"...
idx = sort(array)
Constructing F90 module support for "tiling"...
Constructing wrapper function "tiling.sphere"...
asc = sphere(acell,ncell,center)
Constructing wrapper function "tiling.circle"...
asc = circle(acell,ncell,center)
Constructing F90 module support for "potential"...
Creating wrapper for Fortran function "distance"("distance")...
Constructing wrapper function "potential.distance"...
distance = distance(apos,bpos,mat,vec,pot,param)
Creating wrapper for Fortran function "derivative"("derivative")...
Constructing wrapper function "potential.derivative"...
e = derivative(apos,bpos,mat,vec,pot,param)
Constructing F90 module support for "transform"...
Constructing wrapper function "transform.closest"...
cost = closest(apos,bpos,[n])
Constructing wrapper function "transform.optimize_vec"...
vec_out = optimize_vec(apos,bpos,vec,filename,[n])
Constructing wrapper function "transform.fastoptimization"...
apos_out,bpos_out,bpos_out_stretch,n_out,n_a,classes_list_out,tmat,dmin,vec = fastoptimization(apos,bpos,acell,iacell,atoms,filename,outdir,[na,nb,n_atoms])
Constructing wrapper function "transform.fixed_tmat"...
apos_out,bpos_out,bpos_out_stretch,n_out,n_a,classes_list_out,tmat,dmin,vec = fixed_tmat(apos,bpos,tmat_in,vec_in,atoms,filename,outdir,[na,nb,n_atoms])
Constructing wrapper function "transform.intoptimization"...
apos_out,bpos_out,bpos_out_stretch,n_out,n_a,classes_list_out,ttrans,rtrans,dmin,stats,n_peaks,peak_thetas = intoptimization(sym,n_iter,apos,bpos,acell,iacell,atoms,switched,filename,outdir,[na,nb,n_atoms])
Constructing wrapper function "transform.fixed_tmat_int"...
apos_out,bpos_out,bpos_out_stretch,n_out,n_a,classes_list_out,vec,dmin = fixed_tmat_int(apos,bpos,ttrans,atoms,switched,filename,outdir,[na,nb,n_atoms])
Wrote C/API module "fmodules" to file "/tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans/fmodulesmodule.c"
Fortran 90 wrappers are saved to "/tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans/fmodules-f2pywrappers2.f90"
INFO: adding '/tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans/fortranobject.c' to sources.
INFO: adding '/tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans' to include_dirs.
copying /home/asamt/.pyenv/versions/3.10.8/lib/python3.10/site-packages/numpy/f2py/src/fortranobject.c -> /tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans
copying /home/asamt/.pyenv/versions/3.10.8/lib/python3.10/site-packages/numpy/f2py/src/fortranobject.h -> /tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans
INFO: adding '/tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans/fmodules-f2pywrappers2.f90' to sources.
INFO: build_src: building npy-pkg config files
running build_ext
INFO: customize UnixCCompiler
INFO: customize UnixCCompiler using build_ext
INFO: customize Gnu95FCompiler
INFO: Found executable /usr/bin/gfortran
INFO: customize Gnu95FCompiler using build_ext
INFO: building 'p2ptrans.fmodules' extension
INFO: compiling C sources
INFO: C compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC
creating /tmp/tmp7klu8d34/tmp
creating /tmp/tmp7klu8d34/tmp/tmp7klu8d34
creating /tmp/tmp7klu8d34/tmp/tmp7klu8d34/src.linux-x86_64-3.10
creating /tmp/tmp7klu8d34/tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans
INFO: compile options: '-DNPY_DISABLE_OPTIMIZATION=1 -I/tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans -I/home/asamt/.pyenv/versions/3.10.8/lib/python3.10/site-packages/numpy/core/include -I/home/asamt/.pyenv/versions/3.10.8/include/python3.10 -c'
INFO: gcc: /tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans/fmodulesmodule.c
INFO: gcc: /tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans/fortranobject.c
INFO: compiling Fortran 90 module sources
creating /tmp/tmp7klu8d34/p2ptrans
INFO: Fortran f77 compiler: /usr/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops
Fortran f90 compiler: gfortran -Wall -g -Og -fbacktrace -fopenmp -fPIC -O3 -funroll-loops
Fortran fix compiler: gfortran -Wall -g -ffixed-form -fno-second-underscore -Wall -g -Og -fbacktrace -fopenmp -fPIC -O3 -funroll-loops
creating /tmp/tmp7klu8d34/source
INFO: compile options: '-I/tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans -I/home/asamt/.pyenv/versions/3.10.8/lib/python3.10/site-packages/numpy/core/include -I/home/asamt/.pyenv/versions/3.10.8/include/python3.10 -c'
extra options: '-J/tmp/tmp7klu8d34/p2ptrans -I/tmp/tmp7klu8d34/p2ptrans'
INFO: gfortran:f90: source/lap.f90
INFO: gfortran:f90: source/utils.f90
INFO: gfortran:f90: source/tiling.f90
INFO: gfortran:f90: source/potential.f90
INFO: gfortran:f90: source/transform.f90
INFO: compiling Fortran sources
INFO: Fortran f77 compiler: /usr/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops
Fortran f90 compiler: gfortran -Wall -g -Og -fbacktrace -fopenmp -fPIC -O3 -funroll-loops
Fortran fix compiler: gfortran -Wall -g -ffixed-form -fno-second-underscore -Wall -g -Og -fbacktrace -fopenmp -fPIC -O3 -funroll-loops
INFO: compile options: '-I/tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans -I/home/asamt/.pyenv/versions/3.10.8/lib/python3.10/site-packages/numpy/core/include -I/home/asamt/.pyenv/versions/3.10.8/include/python3.10 -c'
extra options: '-J/tmp/tmp7klu8d34/p2ptrans -I/tmp/tmp7klu8d34/p2ptrans'
INFO: gfortran:f90: /tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans/fmodules-f2pywrappers2.f90
INFO: /usr/bin/gfortran -Wall -g -Wall -g -shared /tmp/tmp7klu8d34/tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans/fmodulesmodule.o /tmp/tmp7klu8d34/tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans/fortranobject.o /tmp/tmp7klu8d34/source/lap.o /tmp/tmp7klu8d34/source/utils.o /tmp/tmp7klu8d34/source/tiling.o /tmp/tmp7klu8d34/source/potential.o /tmp/tmp7klu8d34/source/transform.o /tmp/tmp7klu8d34/tmp/tmp7klu8d34/src.linux-x86_64-3.10/p2ptrans/fmodules-f2pywrappers2.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/home/asamt/.pyenv/versions/3.10.8/lib -lgomp -lgfortran -o ./p2ptrans/fmodules.cpython-310-x86_64-linux-gnu.so
Removing build directory /tmp/tmp7klu8d34
I hope that will help to fix this issue.
Thanks @samtsevich, let me look into it, I will get back to you soon.
@ftherrien
Any news about that bug? If so, maybe I can help somehow.
I will allocate some time on it today
@samtsevich and @SANAULLAHMIR
I have created an issue on Numpy in the mean time, it should work if you use Numpy 1.26.2 or less
@samtsevich and @SANAULLAHMIR
You can install pre-released versions of numpy that fix this issue through pip install --pre numpy
. Basically it works with any recent version of numpy except for 1.26.3 and 1.26.4
I have successfully installed the p2ptrans, but whenever i am going "p2ptrans --help", it give me the following error: Please expert need your help in this regard: p2ptrans --help Traceback (most recent call last): File "/home/SanaUllah/anaconda3/bin/p2ptrans", line 6, in
from p2ptrans import *
File "/home/SanaUllah/anaconda3/lib/python3.9/site-packages/p2ptrans/init.py", line 5, in
from . import interfaces
File "/home/SanaUllah/anaconda3/lib/python3.9/site-packages/p2ptrans/interfaces.py", line 10, in
from .core import makeSphere, find_cell, makeStructures, switchDispStruc, find_periodicity
File "/home/SanaUllah/anaconda3/lib/python3.9/site-packages/p2ptrans/core.py", line 8, in
from .fmodules import hungarian as lap
ImportError: cannot import name 'hungarian' from 'p2ptrans.fmodules' (/home/SanaUllah/anaconda3/lib/python3.9/site-packages/p2ptrans/fmodules.cpython-39-x86_64-linux-gnu.so)