由于 setup.py egg_info 文件,无法安装 pysal

Unable to install pysal due to setup.py egg_info file

我在 colab 工作。我想为我的项目安装 pysal 模块。我收到以下错误。

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

整个错误日志如下所示:

Collecting pysal
  Downloading https://files.pythonhosted.org/packages/68/04/e9a456867aa2686186f7d1d1fd3c9598ac27a92d08063afa236a1f1fd7e2/pysal-2.2.0.tar.gz (104kB)
     |████████████████████████████████| 112kB 2.8MB/s 
Collecting libpysal>=4.2.2
  Downloading https://files.pythonhosted.org/packages/6f/00/bf40b380e9064222868c93ed51d81dd14b1266b16dd5a54e53aaed12caf2/libpysal-4.2.2.tar.gz (2.4MB)
     |████████████████████████████████| 2.4MB 9.0MB/s 
Collecting esda>=2.2.1
  Downloading https://files.pythonhosted.org/packages/16/f1/c2190bc3a7ef9c83ce0b060b927763352bfc0a55ccea8bb5fcd8975de347/esda-2.2.1.tar.gz (62kB)
     |████████████████████████████████| 71kB 8.6MB/s 
Collecting giddy>=2.3.0
  Downloading https://files.pythonhosted.org/packages/6e/96/c9cac4d3a00dbe682a4031e3775cb7941f35ac9918efc481d4da7a89966d/giddy-2.3.0.tar.gz (57kB)
     |████████████████████████████████| 61kB 8.2MB/s 
Collecting inequality>=1.0.0
  Downloading https://files.pythonhosted.org/packages/74/0f/9ed2d097f29160d0c873f33ffc0b9806c1083e3611acb2143eb66adcf580/inequality-1.0.0.tar.gz
Collecting pointpats>=2.1.0
  Downloading https://files.pythonhosted.org/packages/57/29/51bf19dc4452c1429f15335574642bfd5cb672ddbacf8a95c69967ff84b1/pointpats-2.1.0.tar.gz
Collecting segregation>=1.2.0
  Downloading https://files.pythonhosted.org/packages/4d/69/288da08dde201dc250d6dadf6a9ad035e1a5d8b3bdc20b71c2874482d488/segregation-1.2.0-py3-none-any.whl (110kB)
     |████████████████████████████████| 112kB 24.7MB/s 
Collecting spaghetti>=1.4.1
  Downloading https://files.pythonhosted.org/packages/b8/52/700971b94b37193cfb86fe804541d7ed78015a72275cfb4c8c499bfe6b2b/spaghetti-1.4.2.post2-py3-none-any.whl (41kB)
     |████████████████████████████████| 51kB 7.2MB/s 
Collecting mgwr>=2.1.1
  Downloading https://files.pythonhosted.org/packages/21/38/978bd3f72f5376866d37b9155ea67fad9f0bace4e274569b9e0a19df6c4d/mgwr-2.1.1-py3-none-any.whl (44kB)
     |████████████████████████████████| 51kB 7.4MB/s 
Collecting spglm>=1.0.7
  Downloading https://files.pythonhosted.org/packages/97/45/5cacaa01f2084162976ab6519a5b13db881363592b400d5c91f1c6abc969/spglm-1.0.7.tar.gz
Collecting spint>=1.0.6
  Downloading https://files.pythonhosted.org/packages/68/ed/39822aec1aedd46a2c9eb044e36ab9841f745b3a975074fcce13f58107b9/spint-1.0.6-py3-none-any.whl
Collecting spreg>=1.0.4
  Downloading https://files.pythonhosted.org/packages/e9/70/30c5685900505b43444b6c9230eb06f082ea3ec456a5bb7e00e00cef306a/spreg-1.1.1-py3-none-any.whl (264kB)
     |████████████████████████████████| 266kB 22.2MB/s 
Collecting spvcm>=0.3.0
  Downloading https://files.pythonhosted.org/packages/b4/c9/43fb98bc60728b76fceee175119a1ff7e5033ed9012d07570e34a2a19a8f/spvcm-0.3.0.tar.gz (5.7MB)
     |████████████████████████████████| 5.7MB 13.3MB/s 
