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

V2/3 Py2/3 issues #818

Closed
uliska opened this issue Apr 25, 2016 · 18 comments
Closed

V2/3 Py2/3 issues #818

uliska opened this issue Apr 25, 2016 · 18 comments

Comments

@uliska
Copy link
Collaborator

uliska commented Apr 25, 2016

I've some issues starting shortly after having managed to set up Frescobaldi 3.

Having pulled the latest commits from master Frescobaldi stopped working with

Traceback (most recent call last):
  File "/home/uliska/bin/frescobaldi", line 7, in <module>
    import main
  File "/home/uliska/git/lilypond/frescobaldi/frescobaldi_app/main.py", line 41, in <module>
    import po.setup         # Setup language
  File "/home/uliska/git/lilypond/frescobaldi/frescobaldi_app/po/__init__.py", line 24, in <module>
    import builtins
ImportError: No module named builtins

Which leads me to believe that it is still running with Python2, as running frescobaldi after checking out 9ae66b3 still works.

Which leads me to ask how Frescobaldi ensures being run with Python3 when in the main frescobaldi entrance file it still says #!/usr/bin/env python?

However, running python3 frescobaldi from latest master exits immediately, saying only "Speicherzugriffsfehler" (~ memory access error).

@wbsoft
Copy link
Collaborator

wbsoft commented Apr 25, 2016

did you use python3 setup.py install?
Then it should use python 3 when running. I don't know the cause of the memory error.

@uliska
Copy link
Collaborator Author

uliska commented Apr 25, 2016

Actually I didn't use setup.py at all because so far I had always just pulled from github and restarted Frescboaldi. Now doing setup with Python3 (and sudo) obviously adds frescobaldi as a module to my local Python 3.4 installation and installs a starter script as a systemwide file. Is that correct? And doesn't that mean that I will always have to rerun install now after pulling any changes or even after changing anything in the files themselves?

Anyway, now Frescobaldi uses python3 but immediately quits with the "memory access error"

@uliska
Copy link
Collaborator Author

uliska commented Apr 25, 2016

Hm, somewhat closer: Now that it uses Python 3 I always get that error when anything is checked out starting with 502bffb "merge branch qt5".

Somehow I have the impression it is an issue in my Python/Qt system.

@wbsoft
Copy link
Collaborator

wbsoft commented Apr 25, 2016

setuptools/distutils adjust the #! shebang line of the frescobaldi script. But using python3 frescobaldi from the git checkout should be just fine.

@uliska
Copy link
Collaborator Author

uliska commented May 6, 2016

OK, now I have a completely new system and have arrived at exactly the same point.
I have frescobaldi from latest master, python-ly from latest master.

