简体   繁体   English

现在无法在 macOS Big Sur 上使用 setup.py 进行安装

[英]Installation using setup.py is now impossible on macOS Big Sur

I have 2 of my projects that install perfectly fine on ubuntu, both require python3.8, both are installable using python setup.py install and I occasionally uninstall / install them from / to virtual environments as well as globally for testing purposes.我有 2 个项目在 ubuntu 上安装得非常好,都需要 python3.8,两者都可以使用python setup.py install ,我偶尔会从/到虚拟环境以及全局卸载/安装它们以进行测试。 Recently, all kinds of troubles and error messages started to occur not following any special event, I just woke up one day, and tried to install one of them, I got an error, then I tried the other and got another error.最近开始出现各种故障和错误消息,没有任何特殊事件,我刚醒来,尝试安装其中一个,我得到一个错误,然后我尝试另一个,又得到另一个错误。 I will include both setup.py scripts and show the steps I follow on macOS Big Sur 11.0 to reproduce the results, given that both install perfectly fine on Ubuntu with the same list of respective dependencies.我将包含两个setup.py脚本,并展示我在 macOS Big Sur 11.0 上遵循的步骤来重现结果,因为它们在 Ubuntu 上安装得非常好,并且具有相同的各自依赖项列表。

Versions:版本:

python: 3.8.6
pip:    20.3.1
macOS:  11.0.1

Project 1:项目一:

requirements.txt

imagesize==1.2.0
numpy==1.18.5
pandas==1.1.4
seaborn==0.11.0
tensorflow==2.3.1
matplotlib==3.3.3
lxml==4.6.2
imgaug==0.4.0
tensorflow-addons==0.11.2
opencv-python-headless==4.4.0.46
imagecorruptions==1.1.2
configparser~=5.0.1
scipy==1.5.4
PyQt5==5.15.2
tabulate==0.8.7
ipykernel==5.3.4

setup.py

from setuptools import setup, find_packages

install_requires = [dep.strip() for dep in open('requirements.txt')]

setup(
    name='project1',
    version='1.0',
    packages=find_packages(),
    url='url',
    license='MIT',
    author='author',
    author_email='email@domain',
    description='description goes here',
    install_requires=install_requires,
    python_requires='>=3.8',
    entry_points={
        'console_scripts': [
            'some_entry_point',
        ],
    },
)

Notes:笔记:

  • I will truncate logs for character limits.我将截断字符限制的日志。
  • The attempts below are done within a virtualenv下面的尝试是在 virtualenv 中完成的
  • All kinds of problems do not occur if I just use pip install -r requirements如果我只是使用pip install -r requirements不会出现各种问题
  • Installation works perfectly fine on Ubuntu and used to work perfectly fine on macOS even after I upgraded to Big Sur, it just suddenly decided to never work again.安装在 Ubuntu 上运行良好,并且即使在我升级到 Big Sur 之后,它也可以在 macOS 上运行良好,只是突然决定不再工作。
  • python is installed using brew install python@3.8使用brew install python@3.8

Attempt 1:尝试1:

virtualenv proj1
source proj1/bin/activate
python setup.py install

Result:结果:

Searching for PyQt5==5.15.2
Reading https://pypi.org/simple/PyQt5/
Downloading https://files.pythonhosted.org/packages/28/6c/640e3f5c734c296a7193079a86842a789edb7988dca39eab44579088a1d1/PyQt5-5.15.2.tar.gz#sha256=372b08dc9321d1201e4690182697c5e7ffb2e0770e6b4a45519025134b12e4fc
Best match: PyQt5 5.15.2
Processing PyQt5-5.15.2.tar.gz
error: Couldn't find a setup script in /var/folders/hr/61r_7jcx2r3cnklwrr2zwbqw0000gn/T/easy_install-sl9y34mj/PyQt5-5.15.2.tar.gz

Attempt 2: (I install pyqt using pip)尝试2:(我使用pip安装pyqt)

pip install pyqt5==5.15.2 # success
python setup.py install # fail

Result:结果:

No module named numpy.

