MouseLand / cellpose

a generalist algorithm for cellular segmentation with human-in-the-loop capabilities
https://www.cellpose.org/
BSD 3-Clause "New" or "Revised" License
1.38k stars 393 forks source link

[INSTALL] Mac: ERROR: Failed building wheel for opencv-python-headless #832

Closed cpaulownia closed 1 month ago

cpaulownia commented 11 months ago

cellpose-log.docx Install problem I followed the instruction to install Cellpose in Mac Mojave (10.14.6) and get the following error: ERROR: Failed building wheel for opencv-python-headless I have tried to install in python 3.8 and 3.10 and got the same error. I have also pre-installed opencv 4.6.0.66 but still got the same error. Please see attached for the full run log, and I posted a short version below. Any help will be appreciated!

Environment info

packages in environment at /Users/CWC/anaconda3/envs/cellpose_py3_10:

#

Name Version Build Channel

bzip2 1.0.8 h1de35cc_0
ca-certificates 2023.08.22 hecd8cb5_0
libffi 3.4.4 hecd8cb5_0
ncurses 6.4 hcec6c5f_0
openssl 3.0.12 hca72f7f_0
pip 23.3.1 py310hecd8cb5_0
python 3.10.13 h5ee71fb_0
readline 8.2 hca72f7f_0
setuptools 68.0.0 py310hecd8cb5_0
sqlite 3.41.2 h6c40b1e_0
tk 8.6.12 h5d9f67b_0
tzdata 2023c h04d1e81_0
wheel 0.41.2 py310hecd8cb5_0
xz 5.4.2 h6c40b1e_0
zlib 1.2.13 h4dc903c_0

