flupke / pypotrace

Python bindings for potrace library
Other
165 stars 43 forks source link

numpy not auto-installed with pip #31

Closed myselfhimself closed 4 years ago

myselfhimself commented 4 years ago

Example code on Linux showing that numpy is not auto-installed... Maybe the numpy requirements is either not yet on pypi.org or not written in the proper file for pip to go and grab it:

~/Productions/GMIC/pypotracetest$ mkvirtualenv -p /usr/bin/python3 pypotrace
Running virtualenv with interpreter /usr/bin/python3
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/AAA/.virtualenvs/pypotrace/bin/python3
Also creating executable in /home/AAA/.virtualenvs/pypotrace/bin/python
Installing setuptools, pip, wheel...
done.
virtualenvwrapper.user_scripts creating /home/AAA/.virtualenvs/pypotrace/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/AAA/.virtualenvs/pypotrace/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/AAA/.virtualenvs/pypotrace/bin/preactivate
virtualenvwrapper.user_scripts creating /home/AAA/.virtualenvs/pypotrace/bin/postactivate
virtualenvwrapper.user_scripts creating /home/AAA/.virtualenvs/pypotrace/bin/get_env_details
(pypotrace) AAA@AAA-ThinkPad-T400:~/Productions/GMIC/pypotracetest$ pip install -r requirements.txt 
Collecting pypotrace
  Downloading pypotrace-0.2.tar.gz (26 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/AAA/.virtualenvs/pypotrace/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xtcpu1al/pypotrace/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xtcpu1al/pypotrace/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-xtcpu1al/pypotrace/pip-egg-info
         cwd: /tmp/pip-install-xtcpu1al/pypotrace/
    Complete output (16 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-xtcpu1al/pypotrace/setup.py", line 4, in <module>
        setup()
      File "/tmp/pip-install-xtcpu1al/pypotrace/cysetuptools.py", line 149, in setup
        parsed_setup_cfg = parse_setup_cfg(fp, cythonize=cythonize)
      File "/tmp/pip-install-xtcpu1al/pypotrace/cysetuptools.py", line 222, in parse_setup_cfg
        return _expand_cython_modules(config, cythonize, pkg_config, base_dir)
      File "/tmp/pip-install-xtcpu1al/pypotrace/cysetuptools.py", line 231, in _expand_cython_modules
        pkg_config, base_dir)
      File "/tmp/pip-install-xtcpu1al/pypotrace/cysetuptools.py", line 252, in _expand_one_cython_module
        include_dirs = _eval_strings(include_dirs)
      File "/tmp/pip-install-xtcpu1al/pypotrace/cysetuptools.py", line 281, in _eval_strings
        ret.append(eval(value[5:-1]))
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'numpy'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
flupke commented 4 years ago

Hi, you have to install numpy first, as stated in the README :)

myselfhimself commented 4 years ago

Hello, I am myself a python package developer and have managed to spare people from installing such dependencies manually... something is possibly not set properly in the setup.py... I could come with a PR in the coming months...

myselfhimself commented 4 years ago

Sorry for the disturbance, I have seen the required binary dependencies as well (packages). It seems that the aim of this project in terms of packaging is not to distribute binary packages, but provide a source package that needs the user to install other things first. This is all OK. Other Python modules do manage their dependencies themselves (eg. numpy itself, scipy.. all packages that have also auditwheel repair working to embed .so files), but on the one hand this requires a lot of work. It seems out of roadmap for this module and I understand it and will not bother more

flupke commented 4 years ago

You don't bother, no worries :)

The issue here is numpy has to be installed get its include dir and build the C extensions: https://github.com/flupke/pypotrace/blob/76c76be2458eb2b56fcbd3bec79b1b4077e35d9e/setup.cfg#L38

So, numpy has to be installed before running the setup. You normally do that by adding it to setup_requires, but IIRC this did not work last time I tried.

Please give it a shot if you have time, it would be nice to have the install work without manual intervention.