[英]In package uploaded to pypi not checking if package requirements already installed, though install of same code from github does
This is a followup to this question 这是此问题的后续措施
Installing a pip package with cupy as a requirement puts install in never ending loop 安装带有cupy的pip软件包会使安装永无止境地循环
Where somehow a pip package was not able to detect that cupy is already installed, and tried to re-install it. 如果某个pip包无法检测到已经安装的cupy,并尝试重新安装它。
The solution given was to use 给出的解决方案是使用
try:
import cupy
except Exception:
install_requires.append('cupy')
Which worked for when I tried to install through github with 当我尝试通过github安装时适用
!pip install https://github.com/Santosh-Gupta/SpeedTorch/archive/master.zip !pip安装https://github.com/Santosh-Gupta/SpeedTorch/archive/master.zip
However, when I uploaded by code to pip and tried to run it, it's re-installing cupy again 但是,当我通过代码上传到pip并尝试运行它时,它又重新安装了cupy
!pip install SpeedTorch !pip安装SpeedTorch
I am using Goolgle colab, which already has cupy installed. 我正在使用已经安装了cupy的Goolgle colab。 For convenience, here's a link to the notebook I am using
为了方便起见,这是我正在使用的笔记本的链接
https://colab.research.google.com/drive/17KrdcHh29cpFMel_oYnOTkA1dNElolZ1 https://colab.research.google.com/drive/17KrdcHh29cpFMel_oYnOTkA1dNElolZ1
And here is my setup.py file 这是我的setup.py文件
https://github.com/Santosh-Gupta/SpeedTorch/blob/master/setup.py https://github.com/Santosh-Gupta/SpeedTorch/blob/master/setup.py
This problem may be unique to cupy, since I do not have this issue with other python packages. 这个问题可能是cupy特有的,因为我在其他python软件包中没有这个问题。
This is not issue specific to CuPy. 这不是特定于CuPy的问题。 You should not modify
install_requires
in setup.py
if you want to distribute your package as a wheel. 如果您希望将软件包作为轮子分发,则不应在
setup.py
修改install_requires
。 setup.py
runs when building a wheel package, not when installing it. setup.py
在构建车轮套件时运行,而不是在安装时运行。 In other words, install_requires
is determined depending on whether cupy
is available when building a wheel package. 换句话说,
install_requires
是根据构建车轮包装时是否可用的cupy
来确定的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.