bordaigorl / remy

Remy, an online&offline manager for the reMarkable tablet
GNU General Public License v3.0
279 stars 13 forks source link

Installing in virtualenv #5

Closed ijpulidos closed 3 years ago

ijpulidos commented 3 years ago

I cannot manage to install this inside a virtualenv (using python 3.7.9), the first issue is with it not finding the module sipdistutils with error message ModuleNotFoundError: No module named 'sipdistutils'. As per https://github.com/frescobaldi/python-poppler-qt5/issues/14 the sip install from PIP doesn't include the sipdistutils.py file so you can copy it manually as they explain in that issue as a workaround.

After that running pip3 install -r requirements.txtagain I get the following error message: ModuleNotFoundError: No module named 'sipconfig'. Which points towards a similar problem as with sipdistutils.py. A workaround again is suggested in https://github.com/frescobaldi/frescobaldi/issues/992#issuecomment-432729990 , which is copying the system's sipconfig.py file to the virtualenv, in my case it was with something like cp /usr/lib/python3.9/site-packages/sipconfig.py env/lib/python3.7/site-packages (yeah, I have py3.9 in the system but remy requires 3.7 because of the simplification package, afaik).

A third time running pip3 install -r requirements.txt I get a ModuleNotFoundError: No module named 'PyQt5'. So I go ahead and install manually PyQt5 with pip3 install PyQt5==5.14.2 (pip cannot handle the order sometimes when using a requirements.txt file).

Then, the fourth time I run pip3 install -r requirements.txt it advances more but resulting in the following nasty error error: command '/usr/bin/sip' failed with exit status 1 along with many other lines (complete error at https://gist.github.com/ijpulidos/3bc11e535a93e59ef1e91d23e5cad7d4 ). And even though I have /usr/bin/sip in my system it fails (sip in system is 4.19.x). I would've thought that the sip command should come with the sip package from PyPI, but apparently that's not the case. SO in the end, this is one big mess to install remy inside a virtualenv, which is desired for those whose OS python's version is >3.7, since the simplification dependency for remy needs 3.7.x.

Better support for virtualenv (if even possible) would be nice to have.

bordaigorl commented 3 years ago

Hi! Installing the dependencies of reMy is the major source of frustration with it at the moment. I was planning to add some instructions but had no time to do that.

What worked for me when I tried to do a fresh install last time was as follows. This assumes MacOs with brew and pyenv but I don't see why in principle it cannot be ported to other environments.

First, with pyenv I made sure I was using Python 3.8.2. That's the version I use and simplification is compatible with it.

By the way, simplification is not essential, it's there because of some experiments I was doing with interpolating the curves. I plan to make it optional so that if you don't need those features the rest works fine without the dependency installed.

Then I did

brew install cmake poppler
pip install requests arrow paramiko PyPDF2 PyQt5 simplification sip
pip install git+https://github.com/mitya57/python-poppler-qt5.git@sip5

So I needed poppler and for some reason cmake was also a dependency for building stuff. Then the next pip install installs the basic dependencies of reMy apart from python-poppler-qt5. Note I am installing the standard sip.

Then, to get the stubborn python-poppler-qt5 to install you need to use a patched version that has not been merged in the main repo yet: https://github.com/frescobaldi/python-poppler-qt5/pull/41

Basically, the official version depends on old and deprecated (I think) versions of sip, and was not updated to support a modern installation method. The pull request above adapts it to use the latest version of SIP. This worked fine for me. If you could test that and let me know it would be very helpful. Ideally we would be able to put this info in the README.

ijpulidos commented 3 years ago

Following the pip instructions exactly as you pointed seemed to work fine. Thanks!