Initially sip was missing (of course
Through Synaptic I installed first python3-sip, then pyqt5 was missing (of course).

Then in installed python3-pyqt5, which additionally installed

libqt5clucene5 (Version 5.3.2-3)
libqt5core5a (Version 5.3.2+dfsg-4+deb8u1)
libqt5dbus5 (Version 5.3.2+dfsg-4+deb8u1)
libqt5designer5 (Version 5.3.2-3)
libqt5gui5 (Version 5.3.2+dfsg-4+deb8u1)
libqt5help5 (Version 5.3.2-3)
libqt5network5 (Version 5.3.2+dfsg-4+deb8u1)
libqt5printsupport5 (Version 5.3.2+dfsg-4+deb8u1)
libqt5sql5 (Version 5.3.2+dfsg-4+deb8u1)

Now running python3 frescobaldi results in a Memory Access Error, which obviously happens in the main.main() call (not earlier).

$ python3 frescobaldi -V
Frescobaldi: 3.0.0
Python: 3.4.2
python-ly: unknown
Qt: 5.3.2
PyQt: 5.3.2
sip: 4.16.4
poppler: unknown
python-poppler-qt: unknown
OS: Linux-3.16.0-4-amd64-x86_64-with-LinuxMint-2-betsy

I'm stumbling over python-ly: unknown. As said, python-ly is run from the Git repository by adding its path to PYTHONPATH, which works (I can import ly in the python shell).

I could previously work with python2 when checking out the 2.19 branch. But actually I don't want to install the PyQt4 and Python2 stuff anymore. So right now I can't use Frescobaldi at all.

Any ideas?
Any ideas

@uliska
Copy link
Collaborator Author

uliska commented May 6, 2016

Narrowed it down: the Memory Access Error happens in remote/__init__.py line 43 socket.connectToServer(name) with the name being frescobaldi-1000-_0.

Does this help?

@uliska
Copy link
Collaborator Author

uliska commented May 7, 2016

I noticed the following, seemingly strange, thing:

remote.get() is only executed when remote.enabled() is true. But remote.init() is never executed. Can this be related?

@wbsoft
Copy link
Collaborator

wbsoft commented May 7, 2016

init() is called in setup() to start listening.

@uliska
Copy link
Collaborator Author

uliska commented May 7, 2016

Yes, but at least in my case setup() isn't called either. At least a print() in setup() doesn't get executed before the error occurs within get()

@wbsoft
Copy link
Collaborator

wbsoft commented May 7, 2016

Indeed, setup() is only called when the application is initialized and sets up listening for incoming connections (calling init()). get() is called much earlier, to check for a remote Frescobaldi. I don't know yet why the crash in connectToServer but it might have to do with memory allocation issues (e.g. objects are freed too quickly) or maybe bytes/unicode problems. I can't reproduce yet; everything works fine on Ubuntu 16.04 here.

@uliska
Copy link
Collaborator Author

uliska commented May 12, 2016

This is related to #826 but somewhat different, so I didn't want to "pollute" that other issue.

I have now fiddled around quite some more with print() debugging, starting by forcing the offending call in remote.get() to be omitted. However, the access violations are ubiquitous, and I can just postpone them by commenting out offending lines.

However, it seems to be related to mainwindow references when creating actions. For example it seems consistent that in menu.py in the menu_XXX() functions calls like

m.addAction(ac.file_open)

work while any call with a reference to mainwindow causes the memory access violation, e.g.:

m.addMenu(snippet.menu.TemplateMenu(mainwindow))
# or
m.addAction(panelmanager.manager(mainwindow).snippettool.actionCollection.file_save_as_template)

@wbsoft
Copy link
Collaborator

wbsoft commented May 12, 2016

which python3, sip and pyqt5 versions are you using?

@uliska
Copy link
Collaborator Author

uliska commented May 13, 2016

Copied from a few comments above:

$ python3 frescobaldi -V
Frescobaldi: 3.0.0
Python: 3.4.2
python-ly: 0.9.4
Qt: 5.3.2
PyQt: 5.3.2
sip: 4.16.4
poppler: unknown
python-poppler-qt: unknown
OS: Linux-3.16.0-4-amd64-x86_64-with-LinuxMint-2-betsy

@andrewbernard
Copy link
Contributor

Hi Urs,

Re this above:

However, it seems to be related to mainwindow references when creating actions.

I am now getting the same thing on Debian 8.4, so we are at least converging on the location of the issue. I have no idea how to solve this, but since it does not occur on Ubuntu or openSUSE, it may be a Debian specific Qt5 issue I suspect.

Are you on Mint, rather than pure Debian? There are of course differences between those two distros.

@anthonyfok
Copy link
Contributor

I don't have much luck either getting Frescobaldi v3 (Python 3, Qt5) to work in Linux Mint 2 "Betsy" (tracking Debian Jessie). While I get different errors depending on how complete I have installed Frescobaldi's dependencies, or on what command-line arguments I give (e.g. -n), I find that the segfaults happens consistently at the call to strlen() (libc) in PyUnicode_FromString() (Qt5), so that could be a hint.

Perhaps there is some kind of incompatibility with the older Python 3, Qt5, PyQt5 and SIP in Debian jessie? Or perhaps it is yet another ABI error that requires rebuilding? That I do not yet know.

Until a solution is found, I recommend installing Debian stretch (testing) in VirtualBox. Frescobaldi v3 runs nearly perfectly in Debian stretch/sid, and all of Frescobaldi 3's dependencies, including python3-poppler-qt5 and python3-ly, are already packaged, so the only thing that needs to be downloaded is Frescobaldi itself, from GitHub.

@uliska
Copy link
Collaborator Author

uliska commented Oct 11, 2016

I have done a slightly different workaround by installing Ubuntu MATE 16.04 on an empty partition of my hard disk.

I've written a report of what was necessary to install Frescobaldi on that clean distribution and added it here: https://github.com/wbsoft/frescobaldi/wiki/Running-Frescobaldi-3-From-Source-Git-(Linux)

I think this information is useful, and so I'd ask anyone to review and possible improve or extend it.

@fedelibre
Copy link
Member

As Frescobaldi 3 seems to run fine in "modern" distros... it looks like a stale issue. Should be closed?

@uliska
Copy link
Collaborator Author

uliska commented Jun 24, 2018

BTW @fedelibre thank you for going through these old issues.

@uliska uliska closed this as completed Jun 24, 2018
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

5 participants