lnls-fac / trackcpp

Particle tracking code
GNU General Public License v3.0
3 stars 3 forks source link

trouble encountered with installation #60

Open zhuzzzzzz opened 1 year ago

zhuzzzzzz commented 1 year ago

` ...... ar rcs build/libtrackcpp.a build/lattice.o build/elements.o build/passmethods.o build/tracking.o build/trackcpp.o build/flat_file.o build/optics.o build/diffusion_matrix.o build/dynap.o build/output.o build/kicktable.o build/multithreads.o build/accelerator.o build/naff.o build/linalg.o build/auxiliary.o g++ -m64 build/exec.o build/tests.o build/commands.o build/libtrackcpp.a -L/usr/lib/x86_64-linux-gnu -lgsl -lgslcblas -lm -lpthread -o build/trackcpp make -C python_package make[1]: Entering directory '/home/zhu/Project/LNLS/trackcpp/python_package' make[1]: python-sirius-config: No such file or directory /bin/sh: 1: python-sirius: not found /bin/sh: 1: python-sirius: not found [ -f ./numpy.i ] && echo "numpy.i already here, good" || \ wget https://raw.githubusercontent.com/numpy/numpy/v/tools/swig/numpy.i --2023-02-14 09:13:54-- https://raw.githubusercontent.com/numpy/numpy/v/tools/swig/numpy.i Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.109.133, 185.199.110.133, ... Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2023-02-14 09:13:55 ERROR 404: Not Found.

make[1]: [Makefile:48: trackcpp_wrap.cxx] Error 8 make[1]: Leaving directory '/home/zhu/Project/LNLS/trackcpp/python_package' make: [Makefile:147: python_package/trackcpp/_trackcpp.so] Error 2 ` Hello! I tried to run the va project in my Ubuntu virtual machine bu can't install the trackcpp module, it gives the above result. What is happening and what should I do?

xresende commented 1 year ago

wget https://raw.githubusercontent.com/numpy/numpy/v/tools/swig/numpy.i

@zhuzzzzzz , we just realized that the current makefile installation requires symbolic links to the python and pip executables of choice (python-siriusand pip-sirius, respectivelly). these executables are used in order to find the python version so that the appropriate numpy.i can be downloaded during the installation process. without these links an invalid version string is created and the download is broken. We will fix this soon by trying to make the installation less dependent on our particular environment. Thanks for pointing it out!

In the meantime you can fix this by creating the symbolic links. In our debian system we create them by issuing the following commands:

ln -s /usr/local/bin/python3.6 /usr/local/bin/python-sirius ln -s /usr/local/bin/pip3.6 /usr/local/bin/pip-sirius

just adapt them to point to yout python and pip executables.

zhuzzzzzz commented 1 year ago

It doesn't work, I have successfully created the soft link of python3 and pip, but the result of make all still gets something wrong

