Python setup.py install not working mac

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. 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.

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
  • All kinds of problems do not occur if I just use 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.
  • python is installed using brew install

Attempt 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)

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())

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:

I checked this issue and there is nothing helpful yet so I manually install numpy and scipy:

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

Result:

ModuleNotFoundError: No module named 'skbuild'

Attempt 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:

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:

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:

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:

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:

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)

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)

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.

requirements.txt for project2

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 ...

How do I enable setup py?

To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.

Is setup py install deprecated?

You may still find advice all over the place that involves invoking setup.py directly, but unfortunately this is no longer good advice because as of the last few years all direct invocations of setup.py are effectively deprecated in favor of invocations via purpose-built and/or standards-based CLI tools like pip, build ...

Does pip install run setup py?

pip is a package manager, which can install, upgrade, list and uninstall packages, like familiar package managers including: dpkg, apt, yum, urpmi, ports etc. Under the hood, it will run python setup.py install , but with specific options to control how and where things end up installed. In summary: use pip .

How do I install a package using setup py?

Install a package using its setup.py script.
Set up your user environment (as described in the previous section)..
Use tar to unpack the archive (for example, foo-1.0.3.gz ); for example: tar -xzf foo-1.0.3.gz. ... .
Change ( cd ) to the new directory, and then, on the command line, enter: python setup.py install --user..