swhalemwo / obvz

org-brain visualization via PyQt
70 stars 4 forks source link

Error, finding obvz.py or Installation step by step guide #6

Closed michaelsjackson closed 4 years ago

michaelsjackson commented 4 years ago

For installing obvz I set four parameters:

(setq obvz-dir "~/org-brain")
(setq obvz-python-version "/home/mj/miniconda3/bin/python")

(add-to-list 'load-path "~/packages/obvz")
(load-library "obvz")

Then when running: M-x obvz-start

I am getting following error: /home/mj/miniconda3/bin/python: can't open file 'obvz.py': [Errno 2] No such file or directory

What I could try? Thanks in advance. My python3 is there. At least this python is used when updating pip3, for example.

python --version gives: Python 3.7.4

swhalemwo commented 4 years ago

hi! obvz-dir is supposed to be the main obvz folder (that where obvz.py file is located); it seems to me that you had set it to your org-brain directory instead? can you try setting it to ~/packages/obvz/ (it seems that's where you saved the obvz files)?

(also i'm not sure how load-library works, since i haven't packaged it properly yet I just load the elisp code with (load "~/path/to/obvz/obvz.el"))

michaelsjackson commented 4 years ago

Oh, thanks, this step is solved but next problem.

Traceback (most recent call last):
  File "obvz.py", line 7, in <module>
    from PyQt5.QtWidgets import QPushButton, QApplication, QWidget
ModuleNotFoundError: No module named 'PyQt5'

But I thought I installed PyQt5, it seems not. I used these commands.

sudo apt-get install python3-pyqt5
sudo apt-get install python3-pyqt5.qtsvg

How could I investigate correct installation of pyqt5, in which directories which files should be for example? Ubuntu 16.04 xenial here.

michaelsjackson commented 4 years ago

Ok, I came further using: pip3 install --user pyqt5

Now my error message looks as follows:

Traceback (most recent call last):
  File "obvz.py", line 40, in <module>
    from frucht_v3 import frucht
ImportError: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /home/mj/packages/obvz/frucht_v3.so)
swhalemwo commented 4 years ago

ah the lovely search for dependencies :) could it be a miniconda issue? I haven't used conda a lot, but iirc it has a separate package repo so idk how well it interacts with packages installed through apt. maybe you can try conda install pyqt (as well as for the other dependencies), or alternatively use a "normal" python version?

michaelsjackson commented 4 years ago

glibc 2.23 was released 2016-02-19

No I guess, maximum glibc is above for Ubuntu 16.04, and yours is a bit newer, 2.27. glibc 2.27 was released 2018-02-01

Searching/Googling more, if there is any solution, can report back here, if I have something. Coming always closer :walking_man:

swhalemwo commented 4 years ago

hmm the glib error seems to be due my c++ experiments where I cannot really say I understand all what's going on in the background. what i see on google is mostly the suggestion to upgrade to 18.04, but if you want to tinker with c++, eigen and pybind you could also try to compile the frucht_v3.cpp file on your system (the command i use is in the README).

michaelsjackson commented 4 years ago

How could I activate the non-cpp, slower version, if possible? Better than nothing.

Installed pybind: pip3 install pybind11 I tried compiling with eigen installation sudo apt install libeigen3-dev But still complains:

./frucht_v3.cpp:2:23: fatal error: Eigen/Dense: No such file or directory
compilation terminated.
michaelsjackson commented 4 years ago

Came further using, added -I /usr/include/eigen3: g++ -O3 -Wall -shared -std=c++17 -fPICpython3 -m pybind11 --includes-I /usr/include/eigen3 ./frucht_v3.cpp -o ./frucht_v3.so

But now getting some c++ errors.

./frucht_v3.cpp: In function ‘void update_dists(std::vector<std::pair<int, int> >, Eigen::Ref<Eigen::Matrix<float, -1, -1> >, Eigen::Ref<const Eigen::Matrix<float, -1, -1> >, Eigen::Ref<const Eigen::Matrix<float, -1, -1> >, int*)’:
./frucht_v3.cpp:275:27: error: ‘isnan’ was not declared in this scope
swhalemwo commented 4 years ago

i think (it's been a while) i used the eigen version from the eigen website since ubuntu repos always lag a bit behind. there's unfortunately no slower version anymore, after I saw what a speedboost c++ was I only implemented new features there.

michaelsjackson commented 4 years ago

No problem, thanks, I can try with the other Eigen then.

Do you have any guess, if this could be an error because of older/wrong Eigen version? error: ‘isnan’ was not declared in this scope

michaelsjackson commented 4 years ago

Installed latest Eigen, c++ error is less, meaning still no success, looks as follows:

 g++ -O3 -Wall -shared -std=c++17 -fPIC `python3 -m pybind11 --includes` -I /usr/local/include/eigen3 ./frucht_v3.cpp -o ./frucht_v3.so
./frucht_v3.cpp: In function ‘void update_dists(std::vector<std::pair<int, int> >, Eigen::Ref<Eigen::Matrix<float, -1, -1> >, Eigen::Ref<const Eigen::Matrix<float, -1, -1> >, Eigen::Ref<const Eigen::Matrix<float, -1, -1> >, int*)’:
./frucht_v3.cpp:275:27: error: ‘isnan’ was not declared in this scope
         if (isnan(new_dist)) {
                           ^
./frucht_v3.cpp:275:27: note: suggested alternative:
In file included from /usr/include/c++/5/complex:44:0,
                 from /usr/local/include/eigen3/Eigen/Core:28,
                 from /usr/local/include/eigen3/Eigen/Dense:1,
                 from ./frucht_v3.cpp:2:
/usr/include/c++/5/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
michaelsjackson commented 4 years ago

Tried enough for today, I can continue another time. Thanks for all your help.

Tried one more thing, replacing isnan by something else, then it compiles, copied to obvz directory, window opens, but then I am getting other emacs errors.

Debugger entered--Lisp error: (error "Not in org-mode or org-brain-visualize")
  signal(error ("Not in org-mode or org-brain-visualize"))
  error("Not in org-mode or org-brain-visualize")
  org-brain-entry-at-pt()
  (obvz-get-node-name (org-brain-entry-at-pt))

Probably I should try with simpler brains first?

swhalemwo commented 4 years ago

no problem :) thanks for the detailed reports! i don't think it's related to eigen since isnan is afaik basic c++ functionality, maybe g++ works different between ubuntu versions. i'd try next std::isnan instead of just isnan, for me (18.04) it makes no difference but perhaps it's required on 16.04.

michaelsjackson commented 4 years ago

std::isnan did it thanks. Now I can be sure at least I have a correct .so file, can investigate more, why now in emacs I am getting those errors, and how I can bypass those, somehow.

michaelsjackson commented 4 years ago

When the QApplication window appears, it is empty here always, message is as follows in emacs:

QApplication: invalid style override 'gtk' passed, ignoring it.
    Available styles: Windows, Fusion
michaelsjackson commented 4 years ago

Hey, it worked, success! Thanks a lot.

This time, I started org-brain-visualize first, then started obvz, hitting n and voila, window is filled with all those entries, my brain has more than 2000 .org files, cool, can play around now.

The above marathon was worth it in the end :kangaroo:

michaelsjackson commented 4 years ago

Tried svg export, it works as well, great. This issue can be closed if you want.