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

Cannot pip install KDEpy on Ubuntu 16.04.1 #11

Closed
luke-skywalker opened this issue Jan 16, 2019 · 3 comments
Closed

Cannot pip install KDEpy on Ubuntu 16.04.1 #11

luke-skywalker opened this issue Jan 16, 2019 · 3 comments
Assignees

Comments

@luke-skywalker
Copy link

First things first, thank you for this amazing piece of work :)

As per title, I failed at pip installing KDEpy using pip on Ubuntu 16.04.1. Minimum system info follows.

$ uname -a 
Linux #hostname# 4.15.0-43-generic #46~16.04.1-Ubuntu SMP Fri Dec 7 13:31:08 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ python3 --version
Python 3.5.2

To be sure it isn't something with my system configuration I did the following.

  1. I created a venv
$ mkdir /tmp/throwaway
$ python3 -m venv /tmp/throwaway
$ source /tmp/throwaway/bin/activate
  1. I updated pip and installed wheel
(throwaway) $ pip install --upgrade pip
(throwaway) $ pip install wheel
  1. I tried to pip install KDEpy
(throwaway) $ pip install kdepy

I put what I believe to be the relevant output, please ask for more info and I'd be happy to help!

  creating build/temp.linux-x86_64-3.5/KDEpy
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/tmp/throwaway/include -I/usr/include/python3.5m -c KDEpy/cutils.c -o build/temp.linux-x86_64-3.5/KDEpy/cutils.o
  KDEpy/cutils.c:4:20: fatal error: Python.h: No such file or directory
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for kdepy
  Running setup.py clean for kdepy
Failed to build kdepy
Installing collected packages: numpy, scipy, six, cycler, kiwisolver, pyparsing, python-dateutil, matplotlib, kdepy
  Running setup.py install for kdepy ... error
    Complete output from command /tmp/throwaway/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-zk12zrwc/kdepy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-mfnxe_0g/install-record.txt --single-version-externally-managed --compile --install-headers /tmp/throwaway/include/site/python3.5/kdepy:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/KDEpy
    copying KDEpy/BaseKDE.py -> build/lib.linux-x86_64-3.5/KDEpy
    copying KDEpy/FFTKDE.py -> build/lib.linux-x86_64-3.5/KDEpy
    copying KDEpy/bw_selection.py -> build/lib.linux-x86_64-3.5/KDEpy
    copying KDEpy/kernel_funcs.py -> build/lib.linux-x86_64-3.5/KDEpy
    copying KDEpy/binning.py -> build/lib.linux-x86_64-3.5/KDEpy
    copying KDEpy/__init__.py -> build/lib.linux-x86_64-3.5/KDEpy
    copying KDEpy/utils.py -> build/lib.linux-x86_64-3.5/KDEpy
    copying KDEpy/TreeKDE.py -> build/lib.linux-x86_64-3.5/KDEpy
    copying KDEpy/NaiveKDE.py -> build/lib.linux-x86_64-3.5/KDEpy
    running build_ext
    building 'cutils' extension
    creating build/temp.linux-x86_64-3.5
    creating build/temp.linux-x86_64-3.5/KDEpy
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/tmp/throwaway/include -I/usr/include/python3.5m -c KDEpy/cutils.c -o build/temp.linux-x86_64-3.5/KDEpy/cutils.o
    KDEpy/cutils.c:4:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/tmp/throwaway/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-zk12zrwc/kdepy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-mfnxe_0g/install-record.txt --single-version-externally-managed --compile --install-headers /tmp/throwaway/include/site/python3.5/kdepy" failed with error code 1 in /tmp/pip-install-zk12zrwc/kdepy/
@tommyod
Copy link
Owner

tommyod commented Jan 16, 2019

Thanks for letting me know about this @luke-skywalker .The following works for me.

My machine

$ uname -a         
Linux tommy-desktop 4.15.0-43-generic #46~16.04.1-Ubuntu SMP Fri Dec 7 13:31:08 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Create new environment, install KDEpy

$ conda create -n throwaway python=3.7 numpy scipy pytest cython setuptools wheel
$ conda activate throwaway
$ pip install KDEpy
$ python
>>> import KDEpy
>>> exit()
$ conda deactivate

Try the following.

  • Make sure you have dependencies installed, i.e. numpy scipy pytest cython setuptools wheel, see requirements.txt for a full list.
  • If it's not on your system, run sudo apt install libpython3.6-dev.

@tommyod tommyod self-assigned this Jan 16, 2019
@luke-skywalker
Copy link
Author

luke-skywalker commented Jan 17, 2019

@tommyod, thank you so much for your prompt reply!
sudo apt install libpython3.5-dev solved it for me (I have Python 3.5.2 on my system).
All the other dependencies seem to be correctly handled by pip. Thanks again for your help. I don't know if it might be worth mentioning in the installation instructions that Ubuntu might need the Python dev headers. Anyway, this solved it. Again, thank you!

@tommyod
Copy link
Owner

tommyod commented Jan 17, 2019

Glad to hear @luke-skywalker . I've added a note about this in the README, in case others have trouble in the future too. May the force be with you.

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

2 participants