Open npfernandeztheillet opened 5 years ago
That’s a weird error.
libpython
installed? (conda install libpython
if you use anaconda)PATH
?Also, if you're running this in a virtual environment, did you install basic packages like setuptools
or wheel
?
Yes, Yes, and Yes. Also I tried to install in a windows computer, locally and I got this error (I have alreadey install Vs build tools):
ERROR: Failed building wheel for costsensitive Running setup.py clean for costsensitive Failed to build costsensitive ERROR: Could not build wheels for costsensitive which use PEP 517 and cannot be installed directly
Well, the issue is that for some reason the compiler cannot find Python’s C headers. It’s not really related to this package as you’ll experience the same error if e.g. you try to run MCMC samplers from pymc3
that compile on-the-fly.
For MSVC by the way you specifically need to install the msvc140
tools, which is not selected by default (nowadays getting an MSVC or MSVC build-tools installation to work properly with Python is an odyssey, and if you don’t set it as default you’ll still need to compile with python setup.py install --compiler=msvc
).
The solutions I see are:
pip install costsensitive=0.1.1
).setup.py
file and add the path to those headers as option -I
. I’m not sure if it would require additional libraries passed to -l:
though.python
in the console has its own separate libpython
.source activate <env. name>
in linux, same without the source
in windows), install libpython
in that specific environment, and try again.I've now run into this issue when using linux with a python install from system repositories.
The solution is to install system packages named like libpython
and python-dev
or python-devel
, or to stick to anaconda.
Hi David, how are you? I hope you are well.
I tried to install the library but I got this error:
Collecting costsensitive Using cached https://files.pythonhosted.org/packages/08/01/9d8a0c5c07db31ba8b17ccc0506db0d899ef342a9a57fa937b9b8b01c066/costsensitive-0.1.2.10.tar.gz Requirement already up-to-date: cython in /home/notebooks/venv/lib/python3.6/site-packages (from costsensitive) Requirement already up-to-date: joblib>=0.13 in /home/notebooks/venv/lib/python3.6/site-packages (from costsensitive) Collecting numpy (from costsensitive) Downloading https://files.pythonhosted.org/packages/19/b9/bda9781f0a74b90ebd2e046fde1196182900bd4a8e1ea503d3ffebc50e7c/numpy-1.17.0-cp36-cp36m-manylinux1_x86_64.whl (20.4MB) 100% |████████████████████████████████| 20.4MB 96kB/s s eta 0:00:01 Requirement already up-to-date: scipy in /home/notebooks/venv/lib/python3.6/site-packages (from costsensitive) Building wheels for collected packages: costsensitive Running setup.py bdist_wheel for costsensitive ... error Complete output from command /home/notebooks/venv/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-652t1zkx/costsensitive/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmp6frkpu00pip-wheel- --python-tag cp36: usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: -c --help [cmd1 cmd2 ...] or: -c --help-commands or: -c cmd --help
error: invalid command 'bdist_wheel'
Failed building wheel for costsensitive Running setup.py clean for costsensitive Failed to build costsensitive Installing collected packages: numpy, costsensitive Found existing installation: numpy 1.16.4 Uninstalling numpy-1.16.4: Successfully uninstalled numpy-1.16.4 Running setup.py install for costsensitive ... error Complete output from command /home/notebooks/venv/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-652t1zkx/costsensitive/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-08s1e5tx-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/notebooks/venv/include/site/python3.6/costsensitive: running install running build running build_py creating build creating build/lib.linux-x86_64-3.6 creating build/lib.linux-x86_64-3.6/costsensitive copying costsensitive/init.py -> build/lib.linux-x86_64-3.6/costsensitive running build_ext cythoning costsensitive/vwrapper.pyx to costsensitive/vwrapper.c /home/notebooks/venv/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-build-652t1zkx/costsensitive/costsensitive/vwrapper.pyx tree = Parsing.p_module(s, pxd, full_module_name) building 'costsensitive._vwrapper' extension creating build/temp.linux-x86_64-3.6 creating build/temp.linux-x86_64-3.6/costsensitive x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/notebooks/venv/lib/python3.6/site-packages/numpy/core/include -I/home/notebooks/venv/include -I/usr/include/python3.6m -c costsensitive/vwrapper.c -o build/temp.linux-x86_64-3.6/costsensitive/vwrapper.o -O2 -march=native -std=c99 -fopenmp costsensitive/vwrapper.c:4:10: fatal error: Python.h: No such file or directory
include "Python.h"
Command "/home/notebooks/venv/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-652t1zkx/costsensitive/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-08s1e5tx-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/notebooks/venv/include/site/python3.6/costsensitive" failed with error code 1 in /tmp/pip-build-652t1zkx/costsensitive/