为什么PyPi(pip)在卸载软件包时尝试删除站点软件包?

问题描述 投票:1回答:1

当我尝试卸载软件包时会发生以下情况:

(soothsayer_py3.8_env) jespinozlt2-osx:Prototype jespinoz$ pip uninstall soothsayer
Found existing installation: soothsayer 2020.5.1
Uninstalling soothsayer-2020.5.1:
  Would remove:
    /Users/jespinoz/anaconda3/envs/soothsayer_py3.8_env/bin/clairvoyance.py
    /Users/jespinoz/anaconda3/envs/soothsayer_py3.8_env/bin/run_soothsayer.py
    /Users/jespinoz/anaconda3/envs/soothsayer_py3.8_env/lib/python3.8/site-packages/
  Would not remove (might be manually added):
    /Users/jespinoz/anaconda3/envs/soothsayer_py3.8_env/lib/python3.8/site-packages/soothsayer-2020.5.1.dist-info/Icon

这里是setup.py

import re, datetime
from setuptools import setup, find_packages

# Version
version = None
with open("./soothsayer/__init__.py", "r") as f:
    for line in f.readlines():
        line = line.strip()
        if line.startswith("__version__"):
            version = line.split("=")[-1].strip().strip('"')
assert version is not None, "Check version in soothsayer/__init__.py"

setup(name='soothsayer',
      version=version,
      description='High-level API for (bio-)informatics',
      url='https://github.com/jolespin/soothsayer',
      author='Josh L. Espinoza',
      author_email='[email protected]',
      license='BSD-3',
      packages=find_packages(include=("*", "./*")),
      install_requires=[
    "matplotlib >= 2.2.2",
    "scipy >= 1.0",
    "scikit-learn >= 0.20.2",
    "numpy >= 1.13", #, < 1.14.0",
    'pandas >= 1.0',
    'networkx >= 2.0',
    'ete3 >= 3.0',
    'scikit-bio >= 0.5.1',
    "biopython >= 1.5",
    "xarray >= 0.10.3",
    "tqdm >=4.19",
    "openpyxl >= 2.5",
    # "astropy >= 3.0",
    "rpy2 >= 2.9.4, < 3.0",
    "matplotlib_venn",
    "palettable >= 3.0.0",
    "adjustText",
    "tzlocal",
    "statsmodels >= 0.10.0", #https://github.com/statsmodels/statsmodels/issues/5899 May need to use this separately: pip install git+https://github.com/statsmodels/statsmodels.git@maintenance/0.10.x
    "teneto",
    "mmh3",
    "soothsayer_utils >= 2020.4.30",

      ],
     include_package_data=True,
     scripts=['bin/clairvoyance.py', "bin/run_soothsayer.py"],


)

这里是我的manifest.in

recursive-include soothsayer/io/data_type/ *.py
recursive-include soothsayer/feature_extraction/algorithms/ *.py
recursive-include soothsayer/r_wrappers/packages/ *.py
recursive-include soothsayer/tests/data/ *.py
recursive-include soothsayer/db/ *.pbz2
recursive-exclude releases/ *.tar.gz
global-exclude *.py[cod] __pycache__

这是我的pip版本:

pip 20.1 from /Users/jespinoz/anaconda3/envs/soothsayer_py3.8_env/lib/python3.8/site-packages/pip (python 3.8)

我似乎无法弄清楚?有谁知道是什么引起了这个问题?

python package pypi site-packages
1个回答
0
投票

我假定PyPI页面和导致问题的项目的源代码存储库如下:

在源代码存储库的根目录中有一个名称包含不寻常字符的文件。有时看起来像'Icon'$'\r'。该文件似乎也存在于source distribution for soothsayer 2020.5.4目录的soothsayer.egg-info中。因此,当pip安装该发行版时,它会以某种方式使正在安装的文件产生奇怪的记录:

$ pip show --files soothsayer
Name: soothsayer
Version: 2020.5.4
Summary: High-level package for (bio-)informatics
Home-page: https://github.com/jolespin/soothsayer
Author: Josh L. Espinoza
Author-email: [email protected]
License: BSD-3
Location: /tmp/tmp.YDoTgEDb9A/.venv/lib/python3.6/site-packages
Requires: networkx, teneto, palettable, matplotlib-venn, rpy2, xarray, ete3, biopython, tqdm, pandas, scikit-learn, scipy, numpy, scikit-bio, openpyxl, mmh3, matplotlib, statsmodels, adjustText, soothsayer-utils, tzlocal
Required-by: 
Files:
  "
  "soothsayer-2020.5.4.dist-info/Icon
  .
  ../../../bin/__pycache__/clairvoyance.cpython-36.pyc
  ../../../bin/__pycache__/run_soothsayer.cpython-36.pyc
  ../../../bin/clairvoyance.py
  ../../../bin/run_soothsayer.py
  soothsayer-2020.5.4.dist-info/INSTALLER
  soothsayer-2020.5.4.dist-info/Icon
  soothsayer-2020.5.4.dist-info/METADATA
  soothsayer-2020.5.4.dist-info/RECORD
  soothsayer-2020.5.4.dist-info/WHEEL
  soothsayer-2020.5.4.dist-info/top_level.txt
  soothsayer/__init__.py

在上面,请注意首先记录的3个Files。这些记录显然是错误的。特别是第三行可能会导致pip意图删除site-packages目录。

我建议该[[soothsayer项目的所有者应:

    弄清楚如何创建此类文件并
  • 禁用创建这些文件的软件
  • 清理所有分支中的源代码存储库
  • 以防止在将来的版本中发生这种情况
  • 发布维护或错误修复版本
  • 所有错误的版本
  • 删除所有错误的分布
  • 发表在PyPI
和其他类似的索引上

更新

[进一步检查后,似乎在源代码存储库的每个目录中都有一个类似的名为Icon的文件,这些文件很可能也需要消失(除了该存储库中的许多其他异常内容之外, )。
© www.soinside.com 2019 - 2024. All rights reserved.