在ubuntu pip安装 datasets matplotlib pyarrow等包时 可能遇到如下报错:
-- Found Python lib /usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.so
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Could NOT find Arrow (missing: Arrow_DIR)
-- Checking for module 'arrow'
-- No package 'arrow' found
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Arrow (missing: ARROW_INCLUDE_DIR ARROW_LIB_DIR
ARROW_FULL_SO_VERSION ARROW_SO_VERSION)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake_modules/FindArrow.cmake:450 (find_package_handle_standard_args)
cmake_modules/FindArrowPython.cmake:46 (find_package)
CMakeLists.txt:229 (find_package)
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-build-y_r12kuh/pyarrow/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeOutput.log".
error: command 'cmake' failed with exit status 1
----------------------------------------
Failed building wheel for pyarrow
Running setup.py clean for pyarrow
Failed to build pyarrow
Installing collected packages: pyarrow
Running setup.py install for pyarrow ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-y_r12kuh/pyarrow/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-ffo8pwle-record/install-record.txt --single-version-externally-managed --compile:
/usr/local/lib/python3.6/dist-packages/setuptools/__init__.py:151: SetuptoolsDeprecationWarning: setup_requires is deprecated. Supply build dependencies using PEP 517 pyproject.toml build-requires.
SetuptoolsDeprecationWarning,
running install
/usr/local/lib/python3.6/dist-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
setuptools.SetuptoolsDeprecationWarning,
running build
running build_py
creating build
网上搜到的其他解决方案都没解决我的问题,最终本人用的:
python -m pip install --upgrade pip
另外, 拿到一个新linux环境,最常安装和修改的东西 可以记下来,下次使用新环境按checklist操作 可以快速避坑。新增和修改配置文件 可以echo后重定向或sed之类。 一般拿到新环境后, centos需要安装的东西 包括但不限于如下; 如果新安装python版本,安装后需要更新的其他工具(例如setuptools, pip)和源的修改 都可以记下来依次执行,有时候忘了更新这些,后面可能要定位奇怪的安装问题,这样的定位有点浪费时间,可以避免的。 本人平时记录了centos的,ubuntu的没记,这不,忘记更新pip,ubuntu上就踩坑了(将来多装几次ubuntu再发出来)
yum -y update
yum -y install gcc
yum -y install zlib zlib-devel
yum -y install bzip2 bzip2-devel
yum -y install ncurses ncurses-devel
yum -y install readline readline-devel
yum -y install openssl openssl-devel
yum -y install openssl-static
yum -y install xz lzma xz-devel
yum -y install sqlite sqlite-devel
yum -y install gdbm gdbm-devel
yum -y install tk tk-devel
yum -y install libffi libffi-devel
yum -y install python-devel
yum -y install libevent-devel
yum -y install gcc gcc-c++
安装python3后,除了常用的库 还有:
pip3 install --upgrade pip
pip3 install --upgrade setuptools
pip3 install setuptools_scm
当然 使用标准化后的docker 也是OK的。不过基础环境 还是要准备一下。