Attempt to compile Scipy on Android Termux Python 3.10 - python-3.x

I am deeply frustrated by rolling-releases of Termux with no regard to previous python releases and modules
Now I am compiling latest got version of Scipy but before that I am running
export BLAS=/data/data/com.termux/files/usr/lib/libblas.so
export LAPACK=/data/data/com.termux/files/usr/lib/liblapack.so
export CC=clang
export CPP=clang++
python runtests.py -v
https://scipy.github.io/devdocs/dev/contributor/runtests.html
There were some missing packages which I installed via pip
Following is the output & I need help here
Building, see build.log...
... build in progress (0:01:00.279236 elapsed)
Running from SciPy source directory.
scipy/linalg/_generate_pyx.py: all files up-to-date
scipy/special/_generate_pyx.py: all files up-to-date
Running scipy/linalg/_generate_pyx.py
Running scipy/special/_generate_pyx.py
Running scipy/stats/_generate_pyx.py
scipy/_lib/_ccallback_c.pyx has not changed
scipy/_lib/_test_deprecation_call.pyx has not changed
scipy/_lib/messagestream.pyx has not changed
scipy/cluster/_hierarchy.pyx has not changed
scipy/_lib/_test_deprecation_def.pyx has not changed
scipy/cluster/_vq.pyx has not changed
scipy/fftpack/convolve.pyx has not changed
scipy/interpolate/_bspl.pyx has not changed
scipy/cluster/_optimal_leaf_ordering.pyx has not changed
scipy/interpolate/_ppoly.pyx has not changed
scipy/interpolate/interpnd.pyx has not changed
scipy/io/matlab/_mio5_utils.pyx has not changed
scipy/io/matlab/_mio_utils.pyx has not changed
scipy/io/matlab/_streams.pyx has not changed
scipy/linalg/_cythonized_array_utils.pyx has not changed
scipy/linalg/_decomp_update.pyx.in has not changed
scipy/linalg/_matfuncs_expm.pyx.in has not changed
scipy/linalg/_matfuncs_sqrtm_triu.pyx has not changed
scipy/linalg/cython_blas.pyx has not changed
scipy/linalg/_solve_toeplitz.pyx has not changed
scipy/linalg/cython_lapack.pyx has not changed
scipy/ndimage/src/_cytest.pyx has not changed
scipy/ndimage/src/_ni_label.pyx has not changed
scipy/optimize/_bglu_dense.pyx has not changed
scipy/optimize/_group_columns.pyx has not changed
scipy/optimize/_highs/cython/src/_highs_constants.pyx has not changed
scipy/optimize/_highs/cython/src/_highs_wrapper.pyx has not changed
scipy/optimize/_lsq/givens_elimination.pyx has not changed
scipy/optimize/_trlib/_trlib.pyx has not changed
scipy/optimize/cython_optimize/_zeros.pyx.in has not changed
scipy/optimize/tnc/_moduleTNC.pyx has not changed
scipy/signal/_max_len_seq_inner.pyx has not changed
scipy/signal/_peak_finding_utils.pyx has not changed
scipy/signal/_sosfilt.pyx has not changed
scipy/signal/_spectral.pyx has not changed
scipy/signal/_upfirdn_apply.pyx has not changed
scipy/sparse/_csparsetools.pyx.in has not changed
scipy/sparse/csgraph/_flow.pyx has not changed
scipy/sparse/csgraph/_matching.pyx has not changed
scipy/sparse/csgraph/_min_spanning_tree.pyx has not changed
scipy/sparse/csgraph/_reordering.pyx has not changed
scipy/sparse/csgraph/_shortest_path.pyx has not changed
scipy/sparse/csgraph/_tools.pyx has not changed
scipy/sparse/csgraph/_traversal.pyx has not changed
scipy/spatial/_ckdtree.pyx has not changed
scipy/spatial/_hausdorff.pyx has not changed
scipy/spatial/_qhull.pyx has not changed
scipy/spatial/_voronoi.pyx has not changed
scipy/spatial/transform/_rotation.pyx has not changed
scipy/special/_comb.pyx has not changed
scipy/special/_ellip_harm_2.pyx has not changed
scipy/special/_test_round.pyx has not changed
scipy/special/_ufuncs.pyx has not changed
scipy/special/_ufuncs_cxx.pyx has not changed
scipy/special/cython_special.pyx has not changed
scipy/stats/_qmc_cy.pyx has not changed
scipy/stats/_sobol.pyx has not changed
scipy/stats/_biasedurn.pyx has not changed
scipy/stats/_stats.pyx has not changed
scipy/stats/_boost/src/beta_ufunc.pyx has not changed
scipy/stats/_boost/src/nbinom_ufunc.pyx has not changed
scipy/stats/_boost/src/binom_ufunc.pyx has not changed
scipy/stats/_boost/src/hypergeom_ufunc.pyx has not changed
scipy/stats/_boost/src/ncf_ufunc.pyx has not changed
scipy/stats/_levy_stable/levyst.pyx has not changed
scipy/stats/_unuran/unuran_wrapper.pyx has not changed
/data/data/com.termux/files/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py:102: _ExperimentalProjectMetadata: Support for project metadata in `pyproject.toml` is still experimental and may be removed (or change) in future releases.
warnings.warn(msg, _ExperimentalProjectMetadata)
Cythonizing sources
INFO: lapack_opt_info:
INFO: lapack_armpl_info:
INFO: customize UnixCCompiler
INFO: libraries armpl_lp64_mp not found in ['/data/data/com.termux/files/usr/lib']
INFO: NOT AVAILABLE
INFO:
INFO: lapack_mkl_info:
INFO: libraries mkl_rt not found in ['/data/data/com.termux/files/usr/lib']
INFO: NOT AVAILABLE
INFO:
INFO: openblas_lapack_info:
INFO: C compiler: clang -mfloat-abi=softfp -mfpu=vfpv3-d16 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb -fstack-protector-strong -O3 -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb -fstack-protector-strong -O3 -fPIC
creating /data/data/com.termux/files/usr/tmp/tmpw9i7rrqz/data
creating /data/data/com.termux/files/usr/tmp/tmpw9i7rrqz/data/data
creating /data/data/com.termux/files/usr/tmp/tmpw9i7rrqz/data/data/com.termux
creating /data/data/com.termux/files/usr/tmp/tmpw9i7rrqz/data/data/com.termux/files
creating /data/data/com.termux/files/usr/tmp/tmpw9i7rrqz/data/data/com.termux/files/usr
creating /data/data/com.termux/files/usr/tmp/tmpw9i7rrqz/data/data/com.termux/files/usr/tmp
creating /data/data/com.termux/files/usr/tmp/tmpw9i7rrqz/data/data/com.termux/files/usr/tmp/tmpw9i7rrqz
INFO: compile options: '-c'
INFO: clang: /data/data/com.termux/files/usr/tmp/tmpw9i7rrqz/source.c
INFO: clang /data/data/com.termux/files/usr/tmp/tmpw9i7rrqz/data/data/com.termux/files/usr/tmp/tmpw9i7rrqz/source.o -L/data/data/com.termux/files/usr/lib -lopenblas -o /data/data/com.termux/files/usr/tmp/tmpw9i7rrqz/a.out
INFO: FOUND:
INFO: libraries = ['openblas', 'openblas']
INFO: library_dirs = ['/data/data/com.termux/files/usr/lib']
INFO: language = c
INFO: define_macros = [('HAVE_CBLAS', None)]
INFO:
INFO: FOUND:
INFO: libraries = ['openblas', 'openblas']
INFO: library_dirs = ['/data/data/com.termux/files/usr/lib']
INFO: language = c
INFO: define_macros = [('HAVE_CBLAS', None)]
INFO:
non-existing path in 'scipy/linalg': 'src/lapack_deprecations/LICENSE'
INFO: blas_opt_info:
INFO: blas_armpl_info:
INFO: libraries armpl_lp64_mp not found in ['/data/data/com.termux/files/usr/lib']
INFO: NOT AVAILABLE
INFO:
INFO: blas_mkl_info:
INFO: libraries mkl_rt not found in ['/data/data/com.termux/files/usr/lib']
INFO: NOT AVAILABLE
INFO:
INFO: blis_info:
INFO: libraries blis not found in ['/data/data/com.termux/files/usr/lib']
INFO: NOT AVAILABLE
INFO:
INFO: openblas_info:
INFO: C compiler: clang -mfloat-abi=softfp -mfpu=vfpv3-d16 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb -fstack-protector-strong -O3 -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb -fstack-protector-strong -O3 -fPIC
creating /data/data/com.termux/files/usr/tmp/tmp0139l74e/data
creating /data/data/com.termux/files/usr/tmp/tmp0139l74e/data/data
creating /data/data/com.termux/files/usr/tmp/tmp0139l74e/data/data/com.termux
creating /data/data/com.termux/files/usr/tmp/tmp0139l74e/data/data/com.termux/files
creating /data/data/com.termux/files/usr/tmp/tmp0139l74e/data/data/com.termux/files/usr
creating /data/data/com.termux/files/usr/tmp/tmp0139l74e/data/data/com.termux/files/usr/tmp
creating /data/data/com.termux/files/usr/tmp/tmp0139l74e/data/data/com.termux/files/usr/tmp/tmp0139l74e
INFO: compile options: '-c'
INFO: clang: /data/data/com.termux/files/usr/tmp/tmp0139l74e/source.c
INFO: clang /data/data/com.termux/files/usr/tmp/tmp0139l74e/data/data/com.termux/files/usr/tmp/tmp0139l74e/source.o -L/data/data/com.termux/files/usr/lib -lopenblas -o /data/data/com.termux/files/usr/tmp/tmp0139l74e/a.out
INFO: FOUND:
INFO: libraries = ['openblas', 'openblas']
INFO: library_dirs = ['/data/data/com.termux/files/usr/lib']
INFO: language = c
INFO: define_macros = [('HAVE_CBLAS', None)]
INFO:
INFO: FOUND:
INFO: libraries = ['openblas', 'openblas']
INFO: library_dirs = ['/data/data/com.termux/files/usr/lib']
INFO: language = c
INFO: define_macros = [('HAVE_CBLAS', None)]
INFO:
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/scipy/setup.py", line 532, in <module>
setup_package()
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/scipy/setup.py", line 528, in setup_package
setup(**metadata)
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/numpy/distutils/core.py", line 135, in setup
config = configuration()
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/scipy/setup.py", line 438, in configuration
config.add_subpackage('scipy')
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 1054, in add_subpackage
config_list = self.get_subpackage(subpackage_name, subpackage_path,
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 1020, in get_subpackage
config = self._get_configuration_from_setup_py(
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 962, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/scipy/scipy/setup.py", line 18, in configuration
config.add_subpackage('optimize')
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 1054, in add_subpackage
config_list = self.get_subpackage(subpackage_name, subpackage_path,
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 1020, in get_subpackage
config = self._get_configuration_from_setup_py(
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 962, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/scipy/scipy/optimize/setup.py", line 130, in configuration
config.add_subpackage('_highs')
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 1054, in add_subpackage
config_list = self.get_subpackage(subpackage_name, subpackage_path,
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 1020, in get_subpackage
config = self._get_configuration_from_setup_py(
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/numpy/distutils/misc_util.py", line 962, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/scipy/scipy/optimize/_highs/setup.py", line 63, in configuration
_major_dot_minor = _get_version(
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/scipy/scipy/optimize/_highs/setup.py", line 50, in _get_version
with open(CMakeLists, 'r', encoding='utf-8') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/data/data/com.termux/files/usr/lib/python3.10/site-packages/scipy/scipy/_lib/highs/CMakeLists.txt'
Build failed! (0:01:17.306152 elapsed)

Clean Install Termux on Samsung Z Flip 4
https://www.youtube.com/watch?v=yDwxmF0Kn-Q
update
upgrade
apt install python (3.11.1 was installed)
To manage and access files in termux then you must type the below command
termux-setup-storage
pkg install tur-repo
pkg install python-scipy
connected phone via usb to a computer and copied my python scripts to phone downloads folder
cp ~/storage/downloads/file.py ~/ to run programs from termux home.
You get Deprecation Warnings for interp2d which will be replaced in scipy
so add to stop them at the top.
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
The end. ps
All woks fine and tested on 2d interpolation arrays.

I assume that what you want is the latest version of Scipy working in Termux.
I think you are making it difficult for yourself.
I managed to compile and install scipy 1.8.1 correctly for python 3.10.4 using only Termux.
First, get rid of all exports before installation. As a side note, if no CC env. variable is set, pip will use aarch64-linux-android-clang by default.
You don't need libblas.so and liblapack.so either.
It is indeed necessary to have the BLAS/LAPACK libraries when compiling Scipy, but you can simply get them by pkg in openblas.
Once done, a simple pip install scipy worked like a charm for me (it took me more than 15 minutes to build it, so be patient).
Hope it helps you ^^

Although I was unable to install Scipy via pip for Python 3.11, which is the current version used in Termux as of today, I managed to build Scipy 1.9.0 and install it manually.
Apart from some dependencies I installed via pkg, which were requested by the build system, such as pytest, I had to try with different versions of pip-installed libraries. The required libraries and versions that worked were:
beniget==0.4.1
Cython==0.29.32
distro==1.8.0
gast==0.5.3
meson==0.62.2
meson-python==0.7.0
mpmath==1.2.1
ninja==1.11.1
numpy==1.23.5
packaging==21.3
pip==22.3.1
ply==3.11
pybind11==2.9.2
pyparsing==3.0.9
pyproject-metadata==0.6.1
pythran==0.11.0
scikit-build==0.16.2
setuptools==65.6.3
tomli==2.0.1
wheel==0.37.1
I'm not sure if all of them are required. With them installed, I obtained the sources tarball for scipy-1.9.0, uncompressed it, and executed runtests.py (found in the root of the uncompressed tree).
After this, a working build of scipy was created in "build/lib.linux-aarch64-cpython-311/scipy", I copied it to the system package directory: "/data/data/com.termux/files/home/../usr/lib/python3.11/site-packages/", and now I can use scipy again.

Related

Encountered a problem while installing [ FastText ] library on MacOS

I have been trying to install the "FastText" library on macOS but I keep encountering a Runtime error.
System - MacOS: 13.0.1 (22A400)
Python Version: 3.10
IDE: Pycharm
I tried installing it from Pycharm but it did not work, then i tried using the Terminal and this is what i got.
pip3 install fasttext and sudo pip3 install fasttext
all resulted with the same error below:
Using cached fasttext-0.9.2.tar.gz (68 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pybind11>=2.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from fasttext) (2.10.2)
Requirement already satisfied: setuptools>=0.7.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from fasttext) (65.5.0)
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from fasttext) (1.21.4)
Building wheels for collected packages: fasttext
Building wheel for fasttext (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [67 lines of output]
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-cpython-310
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext
copying python/fasttext_module/fasttext/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext
copying python/fasttext_module/fasttext/FastText.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
copying python/fasttext_module/fasttext/util/util.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
copying python/fasttext_module/fasttext/util/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/test_script.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/test_configurations.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
running build_ext
creating var
creating var/folders
creating var/folders/xg
creating var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn
creating var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmpejxme0zs.cpp -o var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmpejxme0zs.o -stdlib=libc++
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmpyu7_bprq.cpp -o var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmpyu7_bprq.o -stdlib=libc++ -mmacosx-version-min=10.7
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/pip-install-mv_4oqbh/fasttext_1af9a5c892f74b668dc43e515183597f/setup.py", line 168, in <module>
setup(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 132, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
_build_ext.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
self.build_extensions()
File "/private/var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/pip-install-mv_4oqbh/fasttext_1af9a5c892f74b668dc43e515183597f/setup.py", line 131, in build_extensions
raise RuntimeError(
RuntimeError: libc++ is needed! Failed to compile with -stdlib=libc++ -mmacosx-version-min=10.7 and -stdlib=libc++.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for fasttext
Running setup.py clean for fasttext
Failed to build fasttext
Installing collected packages: fasttext
Running setup.py install for fasttext ... error
error: subprocess-exited-with-error
× Running setup.py install for fasttext did not run successfully.
│ exit code: 1
╰─> [66 lines of output]
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running install
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-cpython-310
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext
copying python/fasttext_module/fasttext/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext
copying python/fasttext_module/fasttext/FastText.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
copying python/fasttext_module/fasttext/util/util.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
copying python/fasttext_module/fasttext/util/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/test_script.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/test_configurations.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
running build_ext
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmp7pgbysh_.cpp -o var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmp7pgbysh_.o -stdlib=libc++
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmp7hnnqnja.cpp -o var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmp7hnnqnja.o -stdlib=libc++ -mmacosx-version-min=10.7
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/pip-install-mv_4oqbh/fasttext_1af9a5c892f74b668dc43e515183597f/setup.py", line 168, in <module>
setup(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/install.py", line 68, in run
return orig.install.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/install.py", line 698, in run
self.run_command('build')
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 132, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
_build_ext.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
self.build_extensions()
File "/private/var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/pip-install-mv_4oqbh/fasttext_1af9a5c892f74b668dc43e515183597f/setup.py", line 131, in build_extensions
raise RuntimeError(
RuntimeError: libc++ is needed! Failed to compile with -stdlib=libc++ -mmacosx-version-min=10.7 and -stdlib=libc++.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> fasttext
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure. ```
As an initial observation: it's often a good practice to install the Python libraries you need for a particular development project into a project-specific virtual environment.
That is, you set up a separate and specific Python interpreter, of a version you consciously choose, with its own set of installed libraries, which does not then affect the system's default Python installation in any way. It then becomes easier to choose whatever libraries/versions you need for that project, without any risk of confusing things for other programs on the same system. It also helps enforce a clear declaration of your project's actual prerequisites, so that you can re-create an adequante virtual-environment later when needed in new places – rather than leaving that to the chance/history of what's been globally installed on the devlopment machine.
Either the conda tool or the venv functionality of Python 3 can be used to set up such an environment, and after creation, each time you want to use that specific Python installation, you must activate it – so that in a particular shell, it becomes the active Python.
All that said, the error you're having relates to the lack of needed c++ development tools, which your installation-method seems to require to compile to those non-Python parts of Facebook's FastText library.
A bunch of options you could consider to get around this:
installing Apple's full XCode, including C++ & a bunch of other compilation/build tools, might resolve or change your error. There's more discussion from people who've hit a similar error, and eventually gotten around it using XCode-related configuration, at an issue in the Fasttext project: https://github.com/facebookresearch/fastText/issues/753
if using conda – I usually start with miniconda per the minimal instructions at https://docs.conda.io/en/latest/miniconda.html – it might be smart enough to choose a package already precompiled properly for your setup, even if you don't have C++ build tools locally. That is, after setting up your desired environment, then activating it, doing a conda install fasttext inside that environment might just work for you, skipping the local compilation error.
depending on your fasttext needs, you might also consider using some other Python library with FastText support, like Gensim. It doesn't support -supervised mode, but does support the core word-vectors (and synthesis of out-of-vocabulary word-vectors via character n-grams) capabilities of FastText, with some extra flexibility & related utility functions.

How to install scikit-learn in SageMath 9.3 Notebook in a Windows device?

I have used scikit learn on my Windows device for Jupyter Notebooks without any problem, but I need to use SageMath 9.3 for a university course and I tried to use %pip install scikit-learn and %pip install -U scikit-learn commands in a SageMath noteook but it's not working. Apparently nobody in my class using windows has been able to (as of two weeks ago), works fine on MacOS. My searches didn't yield anything useful, is it possible to install the library?
Partial error log as the whole thing is too big
Using cached scikit-learn-1.0.2.tar.gz (6.7 MB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: /opt/sagemath-9.3/local/bin/python3 /opt/sagemath-9.3/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-nphjkzbm/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools<60.0' wheel 'Cython>=0.28.5' 'oldest-supported-numpy; python_version!='"'"'3.7'"'"' or platform_machine=='"'"'aarch64'"'"' or platform_system=='"'"'AIX'"'"' or platform_python_implementation == '"'"'PyPy'"'"'' 'numpy==1.14.6; python_version=='"'"'3.7'"'"' and platform_machine!='"'"'aarch64'"'"' and platform_system!='"'"'AIX'"'"' and platform_python_implementation != '"'"'PyPy'"'"'' 'scipy>=1.1.0'
cwd: None
Complete output (9617 lines):
Ignoring oldest-supported-numpy: markers 'python_version != "3.7" or platform_machine == "aarch64" or platform_system == "AIX" or platform_python_implementation == "PyPy"' don't match your environment
Collecting setuptools<60.0
Using cached setuptools-59.8.0-py3-none-any.whl (952 kB)
Collecting wheel
Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Collecting Cython>=0.28.5
Using cached Cython-0.29.32-py2.py3-none-any.whl (986 kB)
Collecting numpy==1.14.6
Using cached numpy-1.14.6-cp37-cp37m-cygwin_3_2_0_x86_64.whl
Collecting scipy>=1.1.0
Using cached scipy-1.7.3.tar.gz (36.1 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: still running...
Preparing wheel metadata: finished with status 'done'
Using cached scipy-1.7.2.tar.gz (36.1 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: still running...
Preparing wheel metadata: finished with status 'done'
Using cached scipy-1.7.1.tar.gz (36.1 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: still running...
Preparing wheel metadata: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /opt/sagemath-9.3/local/bin/python3 /opt/sagemath-9.3/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpqr8ur2nx
cwd: /tmp/pip-install-0b3d_b3u/scipy_b5491a6e79864d5bbc6400ba8769f139
Complete output (159 lines):
Running scipy/linalg/_generate_pyx.py
Running scipy/special/_generate_pyx.py
Running scipy/stats/_generate_pyx.py
Processing scipy/cluster/_hierarchy.pyx
Processing scipy/cluster/_optimal_leaf_ordering.pyx
Processing scipy/cluster/_vq.pyx
Processing scipy/fftpack/convolve.pyx
Processing scipy/interpolate/interpnd.pyx
Processing scipy/interpolate/_bspl.pyx
Processing scipy/interpolate/_ppoly.pyx
Processing scipy/io/matlab/mio5_utils.pyx
Processing scipy/io/matlab/mio_utils.pyx
Processing scipy/io/matlab/streams.pyx
Processing scipy/linalg/cython_blas.pyx
Processing scipy/linalg/cython_lapack.pyx
Processing scipy/linalg/_decomp_update.pyx.in
Processing scipy/linalg/_matfuncs_sqrtm_triu.pyx
Processing scipy/linalg/_solve_toeplitz.pyx
Processing scipy/ndimage/src/_cytest.pyx
Processing scipy/ndimage/src/_ni_label.pyx
Processing scipy/optimize/_bglu_dense.pyx
Processing scipy/optimize/_group_columns.pyx
Processing scipy/optimize/cython_optimize/_zeros.pyx.in
Processing scipy/optimize/_highs/cython/src/_highs_constants.pyx
Processing scipy/optimize/_highs/cython/src/_highs_wrapper.pyx
Processing scipy/optimize/_lsq/givens_elimination.pyx
Processing scipy/optimize/_trlib/_trlib.pyx
Processing scipy/signal/_max_len_seq_inner.pyx
Processing scipy/signal/_peak_finding_utils.pyx
Processing scipy/signal/_sosfilt.pyx
Processing scipy/signal/_spectral.pyx
Processing scipy/signal/_upfirdn_apply.pyx
Processing scipy/sparse/_csparsetools.pyx.in
Processing scipy/sparse/csgraph/_flow.pyx
Processing scipy/sparse/csgraph/_matching.pyx
Processing scipy/sparse/csgraph/_min_spanning_tree.pyx
Processing scipy/sparse/csgraph/_reordering.pyx
Processing scipy/sparse/csgraph/_shortest_path.pyx
Processing scipy/sparse/csgraph/_tools.pyx
Processing scipy/sparse/csgraph/_traversal.pyx
Processing scipy/spatial/ckdtree.pyx
Processing scipy/spatial/qhull.pyx
Processing scipy/spatial/_hausdorff.pyx
Processing scipy/spatial/_voronoi.pyx
Processing scipy/spatial/transform/rotation.pyx
Processing scipy/special/cython_special.pyx
Processing scipy/special/_comb.pyx
Processing scipy/special/_ellip_harm_2.pyx
Processing scipy/special/_test_round.pyx
Processing scipy/special/_ufuncs.pyx
Processing scipy/special/_ufuncs_cxx.pyx
Processing scipy/stats/biasedurn.pyx
Processing scipy/stats/_qmc_cy.pyx
Processing scipy/stats/_sobol.pyx
Processing scipy/stats/_stats.pyx
Processing scipy/stats/_boost/src/beta_ufunc.pyx
Processing scipy/stats/_boost/src/binom_ufunc.pyx
Processing scipy/stats/_boost/src/nbinom_ufunc.pyx
Processing scipy/_lib/messagestream.pyx
Processing scipy/_lib/_ccallback_c.pyx
Processing scipy/_lib/_test_deprecation_call.pyx
Processing scipy/_lib/_test_deprecation_def.pyx
warning: _cython_special_custom.pxi:9:8: Unreachable code
warning: _cython_special_custom.pxi:13:4: Unreachable code
warning: _cython_special_custom.pxi:21:8: Unreachable code
warning: _cython_special_custom.pxi:25:4: Unreachable code
warning: _cython_special_custom.pxi:33:8: Unreachable code
warning: _cython_special_custom.pxi:37:4: Unreachable code
warning: _cython_special_custom.pxi:45:8: Unreachable code
warning: _cython_special_custom.pxi:49:4: Unreachable code
Cythonizing sources
lapack_opt_info:
lapack_mkl_info:
customize UnixCCompiler
libraries mkl_rt not found in ['/opt/sagemath-9.3/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
openblas_lapack_info:
customize UnixCCompiler
customize UnixCCompiler
customize UnixCCompiler
C compiler: gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fdebug-prefix-map=/pub/devel/python/python37/python37-3.7.10-2.x86_64/build=/usr/src/debug/python37-3.7.10-2 -fdebug-prefix-map=/pub/devel/python/python37/python37-3.7.10-2.x86_64/src/Python-3.7.10=/usr/src/debug/python37-3.7.10-2 -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fdebug-prefix-map=/pub/devel/python/python37/python37-3.7.10-2.x86_64/build=/usr/src/debug/python37-3.7.10-2 -fdebug-prefix-map=/pub/devel/python/python37/python37-3.7.10-2.x86_64/src/Python-3.7.10=/usr/src/debug/python37-3.7.10-2
creating /tmp/tmp1hu6a0ki/tmp
creating /tmp/tmp1hu6a0ki/tmp/tmp1hu6a0ki
compile options: '-c'
gcc: /tmp/tmp1hu6a0ki/source.c
gcc /tmp/tmp1hu6a0ki/tmp/tmp1hu6a0ki/source.o -L/opt/sagemath-9.3/local/lib -lopenblas.dll -o /tmp/tmp1hu6a0ki/a.out.exe
customize UnixCCompiler
FOUND:
libraries = ['openblas.dll', 'openblas.dll']
library_dirs = ['/opt/sagemath-9.3/local/lib']
language = c
define_macros = [('HAVE_CBLAS', None)]
FOUND:
libraries = ['openblas.dll', 'openblas.dll']
library_dirs = ['/opt/sagemath-9.3/local/lib']
language = c
define_macros = [('HAVE_CBLAS', None)]
setup.py:492: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /tmp/pip-modern-metadata-3rq4dd3a'), proceeding with generating Cython sources and expanding templates
' '.join(sys.argv[1:])))
Running from SciPy source directory.
Traceback (most recent call last):
File "/usr/lib/python3.7/configparser.py", line 788, in get
value = d[option]
File "/usr/lib/python3.7/collections/__init__.py", line 916, in __getitem__
return self.__missing__(key) # support subclasses that define __missing__
File "/usr/lib/python3.7/collections/__init__.py", line 908, in __missing__
raise KeyError(key)
KeyError: 'defines'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/sagemath-9.3/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/opt/sagemath-9.3/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/opt/sagemath-9.3/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/tmp/pip-build-env-hwqkwf0i/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 166, in prepare_metadata_for_build_wheel
self.run_setup()
File "/tmp/pip-build-env-hwqkwf0i/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 259, in run_setup
self).run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-hwqkwf0i/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 150, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 629, in <module>
setup_package()
File "setup.py", line 625, in setup_package
setup(**metadata)
File "/tmp/pip-build-env-hwqkwf0i/overlay/lib/python3.7/site-packages/numpy/distutils/core.py", line 137, in setup
config = configuration()
File "setup.py", line 536, in configuration
config.add_subpackage('scipy')
File "/tmp/pip-build-env-hwqkwf0i/overlay/lib/python3.7/site-packages/numpy/distutils/misc_util.py", line 1036, in add_subpackage
caller_level = 2)
File "/tmp/pip-build-env-hwqkwf0i/overlay/lib/python3.7/site-packages/numpy/distutils/misc_util.py", line 1005, in get_subpackage
caller_level = caller_level + 1)
File "/tmp/pip-build-env-hwqkwf0i/overlay/lib/python3.7/site-packages/numpy/distutils/misc_util.py", line 942, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "scipy/setup.py", line 12, in configuration
config.add_subpackage('interpolate')
File "/tmp/pip-build-env-hwqkwf0i/overlay/lib/python3.7/site-packages/numpy/distutils/misc_util.py", line 1036, in add_subpackage
caller_level = 2)
File "/tmp/pip-build-env-hwqkwf0i/overlay/lib/python3.7/site-packages/numpy/distutils/misc_util.py", line 1005, in get_subpackage
caller_level = caller_level + 1)
File "/tmp/pip-build-env-hwqkwf0i/overlay/lib/python3.7/site-packages/numpy/distutils/misc_util.py", line 942, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "scipy/interpolate/setup.py", line 62, in configuration
config=['compiler.blas=none']
File "/tmp/pip-build-env-hwqkwf0i/overlay/lib/python3.7/site-packages/pythran/dist.py", line 145, in __init__
cfg_ext = cfg.make_extension(python=True, **kwargs)
File "/tmp/pip-build-env-hwqkwf0i/overlay/lib/python3.7/site-packages/pythran/config.py", line 139, in make_extension
cfg.get('compiler', 'defines').split()],
File "/usr/lib/python3.7/configparser.py", line 791, in get
raise NoOptionError(option, section)
configparser.NoOptionError: No option 'defines' in section: 'compiler'
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/47/33/a24aec22b7be7fdb10ec117a95e1e4099890d8bbc6646902f443fc7719d1/scipy-1.7.1.tar.gz#sha256=6b47d5fa7ea651054362561a28b1ccc8da9368a39514c1bbf6c0977a1c376764 (from https://pypi.org/simple/scipy/) (requires-python:>=3.7,<3.10). Command errored out with exit status 1: /opt/sagemath-9.3/local/bin/python3 /opt/sagemath-9.3/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpqr8ur2nx Check the logs for full command output.
Using cached scipy-1.7.0.tar.gz (36.1 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: still running...
Preparing wheel metadata: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /opt/sagemath-9.3/local/bin/python3 `/opt/sagemath-9.3/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpwoujhuuk`
cwd: /tmp/pip-install-0b3d_b3u/scipy_54bc3010242246889b2403d28ea21946
Complete output (159 lines):```

Can't build gobject--introspection-1.70.0 on debian stretch

Because debian stretch have old package of gobject-introspection,i needed to update this.
But when i tryed to build, i got next message:
FAILED: gir/GLib-2.0.gir
/home/user/gobject-introspection-1.70.0/_build/tools/g-ir-scanner --output=gir/GLib-2.0.gir --no-libtool --quiet --reparse-validate --add-include-path /home/user/gobject-introspection-1.70.0/_build/gir --add-include-path /home/user/gobject-introspection-1.70.0/gir --identifier-prefix=G --symbol-prefix=g --symbol-prefix=glib --c-include=glib.h --namespace=GLib --nsversion=2.0 --library=glib-2.0 --library=gobject-2.0 --external-library --pkg=glib-2.0 --cflags-begin -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DGLIB_COMPILATION -D__G_I18N_LIB_H__ -DGETTEXT_PACKAGE=Dummy --cflags-end /usr/include/glib-2.0/gobject/glib-types.h /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h /usr/include/glib-2.0/glib-unix.h /usr/include/glib-2.0/glib/galloca.h /usr/include/glib-2.0/glib/garray.h /usr/include/glib-2.0/glib/gasyncqueue.h /usr/include/glib-2.0/glib/gatomic.h /usr/include/glib-2.0/glib/gbacktrace.h /usr/include/glib-2.0/glib/gbase64.h /usr/include/glib-2.0/glib/gbitlock.h /usr/include/glib-2.0/glib/gbookmarkfile.h /usr/include/glib-2.0/glib/gbytes.h /usr/include/glib-2.0/glib/gcharset.h /usr/include/glib-2.0/glib/gchecksum.h /usr/include/glib-2.0/glib/gconvert.h /usr/include/glib-2.0/glib/gdataset.h /usr/include/glib-2.0/glib/gdate.h /usr/include/glib-2.0/glib/gdatetime.h /usr/include/glib-2.0/glib/gdir.h /usr/include/glib-2.0/glib/genviron.h /usr/include/glib-2.0/glib/gerror.h /usr/include/glib-2.0/glib/gfileutils.h /usr/include/glib-2.0/glib/ggettext.h /usr/include/glib-2.0/glib/ghash.h /usr/include/glib-2.0/glib/ghmac.h /usr/include/glib-2.0/glib/ghook.h /usr/include/glib-2.0/glib/ghostutils.h /usr/include/glib-2.0/glib/gi18n-lib.h /usr/include/glib-2.0/glib/gi18n.h /usr/include/glib-2.0/glib/giochannel.h /usr/include/glib-2.0/glib/gkeyfile.h /usr/include/glib-2.0/glib/glib-typeof.h /usr/include/glib-2.0/glib/glist.h /usr/include/glib-2.0/glib/gmacros.h /usr/include/glib-2.0/glib/gmain.h /usr/include/glib-2.0/glib/gmappedfile.h /usr/include/glib-2.0/glib/gmarkup.h /usr/include/glib-2.0/glib/gmem.h /usr/include/glib-2.0/glib/gmessages.h /usr/include/glib-2.0/glib/gnode.h /usr/include/glib-2.0/glib/goption.h /usr/include/glib-2.0/glib/gpattern.h /usr/include/glib-2.0/glib/gpoll.h /usr/include/glib-2.0/glib/gprimes.h /usr/include/glib-2.0/glib/gprintf.h /usr/include/glib-2.0/glib/gqsort.h /usr/include/glib-2.0/glib/gquark.h /usr/include/glib-2.0/glib/gqueue.h /usr/include/glib-2.0/glib/grand.h /usr/include/glib-2.0/glib/grcbox.h /usr/include/glib-2.0/glib/grefcount.h /usr/include/glib-2.0/glib/grefstring.h /usr/include/glib-2.0/glib/gregex.h /usr/include/glib-2.0/glib/gscanner.h /usr/include/glib-2.0/glib/gsequence.h /usr/include/glib-2.0/glib/gshell.h /usr/include/glib-2.0/glib/gslice.h /usr/include/glib-2.0/glib/gslist.h /usr/include/glib-2.0/glib/gspawn.h /usr/include/glib-2.0/glib/gstdio.h /usr/include/glib-2.0/glib/gstrfuncs.h /usr/include/glib-2.0/glib/gstring.h /usr/include/glib-2.0/glib/gstringchunk.h /usr/include/glib-2.0/glib/gstrvbuilder.h /usr/include/glib-2.0/glib/gtestutils.h /usr/include/glib-2.0/glib/gthread.h /usr/include/glib-2.0/glib/gthreadpool.h /usr/include/glib-2.0/glib/gtimer.h /usr/include/glib-2.0/glib/gtimezone.h /usr/include/glib-2.0/glib/gtrashstack.h /usr/include/glib-2.0/glib/gtree.h /usr/include/glib-2.0/glib/gtypes.h /usr/include/glib-2.0/glib/gunicode.h /usr/include/glib-2.0/glib/guri.h /usr/include/glib-2.0/glib/gurifuncs.h /usr/include/glib-2.0/glib/gutils.h /usr/include/glib-2.0/glib/guuid.h /usr/include/glib-2.0/glib/gvariant.h /usr/include/glib-2.0/glib/gvarianttype.h /usr/include/glib-2.0/glib/gversion.h /usr/include/glib-2.0/glib/gversionmacros.h /usr/include/glib-2.0/glib/gwin32.h ../gir/glib-2.0.c
Traceback (most recent call last):
File "/home/user/gobject-introspection-1.70.0/_build/tools/g-ir-scanner", line 98, in <module>
from giscanner.scannermain import scanner_main
File "/home/user/gobject-introspection-1.70.0/_build/giscanner/scannermain.py", line 35, in <module>
from giscanner.ast import Include, Namespace
File "/home/user/gobject-introspection-1.70.0/_build/giscanner/ast.py", line 29, in <module>
from .sourcescanner import CTYPE_TYPEDEF, CSYMBOL_TYPE_TYPEDEF
File "/home/user/gobject-introspection-1.70.0/_build/giscanner/sourcescanner.py", line 34, in <module>
from giscanner._giscanner import SourceScanner as CSourceScanner
ImportError: /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0: undefined symbol: g_date_copy
I know about required version glib >= 2.56.
I build it too and install from latest(2.70) source, but the error remains.
user#debian-stretch:/usr/lib/x86_64-linux-gnu$ cat /usr/lib/x86_64-linux-gnu/pkgconfig /gobject-2.0.pc
prefix=/usr
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include
Name: GObject
Description: GLib Type, Object, Parameter and Signal Library
Version: 2.70.0
Requires: glib-2.0
Requires.private: libffi >= 3.0.0
Libs: -L${libdir} -lgobject-2.0
Cflags: -I${includedir}
user#debian-stretch:/usr/lib/x86_64-linux-gnu$ cat /usr/lib/x86_64-linux-gnu/pkgconfig /glib-2.0.pc
prefix=/usr
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include
bindir=${prefix}/bin
glib_genmarshal=${bindir}/glib-genmarshal
gobject_query=${bindir}/gobject-query
glib_mkenums=${bindir}/glib-mkenums
Name: GLib
Description: C Utility Library
Version: 2.70.0
Requires.private: libpcre >= 8.31
Libs: -L${libdir} -lglib-2.0
Libs.private: -pthread -lm
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include
Can you help with it trouble?
UPD
i read again this post and i had seen next thing:
default libglib2.0-0 package install some libs on to another path, in: /lib/x86_64-linux-gnu/
After that i tryed find it's on my instance, and got next out:
user#debian-stretch:~$ sudo find / -iname '*glib-2.0.*'
/usr/lib/x86_64-linux-gnu/libglib-2.0.so
/usr/lib/x86_64-linux-gnu/girepository-1.0/GLib-2.0.typelib
/usr/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc
/usr/lib/x86_64-linux-gnu/libglib-2.0.a
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7000.0
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7000.0-gdb.py
/usr/share/gir-1.0/GLib-2.0.gir
/usr/share/aclocal/glib-2.0.m4
/usr/local/share/gdb/auto-load/usr/local/lib/x86_64-linux-gnu/libglib-2.0.so.0.7000.0-gdb.py
/usr/local/share/aclocal/glib-2.0.m4
/lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.3
/lib/x86_64-linux-gnu/libglib-2.0.so.0
/home/user/glib-2.70.0/m4macros/glib-2.0.m4
/home/user/glib-2.70.0/_build/glib/libglib-2.0.so.0.7000.0.p
/home/user/glib-2.70.0/_build/glib/libglib-2.0.so
/home/user/glib-2.70.0/_build/glib/libglib-2.0.so.0.7000.0-gdb.py
/home/user/glib-2.70.0/_build/glib/libglib-2.0.so.0
/home/user/glib-2.70.0/_build/meson-private/glib-2.0.pc
/home/user/gobject-introspection-1.70.0/gir/glib-2.0.c
/home/user/gobject-introspection-1.70.0/subprojects/glib/m4macros/glib-2.0.m4
/home/user/packaging-glib/glib-2.70.0/usr/lib/x86_64-linux-gnu/libglib-2.0.so
/home/user/packaging-glib/glib-2.70.0/usr/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc
/home/user/packaging-glib/glib-2.70.0/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7000.0
/home/user/packaging-glib/glib-2.70.0/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
/home/user/packaging-glib/glib-2.70.0/usr/share/aclocal/glib-2.0.m4
After remove this libs:
/lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.3
/lib/x86_64-linux-gnu/libglib-2.0.so.0
building continue.
Definitely don't delete the GLib libraries in /lib. Since your package manager installed them there, other packages may expect to find them there, and so this may break your system down the line. (And since Debian Stretch is so old, with a GLib version of 2.50, it may even cause problems if you install GLib 2.70 systemwide.)
If you must install 2.70 systemwide, then I'd recommend building it with exactly the same configuration as the system version would. You can find the standard configuration options here and the options specific to GLib here. The options for gobject-introspection you can find in a similar place.
Even better, if you need to develop something using a GLib and gobject-introspection version that is not supported on your host system, would be to use some form of container technology. Either a runtime like Flatpak, or a "pet container" with a development environment, like Toolbox.

SWIG Symbol not found, leading underscore in symbol name

I'm following the tutorial for SWIG and Python, but I'm getting an error when I try to import the compiled extension in Python.
Python 3.5.2 (default, Oct 11 2016, 15:01:25)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
>>> import _example
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/pat/to/_example.cpython-35m-darwin.so, 2): Symbol not found: _fact
Referenced from: /path/to/_example.cpython-35m-darwin.so
Expected in: flat namespace
in /path/to/_example.cpython-35m-darwin.so
Note that the error says it can't find the symbol _fact. I'm not sure where the leading underscore is coming from, and I can't find any information about how to resolve this problem.
Here is example.i (matches what's in the tutorial):
%module example
%{
#define SWIG_FILE_WITH_INIT
#include "example.h"
%}
int fact(int n);
example.h and example.c also match what's in the tutorial; I can post here if necessary.
Here's setup.py:
# coding=utf-8
from setuptools import Extension, setup
setup(
name = 'SWIG Test',
ext_modules = [Extension('_example', ['example.i'])],
py_modules = ['example'],
)
This is the relevant output of pip install -e . -v:
running build_ext
building '_example' extension
swigging example.i to example_wrap.c
swig -python -o example_wrap.c example.i
creating build
creating build/temp.macosx-10.12-x86_64-3.5
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -pipe -Os -I/opt/local/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c example_wrap.c -o build/temp.macosx-10.12-x86_64-3.5/example_wrap.o
creating build/lib.macosx-10.12-x86_64-3.5
/usr/bin/clang -bundle -undefined dynamic_lookup -L/opt/local/lib -Wl,-headerpad_max_install_names build/temp.macosx-10.12-x86_64-3.5/example_wrap.o -o build/lib.macosx-10.12-x86_64-3.5/_example.cpython-35m-darwin.so
copying build/lib.macosx-10.12-x86_64-3.5/_example.cpython-35m-darwin.so ->
Some things that I've tried that didn't work:
Declaring fact as int fact(int n) asm("fact") (after building, I get Symbol not found: fact when importing).
Adding swig_opts=['-py3'] to the extension in setup.py.
The leading underscore was a red herring. Turns out, I simply forgot to include example.c in my extension sources.
Here's what setup.py is supposed to look like:
# coding=utf-8
from setuptools import Extension, setup
setup(
name = 'SWIG Test',
ext_modules = [Extension('_example', ['example.i', 'example.c'])],
py_modules = ['example'],
)
Note that the extension has both example.i and example.c in its sources.
Now everything works as expected (:
Python 3.5.2 (default, Oct 11 2016, 15:01:25)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
>>> import example
>>> example.fact(42)
0
>>> example.fact(0)
1

Biopython build errors on Mageia

I'm trying to install Biopython 1.61. I'm logged in as root in a bash terminal. I'm using Mageia 2.0, and I've updated all the packages/programs on the OS (with urpmi update -a).
I extracted the source, then ran python setup.py build, which had two errors:
FAIL: test_protein_16130152 (test_SeqIO_online.EntrezTests)
Bio.Entrez.efetch(protein, 16130152, ...)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_SeqIO_online.py", line 77, in <lambda>
method = lambda x : x.simple(d, f, e, l, c)
File "test_SeqIO_online.py", line 65, in simple
self.assertEqual(seguid(record.seq), checksum)
AssertionError: 'NT/aFiTXyD/7KixizZ9sq2FcniU' != 'fCjcjMFeGIrilHAn6h+yju267lg'
======================================================================
ERROR: test_doctests (test_Tutorial.TutorialTestCase)
Run tutorial doctests.
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_Tutorial.py", line 152, in test_doctests
ValueError: 4 Tutorial doctests failed: test_from_line_05671, test_from_line_06030, test_from_line_06190, test_from_line_06479
Then I ran python setup.py install, but it failed, too. I updated my python with (urpmi install lib64python-devel) and my gcc, but it was already up to date.
This is the error I get from python setup.py install:
[root#localhost biopython-1.61]# python setup.py install
running install
running build
running build_py
warning: build_py_biopython: byte-compiling is disabled, skipping.
running build_ext
building 'Bio.Cluster.cluster' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -I/usr/include/ncursesw -DNDEBUG -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -g -fPIC -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c Bio/Cluster/clustermodule.c -o build/temp.linux-x86_64-2.7/Bio/Cluster/clustermodule.o
Bio/Cluster/clustermodule.c:2:31: fatal error: numpy/arrayobject.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
The unit test failures have been fixed in Biopython itself.
The compiler error suggests you are missing the NumPy header files, often included in the OS package manager in a separate package called something like numpy-dev or numpy-devel.

Resources