Run log (base) sokol-office-25-86a:~ CWC$ python -m pip install cellpose[gui]
Collecting cellpose[gui]
Obtaining dependency information for cellpose[gui] from https://files.pythonhosted.org/packages/ac/e0/faa627a4b0cb36b33e18c7c4cf0363d2274d7cef90bbcee08354178d0397/cellpose-2.2.3-py3-none-any.whl.metadata
Using cached cellpose-2.2.3-py3-none-any.whl.metadata (21 kB)
Requirement already satisfied: numpy>=1.20.0 in ./anaconda3/lib/python3.11/site-packages (from cellpose[gui]) (1.24.3) Requirement already satisfied: scipy in ./anaconda3/lib/python3.11/site-packages (from cellpose[gui]) (1.11.1) Collecting natsort (from cellpose[gui]) Obtaining dependency information for natsort from https://files.pythonhosted.org/packages/ef/82/7a9d0550484a62c6da82858ee9419f3dd1ccc9aa1c26a1e43da3ecd20b0d/natsort-8.4.0-py3-none-any.whl.metadata Using cached natsort-8.4.0-py3-none-any.whl.metadata (21 kB) Requirement already satisfied: tifffile in ./anaconda3/lib/python3.11/site-packages (from cellpose[gui]) (2023.4.12) Requirement already satisfied: tqdm in ./anaconda3/lib/python3.11/site-packages (from cellpose[gui]) (4.65.0) Requirement already satisfied: numba>=0.53.0 in ./anaconda3/lib/python3.11/site-packages (from cellpose[gui]) (0.57.0) Requirement already satisfied: llvmlite in ./anaconda3/lib/python3.11/site-packages (from cellpose[gui]) (0.40.0) Collecting torch>=1.6 (from cellpose[gui]) Obtaining dependency information for torch>=1.6 from https://files.pythonhosted.org/packages/63/e4/efa1029677516b7d8231dca794ad445127263029b703f56d9986554a640c/torch-2.1.1-cp311-none-macosx_10_9_x86_64.whl.metadata Using cached torch-2.1.1-cp311-none-macosx_10_9_x86_64.whl.metadata (25 kB) Collecting opencv-python-headless (from cellpose[gui]) Using cached opencv-python-headless-4.8.1.78.tar.gz (92.1 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting fastremap (from cellpose[gui]) Obtaining dependency information for fastremap from https://files.pythonhosted.org/packages/88/2e/b24be0f145b762c2568116f87ab519b1215b5bd6bf81667fb9c60eae5dd7/fastremap-1.14.0-cp311-cp311-macosx_10_9_x86_64.whl.metadata Using cached fastremap-1.14.0-cp311-cp311-macosx_10_9_x86_64.whl.metadata (9.7 kB) Requirement already satisfied: imagecodecs in ./anaconda3/lib/python3.11/site-packages (from cellpose[gui]) (2023.1.23) Collecting roifile (from cellpose[gui]) Obtaining dependency information for roifile from https://files.pythonhosted.org/packages/fd/15/6918cb0d6a3938602dc1fd116a93330e3c49a2e9f12891228ab2f990e20d/roifile-2023.8.30-py3-none-any.whl.metadata Using cached roifile-2023.8.30-py3-none-any.whl.metadata (5.1 kB) Collecting pyqtgraph>=0.11.0rc0 (from cellpose[gui]) Using cached pyqtgraph-0.13.3-py3-none-any.whl (960 kB) Collecting pyqt6 (from cellpose[gui]) Obtaining dependency information for pyqt6 from https://files.pythonhosted.org/packages/a6/b8/5d6ef0a9913a45fe3314a558ee45adeaa2c9701cede0fc47492be989164d/PyQt6-6.6.0-cp37-abi3-macosx_10_14_universal2.whl.metadata Using cached PyQt6-6.6.0-cp37-abi3-macosx_10_14_universal2.whl.metadata (2.1 kB) Collecting pyqt6.sip (from cellpose[gui]) Obtaining dependency information for pyqt6.sip from https://files.pythonhosted.org/packages/4c/df/8ad3c2e8cc151fdb4293dcd6c2bb4375eb49b626c34a37e657aafcb8e245/PyQt6_sip-13.6.0-cp311-cp311-macosx_10_9_universal2.whl.metadata Using cached PyQt6_sip-13.6.0-cp311-cp311-macosx_10_9_universal2.whl.metadata (503 bytes) Requirement already satisfied: qtpy in ./anaconda3/lib/python3.11/site-packages (from cellpose[gui]) (2.2.0) Collecting superqt (from cellpose[gui]) Obtaining dependency information for superqt from https://files.pythonhosted.org/packages/9e/25/f24abb44959276070c737bd45d2a2948b814360629a83a93d291dc42baf3/superqt-0.6.1-py3-none-any.whl.metadata Using cached superqt-0.6.1-py3-none-any.whl.metadata (5.7 kB) Collecting google-cloud-storage (from cellpose[gui]) Obtaining dependency information for google-cloud-storage from https://files.pythonhosted.org/packages/04/72/71b1b531cefa1daff8f6a2a70b4d4fa18dd4da851b5486d53578811b0838/google_cloud_storage-2.13.0-py2.py3-none-any.whl.metadata Using cached google_cloud_storage-2.13.0-py2.py3-none-any.whl.metadata (6.1 kB) Requirement already satisfied: filelock in ./anaconda3/lib/python3.11/site-packages (from torch>=1.6->cellpose[gui]) (3.9.0) Requirement already satisfied: typing-extensions in ./anaconda3/lib/python3.11/site-packages (from torch>=1.6->cellpose[gui]) (4.7.1) Requirement already satisfied: sympy in ./anaconda3/lib/python3.11/site-packages (from torch>=1.6->cellpose[gui]) (1.11.1) Requirement already satisfied: networkx in ./anaconda3/lib/python3.11/site-packages (from torch>=1.6->cellpose[gui]) (3.1) Requirement already satisfied: jinja2 in ./anaconda3/lib/python3.11/site-packages (from torch>=1.6->cellpose[gui]) (3.1.2) Requirement already satisfied: fsspec in ./anaconda3/lib/python3.11/site-packages (from torch>=1.6->cellpose[gui]) (2023.4.0) Collecting google-auth<3.0dev,>=2.23.3 (from google-cloud-storage->cellpose[gui]) Obtaining dependency information for google-auth<3.0dev,>=2.23.3 from https://files.pythonhosted.org/packages/86/a7/75911c13a242735d5aeaca6a272da380335ff4ba5f26d6b2ae20ff682d13/google_auth-2.23.4-py2.py3-none-any.whl.metadata Using cached google_auth-2.23.4-py2.py3-none-any.whl.metadata (4.7 kB) Collecting google-api-core!=2.0.,!=2.1.,!=2.2.,!=2.3.0,<3.0.0dev,>=1.31.5 (from google-cloud-storage->cellpose[gui]) Obtaining dependency information for google-api-core!=2.0.,!=2.1.,!=2.2.,!=2.3.0,<3.0.0dev,>=1.31.5 from https://files.pythonhosted.org/packages/c4/1e/924dcad4725d2e697888e044edf7a433db84bf9a3e40d3efa38ba859d0ce/google_api_core-2.14.0-py3-none-any.whl.metadata Using cached google_api_core-2.14.0-py3-none-any.whl.metadata (2.6 kB) Collecting google-cloud-core<3.0dev,>=2.3.0 (from google-cloud-storage->cellpose[gui]) Obtaining dependency information for google-cloud-core<3.0dev,>=2.3.0 from https://files.pythonhosted.org/packages/a2/40/02045f776fdb6e44194f34b6375a26ce8a61bd9bd03cd8930ed91cf51a62/google_cloud_core-2.3.3-py2.py3-none-any.whl.metadata Using cached google_cloud_core-2.3.3-py2.py3-none-any.whl.metadata (2.5 kB) Collecting google-resumable-media>=2.6.0 (from google-cloud-storage->cellpose[gui]) Obtaining dependency information for google-resumable-media>=2.6.0 from https://files.pythonhosted.org/packages/c7/4f/b8e5e22406e5aeafa46df8799939d5eeee52f18eeed339675167fac6603a/google_resumable_media-2.6.0-py2.py3-none-any.whl.metadata Using cached google_resumable_media-2.6.0-py2.py3-none-any.whl.metadata (2.1 kB) Requirement already satisfied: requests<3.0.0dev,>=2.18.0 in ./anaconda3/lib/python3.11/site-packages (from google-cloud-storage->cellpose[gui]) (2.31.0) Collecting google-crc32c<2.0dev,>=1.0 (from google-cloud-storage->cellpose[gui]) Using cached google_crc32c-1.5.0-cp311-cp311-macosx_10_9_x86_64.whl (30 kB) Collecting PyQt6-Qt6>=6.6.0 (from pyqt6->cellpose[gui]) Obtaining dependency information for PyQt6-Qt6>=6.6.0 from https://files.pythonhosted.org/packages/e2/c4/a24b34893ee3f88853b68668bbedacccd0685d0d94bf3e4e7d5725d90cb3/PyQt6_Qt6-6.6.0-py3-none-macosx_10_14_x86_64.whl.metadata Using cached PyQt6_Qt6-6.6.0-py3-none-macosx_10_14_x86_64.whl.metadata (534 bytes) Requirement already satisfied: packaging in ./anaconda3/lib/python3.11/site-packages (from qtpy->cellpose[gui]) (23.1) Requirement already satisfied: pygments>=2.4.0 in ./anaconda3/lib/python3.11/site-packages (from superqt->cellpose[gui]) (2.15.1) Collecting googleapis-common-protos<2.0.dev0,>=1.56.2 (from google-api-core!=2.0.,!=2.1.,!=2.2.,!=2.3.0,<3.0.0dev,>=1.31.5->google-cloud-storage->cellpose[gui]) Obtaining dependency information for googleapis-common-protos<2.0.dev0,>=1.56.2 from https://files.pythonhosted.org/packages/21/49/12996dc0238e017504dceea1d121a48bd49fb3f4416f40d59fc3e924b4f3/googleapis_common_protos-1.61.0-py2.py3-none-any.whl.metadata Using cached googleapis_common_protos-1.61.0-py2.py3-none-any.whl.metadata (1.5 kB) Collecting protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0.dev0,>=3.19.5 (from google-api-core!=2.0.,!=2.1.,!=2.2.,!=2.3.0,<3.0.0dev,>=1.31.5->google-cloud-storage->cellpose[gui]) Obtaining dependency information for protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0.dev0,>=3.19.5 from https://files.pythonhosted.org/packages/e6/db/7b2edc72807d45d72f9db42f3eb86ddaf37f9e55d923159b1dbfc9d835bc/protobuf-4.25.1-cp37-abi3-macosx_10_9_universal2.whl.metadata Using cached protobuf-4.25.1-cp37-abi3-macosx_10_9_universal2.whl.metadata (541 bytes) Collecting cachetools<6.0,>=2.0.0 (from google-auth<3.0dev,>=2.23.3->google-cloud-storage->cellpose[gui]) Obtaining dependency information for cachetools<6.0,>=2.0.0 from https://files.pythonhosted.org/packages/a2/91/2d843adb9fbd911e0da45fbf6f18ca89d07a087c3daa23e955584f90ebf4/cachetools-5.3.2-py3-none-any.whl.metadata Using cached cachetools-5.3.2-py3-none-any.whl.metadata (5.2 kB) Requirement already satisfied: pyasn1-modules>=0.2.1 in ./anaconda3/lib/python3.11/site-packages (from google-auth<3.0dev,>=2.23.3->google-cloud-storage->cellpose[gui]) (0.2.8) Collecting rsa<5,>=3.1.4 (from google-auth<3.0dev,>=2.23.3->google-cloud-storage->cellpose[gui]) Using cached rsa-4.9-py3-none-any.whl (34 kB) Requirement already satisfied: charset-normalizer<4,>=2 in ./anaconda3/lib/python3.11/site-packages (from requests<3.0.0dev,>=2.18.0->google-cloud-storage->cellpose[gui]) (2.0.4) Requirement already satisfied: idna<4,>=2.5 in ./anaconda3/lib/python3.11/site-packages (from requests<3.0.0dev,>=2.18.0->google-cloud-storage->cellpose[gui]) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in ./anaconda3/lib/python3.11/site-packages (from requests<3.0.0dev,>=2.18.0->google-cloud-storage->cellpose[gui]) (1.26.16) Requirement already satisfied: certifi>=2017.4.17 in ./anaconda3/lib/python3.11/site-packages (from requests<3.0.0dev,>=2.18.0->google-cloud-storage->cellpose[gui]) (2023.11.17) Requirement already satisfied: MarkupSafe>=2.0 in ./anaconda3/lib/python3.11/site-packages (from jinja2->torch>=1.6->cellpose[gui]) (2.1.1) Requirement already satisfied: mpmath>=0.19 in ./anaconda3/lib/python3.11/site-packages (from sympy->torch>=1.6->cellpose[gui]) (1.3.0) Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in ./anaconda3/lib/python3.11/site-packages (from pyasn1-modules>=0.2.1->google-auth<3.0dev,>=2.23.3->google-cloud-storage->cellpose[gui]) (0.4.8) Using cached torch-2.1.1-cp311-none-macosx_10_9_x86_64.whl (146.7 MB) Using cached cellpose-2.2.3-py3-none-any.whl (173 kB) Using cached fastremap-1.14.0-cp311-cp311-macosx_10_9_x86_64.whl (815 kB) Using cached google_cloud_storage-2.13.0-py2.py3-none-any.whl (121 kB) Using cached natsort-8.4.0-py3-none-any.whl (38 kB) Using cached PyQt6-6.6.0-cp37-abi3-macosx_10_14_universal2.whl (11.8 MB) Using cached PyQt6_sip-13.6.0-cp311-cp311-macosx_10_9_universal2.whl (132 kB) Using cached roifile-2023.8.30-py3-none-any.whl (16 kB) Using cached superqt-0.6.1-py3-none-any.whl (88 kB) Using cached google_api_core-2.14.0-py3-none-any.whl (122 kB) Using cached google_auth-2.23.4-py2.py3-none-any.whl (183 kB) Using cached google_cloud_core-2.3.3-py2.py3-none-any.whl (29 kB) Using cached google_resumable_media-2.6.0-py2.py3-none-any.whl (80 kB) Using cached PyQt6_Qt6-6.6.0-py3-none-macosx_10_14_x86_64.whl (54.5 MB) Using cached cachetools-5.3.2-py3-none-any.whl (9.3 kB) Using cached googleapis_common_protos-1.61.0-py2.py3-none-any.whl (230 kB) Using cached protobuf-4.25.1-cp37-abi3-macosx_10_9_universal2.whl (394 kB) Building wheels for collected packages: opencv-python-headless Building wheel for opencv-python-headless (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for opencv-python-headless (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [865 lines of output]

  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for opencv-python-headless Failed to build opencv-python-headless ERROR: Could not build wheels for opencv-python-headless, which is required to install pyproject.toml-based projects