Collecting tobler>=0.2.0
  Downloading https://files.pythonhosted.org/packages/29/21/5f6228878b985a6518cbad432cd0db6bebbee4934600b63dbca2dbae773b/tobler-0.3.0-py3-none-any.whl
Collecting mapclassify>=2.2.0
  Downloading https://files.pythonhosted.org/packages/91/b5/6b54f40901d89f2ce30cf2d8110dd57658db3e95db79baba6706d7588691/mapclassify-2.2.0.tar.gz (47kB)
     |████████████████████████████████| 51kB 7.9MB/s 
Collecting splot>=1.1.2
  Downloading https://files.pythonhosted.org/packages/83/1c/afb3e3eeeda4eef065f0b3249ca74cbcc44af3bc59ddb5a21b5445753955/splot-1.1.3.tar.gz
Requirement already satisfied: urllib3<1.25 in /usr/local/lib/python3.6/dist-packages (from pysal) (1.24.3)
Collecting python-dateutil<=2.8.0
  Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl (226kB)
     |████████████████████████████████| 235kB 46.4MB/s 
Requirement already satisfied: scipy>=0.11 in /usr/local/lib/python3.6/dist-packages (from libpysal>=4.2.2->pysal) (1.4.1)
Requirement already satisfied: numpy>=1.3 in /usr/local/lib/python3.6/dist-packages (from libpysal>=4.2.2->pysal) (1.18.3)
Requirement already satisfied: pandas in /usr/local/lib/python3.6/dist-packages (from libpysal>=4.2.2->pysal) (1.0.3)
Requirement already satisfied: bs4 in /usr/local/lib/python3.6/dist-packages (from libpysal>=4.2.2->pysal) (0.0.1)
Requirement already satisfied: requests in /usr/local/lib/python3.6/dist-packages (from libpysal>=4.2.2->pysal) (2.21.0)
Requirement already satisfied: jinja2 in /usr/local/lib/python3.6/dist-packages (from libpysal>=4.2.2->pysal) (2.11.2)
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.6/dist-packages (from esda>=2.2.1->pysal) (0.22.2.post1)
Collecting quantecon
  Downloading https://files.pythonhosted.org/packages/72/15/7649ba1f5ad5adc78efbda71d5f1dd15f0edf4a0dead41ba048b7d7e5335/quantecon-0.4.7-py3-none-any.whl (229kB)
     |████████████████████████████████| 235kB 46.7MB/s 
Requirement already satisfied: matplotlib in /usr/local/lib/python3.6/dist-packages (from pointpats>=2.1.0->pysal) (3.2.1)
Requirement already satisfied: geopandas in /usr/local/lib/python3.6/dist-packages (from segregation>=1.2.0->pysal) (0.7.0)
Requirement already satisfied: seaborn in /usr/local/lib/python3.6/dist-packages (from segregation>=1.2.0->pysal) (0.10.0)
Requirement already satisfied: tqdm in /usr/local/lib/python3.6/dist-packages (from segregation>=1.2.0->pysal) (4.38.0)
Collecting watermark
  Downloading https://files.pythonhosted.org/packages/60/fe/3ed83b6122e70dce6fe269dfd763103c333f168bf91037add73ea4fe81c2/watermark-2.0.2-py2.py3-none-any.whl
Collecting rtree
  Using cached https://files.pythonhosted.org/packages/56/6f/f1e91001d5ad9fa9bed65875152f5a1c7955c5763168cae309546e6e9fda/Rtree-0.9.4.tar.gz
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我什至检查了日志,打印了同样的内容。请帮忙。

Colab 仅使用 python3(对于那些即将建议 pip3 install pysal 的人)。

回溯表明错误不是来自 pysal,而是来自 rtree

"rtree install error"的第一个Google结果是this github thread which contains this answer,说明rtree安装需要libspatialindex.

考虑到这一点,您可以运行在 Colab 中安装 pysal:

!apt install libspatialindex-c4v5
!pip install pysal