MacOS build issues lstdc++ not found while building python package - python

While trying to install python dependencies on MacOS I encountered a build error.
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1
I have xcode installed, and the xcode command line tools, and I use homebrew, so I have gcc 9.1 installed via homebrew.
Another concerning thing I see in the build is this:
ERROR: running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.7
my concern being that I'm not sure what macosx-10.7 refers to? I'm running mojave (10.14) and xcode is version 10.2.1, so what does 10.7 refer to?

Surprisingly enough, this seems to do the trick (for bash):
export MACOSX_DEPLOYMENT_TARGET=10.9
I'm still not sure what 10.7 is vs 10.9, but this line in the error log:
move to libc++ with a minimum deployment target of OS X 10.9
lead to me discovering that exporting the deployment target effectively did what it was asking for.

Related

Issues installing python package on windows

I'm trying to install python-rocksdb on a windows 10 machine and I'm coming across some issues with the install.
I have successfully installed rocksdb first using the vcpkg method.
When running pip install python-rocksdb I get the following error:
cl : Command line error D8021 : invalid numeric argument '/Wextra'
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
Looking around suggested attempting to install with GCC or G++, so I downloaded cygwin and then attempted to install the python package using
pip install --global-option build_ext --global-option --compiler=cygwin python-rocksdb which yielded the following error:
gcc: error: unrecognized command-line option ‘-mcygwin’
error: command 'C:\\cygwin64\\bin\\gcc.exe' failed with exit code 1
This post seems to suggest that you need to use g++ specifically, but it looks like the cygwin command is defaulting to gcc.
Just note that I'm not using the virtual env with python.
Any assistance is greatly appreciated.

Saxonc python extension issue with macOs

I am trying to install saxonC extension for python in mac OS for xml transformation using xsl and i am getting the below error when i run "python3 saxon-setup.py build_ext -if" as mentioned in the documentation here: https://www.saxonica.com/saxon-c/documentation11/index.html#!starting/installingpython
Error: clang: error: no such file or directory: '../DocumentBuilder.cpp'
clang: error: no input files
error: command '/usr/bin/clang' failed with exit code 1
Run the following command to escape the unsigned library issue:
xattr -d -r com.apple.quarantine libsaxon-HEC-11.3/libsaxonhec.dylib
The SaxonC libsaxonhec.dylib library is an x86_64 file. Therefore the executables for the samples, Python and PHP extension also need to be built as an x86_64 file.
The following command for building the SaxonC python extension should work:
arch -x86_64 python3 saxon-setup.py build_ext -if
Unfortunately python3 needs to be run as x86_64:
arch -x86_64 python3 saxon_example3.py
SaxonC 12.0 now supports M1 chip. Also SaxonC is available as a Pypi package which will make installation easier. See: https://pypi.org/user/saxonica/

Failed scipy installation

