Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsuccessful installation attempt on Ubuntu 20.0 #1

Open
TeoKn opened this issue May 16, 2021 · 5 comments
Open

Unsuccessful installation attempt on Ubuntu 20.0 #1

TeoKn opened this issue May 16, 2021 · 5 comments

Comments

@TeoKn
Copy link

TeoKn commented May 16, 2021

After clonning the repository, I proceed to installation as follows
CPPFLAGS=-I/usr/include/eigen3 python setup.py install --user
which runs the following:

running install
running bdist_egg
running egg_info
writing python/tom.egg-info/PKG-INFO
writing dependency_links to python/tom.egg-info/dependency_links.txt
writing top-level names to python/tom.egg-info/top_level.txt
reading manifest file 'python/tom.egg-info/SOURCES.txt'
writing manifest file 'python/tom.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying python/tom/_version.py -> build/lib.linux-x86_64-3.8/tom
running build_ext
building 'tom.__tomlib' extension
gcc -pthread -B /home/tk/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/eigen3 -fPIC -I/home/tk/anaconda3/lib/python3.8/site-packages/numpy/core/include -Iinclude/tom -Iinclude/external -I/opt/local/include/eigen3 -I/home/tk/anaconda3/include/python3.8 -c swig/_tomlib_wrap.cpp -o build/temp.linux-x86_64-3.8/swig/_tomlib_wrap.o -std=c++11 -Wno-unused-variable -Wno-sign-compare

Then the compilation produces a series of warnings and errors (see attached file) and exits with error status 1
result.txt

@m7thon
Copy link
Owner

m7thon commented May 16, 2021

Hi, thanks for showing an interest in this!

I just tried to compile and run on recent systems I have (Mac OS 10.15.7 and ubuntu 18.04.05) and can basically do so. Some things to note:

  1. You need to be using python3 (I use python3.7). I set up an anaconda environment with numpy for this:
    conda create -n tom python=3.7
    conda activate tom
    conda install numpy
    python setup.py develop
  2. Compilation works with eigen 3.3.7 (and has some issues with protected destructors in eigen 3.3.9). So, please use eigen 3.3.7. It is a header only library, so you only need to download and extract the corresponding eigen3 files, and point to the right directory (either via setup.cfg, or via the CPPFLAGS=-I/home/yourname/eigen-3.3.7).
  3. There are a bunch of harmless compilation warnings
  4. You do not need to touch the swig files, but I tried re-running swig with the current swig 4.1.0, and that does work.

As PhD research goes, I have not maintained this since 2018.
Hope this helps!

@TeoKn
Copy link
Author

TeoKn commented May 18, 2021

Hi,

Thank you for your instructions.

I tried again from skratch, by setting up, as you suggested, an anaconda (conda 4.9.2) environment for tom. I am using

  • Eigen version: 3.3.7-2
  • python version: 3.8.5
  • gcc version: 9.3.0

As it can be seen in the enclosed file, the path to headers of Eigen (/usr/lib/eigen3 - I set it in setup.cfg) is correct. Unfortunately, my experience with programming in C++ is very old (before gcc started to be distributed), and I did not succeed in identifying the source of errors. Please, have a look at the enclosed file. The following error is repeated many times

error: ‘Eigen::MatrixBase<Derived>::~MatrixBase() [with Derived = Eigen::Map<Eigen::Matrix<double, -1, -1>, 0, Eigen::Stride<-1, -1> >]’ is protected within this context

Please, note that I have neither swig nor doxygen installed as those are only required for the development. Since README.md states that cereal and rapidjson are a part of the package, I did not try to install them separately.

Compilation command line is almost identical to that of my issue-opening post except for the path to Eigen headers which appears correctly as -I/usr/include/eigen3. The enclosed file bears very similar error messages as for my former attempt.

Is there any other thing I could try ?
gcc-errors.txt

@m7thon
Copy link
Owner

m7thon commented May 19, 2021

The error you are getting is what I meant with the “ issues with protected destructors in eigen ”. I get this, too, when using newer eigen versions.

Please use eigen-3.3.7. You can download the .tar.gz from the eigen page, unzip somewhere, and adjust the path (in the cfg). That should work.

@TeoKn
Copy link
Author

TeoKn commented May 19, 2021

Thank you for your patient explanations. I downloaded eigen-3.3.7 from GitLab and
I got only one error signaled during my compilation attempt, namely

swig/_tomlib_wrap.cpp:3309:3: error: ‘_PyObject_GC_UNTRACK’ was not declared in this scope; did you mean ‘PyObject_GC_UnTrack’?
 3309 |   _PyObject_GC_UnTrack(descr);
      |   ^~~~~~~~~~~~~~~~~~~~
      |   PyObject_GC_UnTrack

Identifer _PyObject_GC_UNTRACK appears only there. Surprisingly, I could not find PyObject_GC_UnTrack neither in TOM sources nor in Eigen headers. As I understand, PyObject_GC_UnTrack is one of Python's garbage collector functions. Perhaps in Python 3.7 it was named _PyObject_GC_UNTRACK. Anyway, according to this post, the latter identifier has been removed from Python 3.8.

As a paliative, I replaced in swig/_tomlib_wrap.cpp the single occurrence of _PyObject_GC_UNTRACK by PyObject_GC_UnTrack . Now the compilation terminates successfully.

I will try to run TOM tomorrow :-)

@TeoKn
Copy link
Author

TeoKn commented May 20, 2021

I have a successful run with the example! Thanks again.

I would suggest completing TOM sources with a version compatible with at least python 3.8 (PyObject_GC_UnTrack instead of _PyObject_GC_UNTRACK in swig/_tomlib_wrap.cpp).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants