mwshinn / CanD

6 stars 3 forks source link

Install also dependencies when installing a package #5

Open jankaWIS opened 3 years ago

jankaWIS commented 3 years ago

Hii @mwshinn, I have just been installing your package (on Win) and got into missing dependencies (paranoid). I have noticed then that you're also responsible for that package. Would it be possible to install those (and possibly other) dependencies along the way as it is done eg when one uses conda or pip? Just to make it more user friendly. Besides that one just fyi I was also missing fitz which I have not seen in the list of dependencies (I guess it's under PyMuPDF but it's not that obvious).

mwshinn commented 3 years ago

It should already happen if you do "python setup.py install" to install it. Do you get different behavior?

jankaWIS commented 3 years ago

That is how I have done it before writing the comment. I have not tested it since (if you mean that), I can try to do it again.

syncrostone commented 3 years ago

I used python setup.py install to install, but I got errors on install and had to install paranoid and PyMuPDF manually before python setup.py install would run error-free.

mwshinn commented 3 years ago

I think the latest push should fix the problem. Essentially, CanD installation accidentally depended on these packages. Let me know if you are still getting errors.

syncrostone commented 3 years ago

EDIT: I resolved this by doing python3.7 -m pip install PyMuPDF separately, and then rerunning python3.7 setup.py install and it worked and the rest of the dependencies installed. I'm not sure why PyMuPDF wouldn't install without this separate command, but will leave this comment here in case it happens to anyone else.

I just tried in a clean venv (on a linux system where I don't have full privileges and can't use conda). I get the following error, which is likely not related to CanD but I'm not totally sure. I did not have this issue previously when I manually installed the missing packages, but in this venv I can't seem to get it to work:

`$ python3.7 setup.py install running install running bdist_egg running egg_info creating CanD.egg-info writing CanD.egg-info/PKG-INFO writing dependency_links to CanD.egg-info/dependency_links.txt writing requirements to CanD.egg-info/requires.txt writing top-level names to CanD.egg-info/top_level.txt writing manifest file 'CanD.egg-info/SOURCES.txt' reading manifest file 'CanD.egg-info/SOURCES.txt' writing manifest file 'CanD.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py creating build creating build/lib creating build/lib/cand copying cand/init.py -> build/lib/cand copying cand/fontant.py -> build/lib/cand copying cand/canvas.py -> build/lib/cand copying cand/_version.py -> build/lib/cand copying cand/metrics.py -> build/lib/cand creating build/bdist.linux-x86_64 creating build/bdist.linux-x86_64/egg creating build/bdist.linux-x86_64/egg/cand copying build/lib/cand/init.py -> build/bdist.linux-x86_64/egg/cand copying build/lib/cand/fontant.py -> build/bdist.linux-x86_64/egg/cand copying build/lib/cand/canvas.py -> build/bdist.linux-x86_64/egg/cand copying build/lib/cand/_version.py -> build/bdist.linux-x86_64/egg/cand copying build/lib/cand/metrics.py -> build/bdist.linux-x86_64/egg/cand byte-compiling build/bdist.linux-x86_64/egg/cand/init.py to init.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/cand/fontant.py to fontant.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/cand/canvas.py to canvas.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/cand/_version.py to _version.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/cand/metrics.py to metrics.cpython-37.pyc creating build/bdist.linux-x86_64/egg/EGG-INFO copying CanD.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying CanD.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying CanD.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying CanD.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying CanD.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO zip_safe flag not set; analyzing archive contents... creating dist creating 'dist/CanD-0.0.1-py3.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing CanD-0.0.1-py3.7.egg Copying CanD-0.0.1-py3.7.egg to /scratch/jts58/test-cand/lib/python3.7/site-packages Adding CanD 0.0.1 to easy-install.pth file

Installed /scratch/jts58/test-cand/lib/python3.7/site-packages/CanD-0.0.1-py3.7.egg Processing dependencies for CanD==0.0.1 Searching for Pillow Reading https://pypi.org/simple/Pillow/ Downloading https://files.pythonhosted.org/packages/33/34/542152297dcc6c47a9dcb0685eac6d652d878ed3cea83bf2b23cb988e857/Pillow-8.2.0-cp37-cp37m-manylinux1_x86_64.whl#sha256=083781abd261bdabf090ad07bb69f8f5599943ddb539d64497ed021b2a67e5a9 Best match: Pillow 8.2.0 Processing Pillow-8.2.0-cp37-cp37m-manylinux1_x86_64.whl Installing Pillow-8.2.0-cp37-cp37m-manylinux1_x86_64.whl to /scratch/jts58/test-cand/lib/python3.7/site-packages Adding Pillow 8.2.0 to easy-install.pth file

Installed /scratch/jts58/test-cand/lib/python3.7/site-packages/Pillow-8.2.0-py3.7-linux-x86_64.egg Searching for PyMuPDF Reading https://pypi.org/simple/PyMuPDF/ Downloading https://files.pythonhosted.org/packages/41/f6/dbefe3d6949fa81fb7bcac9141e4345330d272724718ac5a6af78297498b/PyMuPDF-1.18.14.tar.gz#sha256=efe85cb80f79cc3f3890aa2ab82b962b8a999ca078e33e9bacc5d0be5c4656dc Best match: PyMuPDF 1.18.14 Processing PyMuPDF-1.18.14.tar.gz Writing /tmp/easy_install-m9ybyvmp/PyMuPDF-1.18.14/setup.cfg Running PyMuPDF-1.18.14/setup.py -q bdist_egg --dist-dir /tmp/easy_install-m9ybyvmp/PyMuPDF-1.18.14/egg-dist-tmp-u16_uuve fitz/fitz_wrap.c:2754:18: fatal error: fitz.h: No such file or directory

include

              ^

compilation terminated. error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1`

mwshinn commented 3 years ago

Looks like there is still something going on here. I will open this issue back up and take a closer look.

mwshinn commented 3 years ago

Could you please run the following three commands on the terminal of the computer which had this issue and post the output?

cat /etc/issue

uname -a

python3 -c "import setuptools; print(setuptools.__version__)"

Thanks!

syncrostone commented 3 years ago

cat /etc/issue

Ubuntu 16.04.7 LTS \n \l

uname -a

Linux [the machine name was here] 4.15.0-140-generic #144~16.04.1-Ubuntu SMP Fri Mar 19 21:24:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

python3 -c "import setuptools; print(setuptools.__version__)"

41.2.0

mwshinn commented 3 years ago

I can reproduce this in a VM using your version of setuptools if mupdf is not installed. For some reason, old versions seem to require mupdf (which pymupdf depends on) to be recompiled, rather than using the distributed binary. If you upgrade setuptools to the latest version (or at least major version 43), it should install normally.

syncrostone commented 3 years ago

Ah sounds good -- I'm not going to test to verify that now because my installation is working for me, but thank you for figuring it out!