I need to install scipy 1.2.0 for python2.7 il local on a machine running rhel fedora 6.5 where I do not have sudo permissions.
I have already installed python2.7, numpy, ATLAS and openblas.
Now when I run #python2.7 setup.py build" I get this error:
/home/gspirito/Python-2.7.14/scipy-1.2.0/scipy/cluster/_vq.c:8344: undefined reference to `PyInt_FromLong'
build/temp.linux-x86_64-2.7/scipy/cluster/_vq.o: In function `__Pyx_InitCachedConstants':
/home/gspirito/Python-2.7.14/scipy-1.2.0/scipy/cluster/_vq.c:8134: undefined reference to `PyTuple_Pack'
build/temp.linux-x86_64-2.7/scipy/cluster/_vq.o: In function `__Pyx_modinit_type_import_code':
/home/gspirito/Python-2.7.14/scipy-1.2.0/scipy/cluster/_vq.c:8395: undefined reference to `PyImport_ImportModule'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgfortranbegin.a(fmain.o): In function `main':
(.text+0x26): undefined reference to `MAIN__'
collect2: ld returned 1 exit status
error: Command "/usr/bin/gfortran -Wall -g -L/home/gspirito/src/zlib-1.2.8/lib -L/home/gspirito/packages/include/lzma -L/home/gspirito/src/postgresql-8.4.1/lib -L/home/gspirito/vargenius_bin/R-3.4.1/lib -L/home/gspirito/packages/lib build/temp.linux-x86_64-2.7/scipy/cluster/_vq.o -L/home/gspirito/Python-2.7.14/ATLAS/my_build_dir/lib -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -Lbuild/temp.linux-x86_64-2.7 -latlas -latlas -latlas -lgfortran -o build/lib.linux-x86_64-2.7/scipy/cluster/_vq.so -Wl,--version-script=build/temp.linux-x86_64-2.7/link-version-scipy.cluster._vq.map" failed with exit status 1
Does anyone know how to solve it?
Thanks in advance
The error message displayed essentially says that the linker failed to link all the compiled libraries. The exit status 1 implies that there were several errors before linking thus ld exits. From the Scipy Install page you can essentially see the list of supported python distributions.
For many users, especially on Windows, the easiest way to begin is to
download one of these Python distributions, which include all the key
packages:
Anaconda: A free distribution of Python with scientific packages.
Supports Linux, Windows and Mac.
Enthought Canopy: The free and commercial versions include the core
scientific packages. Supports Linux, Windows and Mac.
Python(x,y): A free distribution including scientific packages, based
around the Spyder IDE. Windows and Ubuntu; Py2 only.
WinPython: Another free distribution including scientific packages and
the Spyder IDE. Windows only, but more actively maintained and
supports the latest Python 3 versions.
Pyzo: A free distribution based on Anaconda and the IEP interactive
development environment. Supports Linux, Windows and Mac.

Error compiling PyGraphviz 1.2 on OSX Mavericks with Xcode 5

G'day everyone,
I am trying to install PyGraphviz 1.2 on OSX Mavericks. I have just upgraded from Mountain Lion and now have Xcode 5.0.1 installed with Command Line Tools. I have downloaded the PyGraphviz source package, unpacked it and ran sudo python setup.py install.
I am getting the following error message (there is some output prior to this, including several warnings):
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.9-intel-2.7/pygraphviz/graphviz_wrap.o -L/usr/local/lib/graphviz -L/usr/local/lib/graphviz -lcgraph -lcdt -o build/lib.macosx-10.9-intel-2.7/pygraphviz/_graphviz.so
ld: library not found for -lcgraph
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
Also, the first two lines of output are:
library_path=/usr/local/lib/graphviz
include_path=/usr/local/include/graphviz
which leads me to believe that compiler knows where to look for libraries.
What could be the problem? Just to make things clear: for technical reasons I have to use Apple's version of Python 2.7 and everything works fine on my other machine with OSX Lion and Xcode 4... (not sure what the exact version is).
I had a same error and resolved it by installing command line tools for XCode. Assuming you upgraded your XCode to 5.0.1, you can install command line tools by typing "xcode-select --install" to terminal and it will prompt you to install command line tools.

Installing Ephem package in Python 3

I would like to install the ephem package in my Python 3.3.0 version under Windows XP.
I tried first the pip install ephem route from the system command prompt. The process aborted with the error message of Unable to find vcvarsall.bat.
I read prior advice on the net for such a difficulty. Following it I installed mingw32 in my computer, added C:\MinGW\bin to the PATH variable and provided Lib / distutils with a new file called distutils.cfg and the content:
[build]
compiler=mingw32
On running now any of the install commands (pip, *easy_install* and setup.py all work the same) the following error results:
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Ilibastro-3.7.5 -IC:\Python33\
include -IC:\Python33\include -c extensions/_libastro.c -o build\temp.win32-3.3\
Release\extensions\_libastro.o
cc1.exe: error: unrecognised command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
I have tried to understand and solve the problem, but have been unsuccesful. I have not been able even to find the place in the code where such values are established.
¿Could somebody provide any help? ¿Would ephem be one of the cases alluded by Installing Python modules in the 3.3.0 Documentation with "Not all extensions can be built with MinGW or Cygwin, but many can."?
Thanks in advance
Paco
Here is an extremely useful page of Windows binaries of python packages: http://www.lfd.uci.edu/~gohlke/pythonlibs/.
It includes binaries for pyephem.

Categories

Resources