`g++ -c -m64 -O3 -std=c++11 -fPIC -DVERSION=4.10.0 -pthread -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wcast-align -Wconversion -Wduplicated-cond -Wlogical-op -Wmisleading-indentation -Wnull-dereference -Woverloaded-virtual -Wpedantic -Wunused -Wuseless-cast -I./include -I/usr/include -I./src src/output.cpp -o build/output.o; In file included from ./include/trackcpp/kicktable.h:20, from ./include/trackcpp/accelerator.h:20, from ./include/trackcpp/dynap.h:20, from ./include/trackcpp/output.h:20, from ./include/trackcpp/trackcpp.h:20, from src/output.cpp:17: ./include/trackcpp/auxiliary.h: In member function ‘int PassMethodsClass::size() const’: ./include/trackcpp/auxiliary.h:54:47: warning: conversion from ‘std::vector<std::__cxx11::basic_string >::size_type’ {aka ‘long unsigned int’} to ‘int’ may change value [-Wconversion] 54 int size() const { return passmethods.size(); } ~~~~^~ In file included from ./include/trackcpp/passmethods.h:70, from ./include/trackcpp/tracking.h:20, from ./include/trackcpp/optics.h:23, from ./include/trackcpp/trackcpp.h:21, from src/output.cpp:17: ./include/trackcpp/passmethods.hpp: In function ‘void calcpolykick(const Pos&, const std::vector&, const std::vector&, T&, T&)’: ./include/trackcpp/passmethods.hpp:59:60: warning: conversion from ‘long unsigned int’ to ‘int’ may change value [-Wconversion] 59 const int n = std::min(polynom_b.size(), polynom_a.size()); ^ ./include/trackcpp/passmethods.hpp: In function ‘Status::type pm_kickmap_pass(Pos&, const Element&, const Accelerator&)’: ./include/trackcpp/passmethods.hpp:455:20: warning: declaration of ‘status’ shadows a previous local [-Wshadow] 455 Status::type status = kicktablethinkick(pos, elem.kicktable_idx, brho, elem.nr_steps, elem.rescale_kicks); ^~ ./include/trackcpp/passmethods.hpp:444:16: note: shadowed declaration is here 444 Status::type status = Status::success; ^~ src/output.cpp: In function ‘Status::type print_closed_orbit(const Accelerator&, const std::vector<Pos >&, const string&)’: src/output.cpp:43:44: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘const value_type’ {aka ‘const std::__cxx11::basic_string’} [-Wformat=] 43 fprintf(fp, "# radiation_state : %s\n", rad_dict[accelerator.radiation_on]); ~^
char*
src/output.cpp: In function ‘Status::type print_tracking_linepass(const Accelerator&, const std::vector<Pos >&, unsigned int, const string&)’: src/output.cpp:73:45: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘const value_type’ {aka ‘const std::__cxx11::basic_string’} [-Wformat=] 73 fprintf(fp, "# radiation_state : %s\n", rad_dict[accelerator.radiation_on]); ~^
char*
src/output.cpp:80:60: warning: conversion from ‘std::vector::size_type’ {aka ‘long unsigned int’} to ‘unsigned int’ may change value [-Wconversion] 80 unsigned int nr_elements = accelerator.lattice.size(); ~~~~~~~~^~ src/output.cpp: In function ‘Status::type print_tracking_ringpass(const Accelerator&, const std::vector<Pos >&, unsigned int, const string&)’: src/output.cpp:107:45: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘const value_type’ {aka ‘const std::__cxx11::basic_string’} [-Wformat=] 107 fprintf(fp, "# radiation_state : %s\n", rad_dict[accelerator.radiation_on]); ~^
char*
src/output.cpp:111:60: warning: conversion from ‘std::vector::size_type’ {aka ‘long unsigned int’} to ‘unsigned int’ may change value [-Wconversion] 111 unsigned int nr_elements = accelerator.lattice.size(); ~~~~~~~~^~ src/output.cpp: In function ‘Status::type print_dynapgrid(const Accelerator&, const std::vector&, const string&, const string&, bool)’: src/output.cpp:138:45: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘const value_type’ {aka ‘const std::__cxx11::basic_string’} [-Wformat=] 138 fprintf(fp, "# radiation_state : %s\n", rad_dict[accelerator.radiation_on]); ~^
char*

ar rcs build/libtrackcpp.a build/lattice.o build/elements.o build/passmethods.o build/tracking.o build/trackcpp.o build/flat_file.o build/optics.o build/diffusion_matrix.o build/dynap.o build/output.o build/kicktable.o build/multithreads.o build/accelerator.o build/naff.o build/linalg.o build/auxiliary.o g++ -m64 build/exec.o build/tests.o build/commands.o build/libtrackcpp.a -L/usr/lib/x86_64-linux-gnu -lgsl -lgslcblas -lm -lpthread -o build/trackcpp make -C python_package make[1]: Entering directory '/home/zhu/Project/LNLS/trackcpp/python_package' make[1]: python-sirius-config: No such file or directory Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'numpy' Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'numpy' [ -f ./numpy.i ] && echo "numpy.i already here, good" || \ wget https://raw.githubusercontent.com/numpy/numpy/v/tools/swig/numpy.i --2023-03-01 15:17:32-- https://raw.githubusercontent.com/numpy/numpy/v/tools/swig/numpy.i Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.111.133, 185.199.110.133, ... Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2023-03-01 15:17:33 ERROR 404: Not Found.

make[1]: [Makefile:48: trackcpp_wrap.cxx] Error 8 make[1]: Leaving directory '/home/zhu/Project/LNLS/trackcpp/python_package' make: [Makefile:147: python_package/trackcpp/_trackcpp.so] Error 2 `

fernandohds564 commented 1 year ago

Hi @zhuzzzzzz , I noticed this error:

ModuleNotFoundError: No module named 'numpy' Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'numpy'

in your report.

Do you have numpy installed? It seems it can't find your numpy installation to get the version properly and download the correct numpy.i file.

The link https://raw.githubusercontent.com/numpy/numpy/v/tools/swig/numpy.i

doens't exist because it's missing the correct version. It should be something like this: https://raw.githubusercontent.com/numpy/numpy/v1.24.1/tools/swig/numpy.i

zhuzzzzzz commented 1 year ago

I found that I linked the python and pip excutable file of my linux system but I do make operation in my virtual env where the numpy package has already installed, after I changed to the correct soft link it still doesn't work, so I install the numpy package in my system. However then it works, there is no problem with numpy but it still goes wrong...

`2023-03-02 09:40:45 (394 KB/s) - ‘numpy.i’ saved [103094/103094]

swig -c++ -python -I/usr/include -I../include -I/home/zhu/.local/lib/python3.10/site-packages/numpy/core/include trackcpp.i && cp -f trackcpp.py trackcpp ../include/trackcpp/auxiliary.h:55: Warning 389: operator[] ignored (consider using %extend) ../include/trackcpp/elements.h:106: Warning 503: Can't wrap 'operator <<' unless renamed to a valid identifier. ../include/trackcpp/accelerator.h:42: Warning 503: Can't wrap 'operator <<' unless renamed to a valid identifier. ../include/trackcpp/optics.h:44: Warning 503: Can't wrap 'operator <<' unless renamed to a valid identifier. ../include/trackcpp/linalg.h:62: Warning 503: Can't wrap 'operator +' unless renamed to a valid identifier. g++ -c -std=c++11 -fPIC -O3 -I/usr/include -I../include -I/home/zhu/.local/lib/python3.10/site-packages/numpy/core/include trackcpp_wrap.cxx -o trackcpp_wrap.o trackcpp_wrap.cxx:178:11: fatal error: Python.h: No such file or directory 178 | # include | ^~~~~~ compilation terminated. make[1]: [Makefile:75: trackcpp_wrap.o] Error 1 make[1]: Leaving directory '/home/zhu/Project/LNLS/trackcpp/python_package' make: [Makefile:147: python_package/trackcpp/_trackcpp.so] Error 2 `