apal6 commented 10 months ago

Hi,

Following up on this issue. I have a similar error on running python -m pip install cellpose

error: note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed cleaning build dir for imagecodecs Failed to build imagecodecs ERROR: Could not build wheels for imagecodecs, which is required to install pyproject.toml-based projects

Thanks in advance!

directysj commented 10 months ago

I was also having the same error on runningpython -m pip install cellpose[gui] using python = 3.8 , however I could successfully run and launch cellpose using python = 3.11 on iMac.

Thanks

apal6 commented 10 months ago

Hi @directysj, I was able to install it. Try running the followign commands:

`conda

conda create --name cellpose python=3.8 anaconda

conda activate cellpose

python -m pip install cellpose

python -m pip install 'cellpose[gui]'

python -m pip install omnipose scikit-image`

cpaulownia commented 10 months ago

Thanks for sharing your solutions here but unfortunately none of these works for me. opencv still fails for me regardless of python versions. Can anyone help?

carsen-stringer commented 8 months ago

Maybe you can install with brew? (https://formulae.brew.sh/formula/opencv) But I'm not a Mac expert (apple is not super helpful with python). You also can run cellpose in google colab

carsen-stringer commented 1 month ago

did the brew option work, or the latest version of opencv? I think many Mac users have had success installing Cellpose recently. will close for now but let us know if you have issues