Attempt 3: (add setup_requires=['numpy==1.18.5'] to setup() )尝试 3:(将setup_requires=['numpy==1.18.5']添加到setup()

python setup.py install

Result:结果:

numpy.distutils.system_info.NotFoundError: No lapack/blas resources found. Note: Accelerate is no longer supported.

During handling of the above exception, another exception occurred:

# Traceback goes here

RuntimeError: implement_array_function method already has a docstring

Attempt 4:尝试4:

I checked this issue and there is nothing helpful yet so I manually install numpy and scipy:我检查了这个问题,但没有任何帮助,所以我手动安装了 numpy 和 scipy:

pip install numpy==1.18.5 scipy # success
python setup.py install # fail

Result:结果:

ModuleNotFoundError: No module named 'skbuild'

Attempt 5:尝试5:

pip install scikit-build==0.11.1 # success
python setup.py install # fail

Result:结果:

error: Setup script exited with Problem with the CMake installation, aborting build. CMake executable is cmake

Attempt 6:尝试 6:

I checked the issue here and accordingly:我在这里检查了问题并相应地:

pip install cmake # success
python setup.py install 

Opencv is being built, I'm not sure why or what triggered the build so I aborted and manually installed opencv using pip: Opencv 正在构建中,我不确定为什么或什么触发了构建,所以我中止并使用 pip 手动安装 opencv:

pip install opencv-python-headless==4.4.0.46 # success
python setup.py install # fail

Result:结果:

Could not find suitable distribution for Requirement.parse('tensorflow-addons==0.11.2')

Attempt 7:尝试 7:

pip install tensorflow-addons==0.11.2 # success
python setup.py install 

Again lxml is being built, I don't know how or why, so I manually install it and:再次构建 lxml,我不知道如何或为什么,所以我手动安装它并:

pip install lxml==4.6.2 # success
python setup.py install # fail

Result:结果:

Running matplotlib-3.3.3/setup.py -q bdist_egg --dist-dir /var/folders/hr/61r_7jcx2r3cnklwrr2zwbqw0000gn/T/easy_install-q32mufo3/matplotlib-3.3.3/egg-dist-tmp-_js7sem9
UPDATING build/lib.macosx-11.0-x86_64-3.8/matplotlib/_version.py
set build/lib.macosx-11.0-x86_64-3.8/matplotlib/_version.py to '3.3.3'
error: Setup script exited with error: Failed to download FreeType. Please download one of ['https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz', 'https://download.savannah.gnu.org/releases/freetype/freetype-2.6.1.tar.gz'] and extract it into build/freetype-2.6.1 at the top-level of the source repository.

Attempt 8:尝试 8:

pip install matplotlib==3.3.3 # success
python setup.py install # fail

Result:结果:

Could not find suitable distribution for Requirement.parse('tensorflow==2.3.1')

Attempt 9:(already more than 75% of the requirements were already installed manually using pip in the previous attempts)尝试 9:(在之前的尝试中已经使用 pip 手动安装了超过 75% 的需求)

pip install tensorflow==2.3.1 # success
python setup.py install # fail

Result:(pandas fails to install)结果:(熊猫安装失败)

RuntimeError: Cannot cythonize without Cython installed.

Attempt 10: (I manually install cython)尝试10:(我手动安装cython)

pip install cython # success
python setup.py install

Again pandas for some reason is being built, so I manually install it and the list goes on... I think after this simple demonstration, I don't even need to replicate the steps of the second project however here are its requirements and I pretty much get a variation of the same problems shown above.再次 pandas 出于某种原因正在构建,所以我手动安装它并且列表继续......我认为在这个简单的演示之后,我什至不需要复制第二个项目的步骤但是这里是它的要求,我几乎得到了上面显示的相同问题的变体。

requirements.txt for project2项目 2 的requirements.txt

oauth2client==4.1.3
gcloud==0.18.3
pyarrow==2.0.0
requests==2.24.0
pandas==1.1.4
httplib2==0.15.0
TA-Lib==0.4.19
matplotlib==3.3.2

matplotlib fails first, followed by ta-lib (given that I run brew install ta-lib before then) and the list goes on... matplotlib 首先失败,然后是 ta-lib(鉴于我之前运行过brew install ta-lib )并且列表继续......

Instead of python setup.py install do python -m pip install.而不是python setup.py install执行python -m pip install. . .

Instead of python setup.py develop do pip install --editable.而不是python setup.py develop执行pip install --editable. . .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM