为什么 PyPi (pip) 在卸载软件包时会尝试删除站点软件包? [英] Why does PyPi (pip) try to delete site-packages when uninstalling a package?

查看:84
本文介绍了为什么 PyPi (pip) 在卸载软件包时会尝试删除站点软件包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Here's what happens when I try to uninstall a package:

(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='jespinoz@jcvi.org',
      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)

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

I can't seem to figure it out? Does anyone know what could be causing this issue?

推荐答案

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

I assume the PyPI page and the source code repository for the project causing the issue are the following:

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

There is a file with a name containing unusual characters at the root of the source code repository. It sometimes appears as something like 'Icon'$'\r'. That file seems to be also present in the source distribution for soothsayer 2020.5.4 in the soothsayer.egg-info directory. So when pip installs that distribution, it somehow makes strange records of files being installed:

$ 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: jespinoz@jcvi.org
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.这些记录显然是错误的.特别是第 3 行可能会导致 pip 意图删除 site-packages 目录.

In the above, note the 3 first recorded Files. These records are obviously wrong. In particular the 3rd line would probably lead pip to intent to delete the site-packages directory.

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

I would recommend the owner of that soothsayer project should:

  • 找出此类文件的创建方式并禁用创建这些文件的软件
  • 清理所有分支中的源代码存储库,以防止在以后的版本中发生这种情况
  • 发布所有错误版本的维护或错误修复版本
  • 删除在 PyPI 和其他类似索引上发布的所有错误分布
  • figure out how such files were created and disable the software that created these files
  • clean up the source code repository in all branches to prevent this from happening in the future releases
  • publish maintenance or bug-fix releases for all faulty releases
  • remove all faulty distributions published on PyPI and other similar indexes

更新

经过进一步检查,似乎在源代码库的每个目录中都有一个类似的异常命名的Icon文件,这些文件很可能也需要消失(除了许多其他异常存储库中的东西).

After further inspection, it seems like there is a similar unusually named Icon file in each directory of the source code repository, those would most likely need to disappear as well (in addition to many other unusual things lying around in that repository).

这篇关于为什么 PyPi (pip) 在卸载软件包时会尝试删除站点软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