我似乎无法理解我在 termux 上做错了什么 我尝试了一切
我跑了
pip install geopandas
它似乎确实有效
在termux上安装“geopandas” 它总是卡住,我不知道为什么
错误:
Collecting geopandas
Using cached geopandas-1.0.1-py3-none-any.whl.metadata (2.2 kB)
Requirement already satisfied: numpy>=1.22 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from geopandas) (1.26.4)
Collecting pyogrio>=0.7.2 (from geopandas)
Using cached pyogrio-0.9.0.tar.gz (352 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: packaging in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from geopandas) (24.1)
Requirement already satisfied: pandas>=1.4.0 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from geopandas) (2.2.2)
Collecting pyproj>=3.3.0 (from geopandas)
Using cached pyproj-3.6.1.tar.gz (225 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting shapely>=2.0.0 (from geopandas)
Using cached shapely-2.0.5.tar.gz (282 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [110 lines of output]
Compiling shapely/_geometry_helpers.pyx because it changed.
Compiling shapely/_geos.pyx because it changed.
[1/2] Cythonizing shapely/_geometry_helpers.pyx
[2/2] Cythonizing shapely/_geos.pyx
running egg_info
writing shapely.egg-info/PKG-INFO
writing dependency_links to shapely.egg-info/dependency_links.txt
writing requirements to shapely.egg-info/requires.txt
writing top-level names to shapely.egg-info/top_level.txt
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/numpy/_core/__init__.py", line 23, in <module>
from . import multiarray
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/numpy/_core/multiarray.py", line 10, in <module>
from . import overrides
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/numpy/_core/overrides.py", line 8, in <module>
from numpy._core._multiarray_umath import (
ImportError: dlopen failed: cannot locate symbol "PyExc_ValueError" referenced by "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/numpy/_core/_multiarray_umath.cpython-311.so"...
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/numpy/__init__.py", line 114, in <module>
from numpy.__config__ import show as show_config
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/numpy/__config__.py", line 4, in <module>
from numpy._core._multiarray_umath import (
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/numpy/_core/__init__.py", line 49, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.11 from "/data/data/com.termux/files/usr/bin/python3.11"
* The NumPy version is: "2.0.0"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: dlopen failed: cannot locate symbol "PyExc_ValueError" referenced by "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/numpy/_core/_multiarray_umath.cpython-311.so"...
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
self.run_setup()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 313, in run_setup
exec(code, locals())
File "<string>", line 210, in <module>
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 108, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 184, in setup
return run_commands(dist)
^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
dist.run_commands()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 970, in run_commands
self.run_command(cmd)
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 956, in run_command
super().run_command(command)
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 989, in run_command
cmd_obj.run()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 310, in run
self.find_sources()
File "/data/data/com.termux/files/usr/tmp/pip-install-qphif5z_/shapely_2576136fc96a4c58ab3c4866b6781b20/versioneer.py", line 1995, in find_sources
super().find_sources()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 318, in find_sources
mm.run()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 539, in run
self.add_defaults()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 577, in add_defaults
sdist.add_defaults(self)
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/command/sdist.py", line 102, in add_defaults
super().add_defaults()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 250, in add_defaults
self._add_defaults_ext()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 334, in _add_defaults_ext
build_ext = self.get_finalized_command('build_ext')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 303, in get_finalized_command
cmd_obj.ensure_finalized()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
self.finalize_options()
File "<string>", line 132, in finalize_options
File "/data/data/com.termux/files/usr/tmp/pip-build-env-lhg5tp1n/overlay/lib/python3.11/site-packages/numpy/__init__.py", line 119, in <module>
raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
我只是很沮丧,我想运行一个我不能运行的脚本 任何人都可以帮助我,我会很感激
问题似乎出在 Shapely 包(Geopandas 的一个依赖包)的安装过程中,它在构建 wheel 时遇到了问题。具体地说,是在尝试从其源代码目录导入 NumPy 时发生了错误。
以下是解决此问题的步骤:
1. 升级 pip:
确保你使用的是最新版本的 pip。
pip install --upgrade pip
2. 安装 NumPy 的系统级版本:
Termux 的问题可能在于它没有找到系统级的 NumPy 安装。尝试使用 apt 安装:
apt update
apt install python3-numpy
3. 重新安装 Shapely:
在安装 NumPy 后,尝试重新安装 Shapely:
pip install --force-reinstall --no-cache-dir shapely
4. 安装 Geopandas:
如果 Shapely 成功安装,你应该能够安装 Geopandas:
pip install geopandas
如果问题仍然存在,请尝试以下操作:
- 检查 Python 版本: 确保你使用的是与 Termux 兼容的 Python 版本。建议使用 Python 3.9 或更高版本。
- 创建新的虚拟环境: 创建一个新的 Python 虚拟环境,然后在其中安装 Geopandas 及其依赖项,可以避免与现有包发生冲突。
- 使用不同的源代码安装 Shapely: 如果你仍然遇到问题,请尝试从其源代码安装 Shapely。
如果问题仍然存在,请提供 Termux 版本、Python 版本以及你正在运行的 Android 版本的详细信息。这将有助于进一步诊断问题。
标签:python,pandas,geopandas,termux From: 78773674