When I try to install python-pcl(PCL is the point cloud library for presentation like laser radar data. I followed the instruction on https://github.com/strawlab/python-pcl ,and I have already copied travis/pcl-2d-1.8.pc file to /usr/local/lib/pkgconfig folder) in my computer. I typed AppledeMacBook-Pro-3:python-pcl-0.3.0rc1 apple$ python setup.py install in my terminal.Then I encountered a problem below:
running install
running bdist_egg
running egg_info
writing requirements to python_pcl.egg-info/requires.txt
writing python_pcl.egg-info/PKG-INFO
writing top-level names to python_pcl.egg-info/top_level.txt
writing dependency_links to python_pcl.egg-info/dependency_links.txt
reading manifest file 'python_pcl.egg-info/SOURCES.txt'
writing manifest file 'python_pcl.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-x86_64/egg
running install_lib
running build_py
running build_ext
skipping 'pcl/_pcl_180.cpp' Cython extension (up-to-date)
building 'pcl._pcl' extension
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/apple/miniconda3/include -I/Users/apple/miniconda3/include -DEIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET=1 -I/Users/apple/miniconda3/pkgs/python-3.5.4-h8f450c2_22/lib/python3.5/site-packages/numpy/core/include -I/usr/local/include/pcl-1.8 -I/usr/local/Cellar/openni/1.5.7.10/include/ni -I/usr/local/include/pcl-1.8 -I/usr/local/Cellar/flann/1.9.1_6/include -I/usr/local/include/pcl-1.8 -I/opt/local/include/eigen3 -I/usr/include/ni -I/usr/include/vtk-5.8 -I/usr/local/include/vtk-8.0 -I/usr/local/Cellar/vtk/8.0.1/include -I/Users/apple/miniconda3/pkgs/python-3.5.4-h8f450c2_22/include/python3.5m -c pcl/_pcl_180.cpp -o build/temp.macosx-10.6-x86_64-3.5/pcl/_pcl_180.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the
command line to use the libc++ standard library instead
[-Wstdlibcxx-not-found]
pcl/_pcl_180.cpp:447:10: fatal error: 'vector' file not found
#include <vector>
^~~~~~~~
Somebody says it has something to do with my Cython version. But I have already switched Cython to version 0.25.2, still not working. Does anyone have the same problem? Many thanks. By the way, my python version is 3.5.4 and my Mac Version is macOS Mojave 10.14.1
This is a special issue with current MacOS-installations. You could tweak setup.py and add, as the warning suggest, -std=libc++ to the compile-options, i.e.
from distutils.core import setup
from Cython.Build import cythonize
... some stuff
#passing `-stdlib=libc++` to compiler and linker:
ext_modules = [Extension(...,
language='c++',
extra_compile_args=["-stdlib=libc++"], # + anything else you need
extra_link_args= ["-stdlib=libc++"] # + anything else you need]
... some more stuff
I have also added -stdlib=libc++ to the linker options, because it will be probably the next problem you will run into.
More background: In the MacOS world, for long time, there where two different implementations of c++'s standard library: -libstdc++ associated with gcc and libc++ associated with clang. At the beginning-libstdc++ was also used per default with clang-compiler. However, this is no longer the case - it is not even installed now and that is the reason why the headers cannot be found. I'm not sure why your clang-version doesn't take libc++ per default - so you have to pass it manually to compiler/linker.
Related
I am trying to use the following package: https://github.com/vBaiCai/python-pesq and I am also using Pipenv and pyenv. I have installed 3.6-dev with pyenv and am using that with pipenv --python ~/.pyenv/versions/3.6-dev/bin/python3.
When I do pipenv install pypesq, I get a ton of errors, including:
file numpy.py (for module numpy) not found
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building 'pesq_core' extension
creating build/temp.macosx-10.15-x86_64-3.6
creating build/temp.macosx-10.15-x86_64-3.6/pypesq
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Users/shamoon/.pyenv/versions/3.6-dev/include/python3.6m -I/Users/shamoon/.pyenv/versions/3.6-dev/lib/python3.6/site-packages/numpy/core/include -c pypesq/pesq.c -o build/temp.macosx-10.15-x86_64-3.6/pypesq/pesq.o
pypesq/pesq.c:2:10: fatal error: 'arrayobject.h' file not found
#include "arrayobject.h"
^~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
I am on OS X if that matters. Any help.
I used pyenv to install Python 3.6-dev on Linux Mint 19.2 and I found two problems during installation pypesq:
1. It couldn't find arrayobject.h from module numpy
I used answer from Ubuntu forum fatal error: numpy/arrayobject.h: No such file or directory
I had to find folder with arrayobject.h and add it to environment variable CFLAGS so later C/C++ compiler will use it to find arrayobject.h- ie. (directly in terminal)
export CFLAGS="-I /usr/local/lib/python3.7/dist-packages/numpy/core/include/numpy/ $CFLAGS"
I was installing pypesq for Python 3.6-dev but I used path to numpy installed in Python 3.7 and there was no problem.
BTW: To find it I used shell command locate which is not standard command but it works much faster then find
2. It couldn't find pesq.h
Instead of using module from pip server I used code from GitHub which was updated yesterday
pipenv install https://github.com/vBaiCai/python-pesq/archive/master.zip
After that I could import it in Python 3.6-dev but I didn't test if it works correctly.
Im trying to crate a cryptosystem on the raspbian OS. Chose python and pycrypto because the OS comes with python 3.2.3 pre-installed. Moved the "pycrypto-2.6.1.tar.gz" to the folder where python files are located and extracted there. Suposed to build using the command "python setup.py build" and then install.
But during the build phase, keep getting the error:
"pi#raspberrypi /usr/lib/python3.2/pycrypto-2.6.1 $ python setup.py buildrunning build
running build_py
running build_ext
running build_configure
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash._MD2' extension
gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-armv6l-2.7/src/MD2.o
src/MD2.c:31:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
"
Not able to figure out whether I am supposed to change the pathing. Could somebody give an insight in to this?
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
The libgmp-dev package provides the necessary files to support building the optimized module here:
apt-get install libgmp-dev
src/MD2.c:31:20: fatal error: Python.h: No such file or directory
compilation terminated.
If you search for fatal error: Python.h: No such file or directory, the very first Google result is for this StackOverflow question, which tells you that you need to install the python-dev package:
apt-get install python-dev
In general, if you are building software from source you will need the corresponding -dev package for any required libraries; these packages provide header files (foo.h) and the unversioned shared libraries necessary for linking.
Im trying to install PyV8 from source . I had downloaded v8 from svn and then exported v8 homepath and tried to do a setup.py install on the pyv8 folder . Im getting a host of errors below ...
INFO: Found Google v8 base on V8_HOME </media/DATA/thug-honey/v8>
running install
running bdist_egg
running egg_info
creating PyV8.egg-info
writing requirements to PyV8.egg-info/requires.txt
writing PyV8.egg-info/PKG-INFO
writing top-level names to PyV8.egg-info/top_level.txt
writing dependency_links to PyV8.egg-info/dependency_links.txt
writing manifest file 'PyV8.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'PyV8.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building '_PyV8' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DBOOST_PYTHON_STATIC_LIB -DV8_NATIVE_REGEXP -DENABLE_DEBUGGER_SUPPORT -DV8_TARGET_ARCH_X64 -I/media/DATA/thug-honey/v8/include -I/media/DATA/thug-honey/v8 -I/media/DATA/thug-honey/v8/src -I/usr/lib/python2.7/dist-packages/boost -I/usr/include/python2.7 -c src/Utils.cpp -o build/temp.linux-x86_64-2.7/src/Utils.o -Wno-write-strings -g -O3
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from src/Locker.h:3:0,
from src/Utils.cpp:11:
src/Exception.h: In constructor ‘CJavascriptStackTrace::CJavascriptStackTrace(v8::Isolate*, v8::Handle<v8::StackTrace>)’:
src/Exception.h:43:43: error: no matching function for call to ‘v8::Persistent<v8::StackTrace>::Persistent(v8::Isolate*&, v8::Handle<v8::StackTrace>&)’
: m_isolate(isolate), m_st(isolate, st)
^
Can any body guide me to get pyv8 working
Or If i can find a debian package for PyV8
Since IMO PyV8 is not well maintained, it only really works with certain combinations of V8 builds and PyV8 builds. Beware of memory leaks as well, I needed to wrap it with some very specific cleanup code to get something stable. This approach is documented in the following issue:
https://code.google.com/p/pyv8/issues/detail?id=229&sort=-id
If I'd start over I would look into doing IPC between a node.js process and a python process to get the same functionality in a more stable and efficient manner.
I am trying to get cython to realize I have a c compiler in MinGW 32-bit and I've tried everything I can find on the web but it's still not working. I am running Windows 7 Professional 64-bit. Here is what I have tried:
(1) I have Python 2.7 and I just installed MinGW with options gcc and g++ and some other options
(2) I edited the PATH environmental variable so it includes
C:\MinGW\bin;C:\MinGW\MSYS\1.0\local\bin;C:\MinGW\MSYS\1.0\bin
(3) I told Python to use MinGW as the default compiler by creating a file named
C:\Python27\Lib\distutils\distutils.cfg, containing
[build]
compiler = mingw32
(I do have MinGW32 by the way)
(4) I removed all instances of -mno-cygwin from the file C:\Python27\Lib\distutils\cygwincompiler.py
(5) I have a file called setup.py and a module called tryingcython.pyx that is written in python. My setup.py says
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
cmdclass = {'build_ext':build_ext},
ext_modules=[Extension("tryingcython",["tryingcython.pyx"])]
)
So then I open Command Prompt and get into the directory that contains setup.py and tryingcython.pyx, and I type
python setup.py build_ext --inplace --compiler=mingw32
Then it tells me:
running build_ext
skipping 'tryingcython.c' Cython extension (up-to-date)
building 'tryingcython.c' extension
gcc -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c tryingcython.c -o build\
temp.win32-2.7\Release\tryingcython.o
error: command 'gcc' failed: No such file or directory
So I guess Cython can't tell that I have gcc and it can't find it or what, even though I've tried about every single piece of advice I can find online for making it realize that I have MinGW which has gcc included.
Any help/additional ideas on how I can get cython to actually work would be much appreciated.
You are using exactly the same operational system and versions than me.
Try to cal gcc using:
SET input=intput.c
SET output=output.pyd
gcc -shared -IC:\Python27\include -LC:\Python27\libs -O2 -o %output% %input% -lpython27
Usually I put this call in a cythongcc.bat file, in a directory recognized by the PATH environment variable as:
gcc -shared -IC:\Python27\include -LC:\Python27\libs -O3 -mtune=native -o %1.pyd %2.c -lpython27
So that I can , from where my cython .pyx files are, just do:
cython input.pyx
cythongcc input input
To get the compiled .pyd working!
I was trying to build this package I wrote (which I know to be working), first in the usual way through distutils:
# python2.7 setup.py build
running build
running build_py
running build_ext
building 'uptime._posix' extension
gcc -fno-strict-aliasing -Wno-error -march=i586 -DHAVE_DB_185_H -I/usr/pkg/include -I/usr/include -DNDEBUG -Wno-error -march=i586 -DHAVE_DB_185_H -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python2.7 -c src/_posix.c -o build/temp.minix-3-i686-2.7/src/_posix.o
ld -L/usr/tmp/work/lang/python27/work/Python-2.7.2 -lcompat_minix -minlib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib build/temp.minix-3- i686-2.7/src/_posix.o -o build/lib.minix-3-i686-2.7/uptime/_posix.so
ld: unrecognized option '-Wl,-R/usr/pkg/lib'
ld: use the --help option for usage information
build failed: uptime._posix (no big deal)
Well, fine; distutils is one of those modules that often break on less popular platforms. So I tried compiling the extension part manually:
# gcc -fno-strict-aliasing -march=i586 -DNDEBUG -I/usr/pkg/include/python2.7 -fPIC -shared -o _posix.so src/_posix.c
This worked—that is, it produced _posix.so without complaining—but, trying to import the resulting module in Python didn't:
>>> import _posix
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: Service unavailable
Google suggests this is related to the ability of the OS to load shared libraries (which Python extensions are). I went looking, and it turns out MINIX didn't support shared libraries at all until last year, but now it should. In fact, /usr/pkg/include/python2.7/pyconfig.h defines both HAVE_DLOPEN and HAVE_DYNAMIC_LOADING, so it clearly does.
What's going on?
MINIX does support shared libraries now, but the binary Python packages provided by pkgin are statically linked, which prevents them from being able to load shared libraries anyway. The only way around this is to compile Python yourself, ideally through pkgsrc. All pkgsrc packages are built dynamically by default.
(You'll still have to build the extensions manually, too.)