sleap icon indicating copy to clipboard operation
sleap copied to clipboard

Cannot detect GPUs - ImportError: C extension: None not built

Open ValeriePineauNoel opened this issue 4 months ago • 4 comments

Bug description

Cannot detect GPU in the SLEAP environment with the command python -c "import sleap; sleap.system_summary()". I have an error instead.

Expected behaviour

I would expect the command python -c "import sleap; sleap.system_summary()" to return the number of available GPUs and so on.

Actual behaviour

I installed SLEAP correctly (I think). I am able to find the environment in the conda environment list:

# conda environments:
#
base                  *  /Users/valeriepineaunoel/mambaforge
sleap                    /Users/valeriepineaunoel/mambaforge/envs/sleap
                         /Users/valeriepineaunoel/miniforge3
                         /Users/valeriepineaunoel/miniforge3/envs/sleap
                         /Users/valeriepineaunoel/miniforge3/envs/social-interactions
                         /Users/valeriepineaunoel/miniforge3/envs/tutorial_env
                         /Users/valeriepineaunoel/opt/anaconda3
                         /Users/valeriepineaunoel/opt/anaconda3/envs/ads_venv
                         /Users/valeriepineaunoel/opt/anaconda3/envs/cellpose-env

conda activate sleap works. Now when I want to make sure that SLEAP detects the GPU on my system with python -c "import sleap; sleap.system_summary()", I get an error

Traceback (most recent call last):
  File "/Users/valeriepineaunoel/mambaforge/envs/sleap/lib/python3.9/site-packages/pandas/__init__.py", line 26, in <module>
    from pandas.compat import (
  File "/Users/valeriepineaunoel/mambaforge/envs/sleap/lib/python3.9/site-packages/pandas/compat/__init__.py", line 26, in <module>
    from pandas.compat.numpy import is_numpy_dev
  File "/Users/valeriepineaunoel/mambaforge/envs/sleap/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py", line 21, in <module>
    raise ImportError(
ImportError: this version of pandas is incompatible with numpy < 1.22.4
your numpy version is 1.19.5.
Please upgrade numpy to >= 1.22.4 to use this pandas version

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/valeriepineaunoel/mambaforge/envs/sleap/lib/python3.9/site-packages/sleap/__init__.py", line 10, in <module>
    from sleap.io.dataset import Labels, load_file
  File "/Users/valeriepineaunoel/mambaforge/envs/sleap/lib/python3.9/site-packages/sleap/io/dataset.py", line 72, in <module>
    from sleap.instance import (
  File "/Users/valeriepineaunoel/mambaforge/envs/sleap/lib/python3.9/site-packages/sleap/instance.py", line 32, in <module>
    from sleap.io.video import Video
  File "/Users/valeriepineaunoel/mambaforge/envs/sleap/lib/python3.9/site-packages/sleap/io/video.py", line 8, in <module>
    import imgstore
  File "/Users/valeriepineaunoel/mambaforge/envs/sleap/lib/python3.9/site-packages/imgstore/__init__.py", line 1, in <module>
    from .stores import new_for_filename, new_for_format, extract_only_frame, get_supported_formats,\
  File "/Users/valeriepineaunoel/mambaforge/envs/sleap/lib/python3.9/site-packages/imgstore/stores.py", line 19, in <module>
    import pandas as pd
  File "/Users/valeriepineaunoel/mambaforge/envs/sleap/lib/python3.9/site-packages/pandas/__init__.py", line 31, in <module>
    raise ImportError(
ImportError: C extension: None not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext' to build the C extensions first.

Running python setup.py build_ext gives me

python: can't open file '/Users/valeriepineaunoel/Documents/PhD/AutomaticBehaviourAnalysis/setup.py': [Errno 2] No such file or directory

Running sleap-label gives me the same error.

I followed the instructions under If you are on Linux, have a NVIDIA GPU, but cannot detect your GPU: in the documentation for SLEAP installation, but I get the same errors.

Your personal set up

I followed the pre-installation for M1 steps, next the installing mambaforge section and finally the conda package section. For some reason, I am not able to activate the SLEAP environment with mamba activate sleap (I have the error Run 'mamba init' to be able to run mamba activate/deactivate and start a new shell session. Or use conda to activate/deactivate., and these instructions do not work), but it is working with conda activate sleap.

  • OS:
MacOS 14.4
  • Version(s):
Environment packages
# paste output of `pip freeze` or `conda list` here

absl-py==0.15.0 aiohappyeyeballs @ file:///home/conda/feedstock_root/build_artifacts/aiohappyeyeballs_1727779797566/work aiohttp @ file:///Users/runner/miniforge3/conda-bld/aiohttp_1728629000337/work aiosignal @ file:///home/conda/feedstock_root/build_artifacts/aiosignal_1667935791922/work astunparse @ file:///home/conda/feedstock_root/build_artifacts/astunparse_1728923142236/work async-timeout @ file:///home/conda/feedstock_root/build_artifacts/async-timeout_1691763562544/work attrs==23.1.0 blinker @ file:///home/conda/feedstock_root/build_artifacts/blinker_1715091184126/work Brotli @ file:///Users/runner/miniforge3/conda-bld/brotli-split_1687884187023/work cached-property @ file:///home/conda/feedstock_root/build_artifacts/cached_property_1615209429212/work cachetools==4.2.4 cattrs @ file:///home/conda/feedstock_root/build_artifacts/cattrs_1604136207372/work certifi @ file:///home/conda/feedstock_root/build_artifacts/certifi_1725278078093/work/certifi cffi @ file:///Users/runner/miniforge3/conda-bld/cffi_1725560567968/work charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1728479282467/work clang==5.0 click @ file:///home/conda/feedstock_root/build_artifacts/click_1692311806742/work contourpy @ file:///Users/runner/miniforge3/conda-bld/contourpy_1712429956050/work cryptography @ file:///Users/runner/miniforge3/conda-bld/cryptography-split_1672672491497/work cycler @ file:///home/conda/feedstock_root/build_artifacts/cycler_1696677705766/work efficientnet==1.0.0 flatbuffers @ file:///home/conda/feedstock_root/build_artifacts/python-flatbuffers_1617723079010/work fonttools @ file:///Users/runner/miniforge3/conda-bld/fonttools_1729530356476/work frozenlist @ file:///Users/runner/miniforge3/conda-bld/frozenlist_1725395664823/work gast @ file:///home/conda/feedstock_root/build_artifacts/gast_1596839682936/work google-auth==1.35.0 google-auth-oauthlib @ file:///home/conda/feedstock_root/build_artifacts/google-auth-oauthlib_1630497468950/work google-pasta @ file:///home/conda/feedstock_root/build_artifacts/google-pasta_1722873999312/work grpcio @ file:///Users/runner/miniforge3/conda-bld/grpc-split_1660349735869/work h2 @ file:///home/conda/feedstock_root/build_artifacts/h2_1634280454336/work h5py==3.1.0 hdmf==3.9.0 hpack==4.0.0 hyperframe @ file:///home/conda/feedstock_root/build_artifacts/hyperframe_1619110129307/work idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1726459485162/work image-classifiers==1.0.0 imagecodecs @ file:///Users/runner/miniforge3/conda-bld/imagecodecs_1668867656682/work imageio @ file:///home/conda/feedstock_root/build_artifacts/imageio_1729190692267/work imgaug @ file:///home/conda/feedstock_root/build_artifacts/imgaug_1640909786103/work imgstore==0.2.9 importlib_metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1726082825846/work importlib_resources @ file:///home/conda/feedstock_root/build_artifacts/importlib_resources_1725921340658/work joblib @ file:///home/conda/feedstock_root/build_artifacts/joblib_1714665484399/work jsmin @ file:///home/conda/feedstock_root/build_artifacts/jsmin_1642532731678/work jsonpickle==1.2 jsonschema==4.19.0 jsonschema-specifications==2023.7.1 keras==2.6.0 Keras-Applications==1.0.8 Keras-Preprocessing @ file:///home/conda/feedstock_root/build_artifacts/keras-preprocessing_1610713559828/work kiwisolver @ file:///Users/runner/miniforge3/conda-bld/kiwisolver_1725459195356/work lazy_loader @ file:///home/conda/feedstock_root/build_artifacts/lazy-loader_1723774329602/work Markdown @ file:///home/conda/feedstock_root/build_artifacts/markdown_1710435156458/work markdown-it-py @ file:///home/conda/feedstock_root/build_artifacts/markdown-it-py_1686175045316/work MarkupSafe @ file:///Users/runner/miniforge3/conda-bld/markupsafe_1729351318299/work matplotlib @ file:///Users/runner/miniforge3/conda-bld/matplotlib-suite_1715976186715/work mdurl @ file:///home/conda/feedstock_root/build_artifacts/mdurl_1704317613764/work multidict @ file:///Users/runner/miniforge3/conda-bld/multidict_1729065493631/work munkres==1.1.4 ndx-pose==0.1.1 networkx @ file:///home/conda/feedstock_root/build_artifacts/networkx_1698504735452/work nixio==1.5.3 numpy==1.19.5 oauthlib @ file:///home/conda/feedstock_root/build_artifacts/oauthlib_1666056362788/work opencv-python==4.6.0 opt-einsum==3.3.0 packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1718189413536/work pandas @ file:///Users/runner/miniforge3/conda-bld/pandas_1726878426767/work patsy @ file:///home/conda/feedstock_root/build_artifacts/patsy_1704469236901/work Pillow @ file:///Users/runner/miniforge3/conda-bld/pillow_1666920647802/work propcache @ file:///Users/runner/miniforge3/conda-bld/propcache_1728545746686/work protobuf==3.20.3 psutil @ file:///Users/runner/miniforge3/conda-bld/psutil_1728965164785/work pyasn1 @ file:///home/conda/feedstock_root/build_artifacts/pyasn1_1726839225972/work pyasn1_modules @ file:///home/conda/feedstock_root/build_artifacts/pyasn1-modules_1726029546107/work pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1711811537435/work Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1714846767233/work PyJWT @ file:///home/conda/feedstock_root/build_artifacts/pyjwt_1722701264352/work pykalman @ file:///home/conda/feedstock_root/build_artifacts/pykalman_1711547707628/work pynwb==2.5.0 pyOpenSSL @ file:///home/conda/feedstock_root/build_artifacts/pyopenssl_1685514481738/work pyparsing @ file:///home/conda/feedstock_root/build_artifacts/pyparsing_1728880423364/work PySide2==5.15.8 PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1661604839144/work python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1709299778482/work python-rapidjson @ file:///Users/runner/miniforge3/conda-bld/python-rapidjson_1722901885195/work pytz @ file:///home/conda/feedstock_root/build_artifacts/pytz_1706886791323/work pyu2f @ file:///home/conda/feedstock_root/build_artifacts/pyu2f_1604248910016/work PyWavelets==1.6.0 PyYAML @ file:///Users/runner/miniforge3/conda-bld/pyyaml_1725456176118/work pyzmq @ file:///Users/runner/miniforge3/conda-bld/pyzmq_1724399128390/work qimage2ndarray==1.10.0 QtPy @ file:///home/conda/feedstock_root/build_artifacts/qtpy_1698112029416/work referencing==0.30.2 requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1717057054362/work requests-oauthlib @ file:///home/conda/feedstock_root/build_artifacts/requests-oauthlib_1711290127547/work rich @ file:///home/conda/feedstock_root/build_artifacts/rich_1728057819683/work/dist rpds-py==0.10.3 rsa @ file:///home/conda/feedstock_root/build_artifacts/rsa_1658328885051/work ruamel.yaml==0.17.32 ruamel.yaml.clib==0.2.7 scikit-image @ file:///Users/runner/miniforge3/conda-bld/scikit-image_1719499435765/work/dist/scikit_image-0.24.0-cp39-cp39-macosx_10_13_x86_64.whl#sha256=dc1cb9c710a4541be80ed6d8503634ad2ba466ccd9a3abe9d2e6617fe07dc874 scikit-learn @ file:///Users/runner/miniforge3/conda-bld/scikit-learn_1632611470401/work scikit-video==1.1.11 scipy==1.9.0 seaborn @ file:///home/conda/feedstock_root/build_artifacts/seaborn-split_1714494649443/work segmentation-models==1.0.1 shapely @ file:///Users/runner/miniforge3/conda-bld/shapely_1727273432006/work shiboken2==5.15.8 six==1.15.0 sleap==1.3.3 statsmodels @ file:///Users/runner/miniforge3/conda-bld/statsmodels_1727986739068/work tensorboard==2.6.0 tensorboard-data-server @ file:///Users/runner/miniforge3/conda-bld/tensorboard-data-server_1670043848285/work/tensorboard_data_server-0.6.1-py3-none-macosx_10_9_x86_64.whl tensorboard-plugin-wit @ file:///home/conda/feedstock_root/build_artifacts/tensorboard-plugin-wit_1641458951060/work/tensorboard_plugin_wit-1.8.1-py3-none-any.whl tensorflow==2.6.3 tensorflow-estimator==2.6.0 tensorflow-hub @ file:///home/conda/feedstock_root/build_artifacts/tensorflow-hub_1618768305670/work/wheel_dir/tensorflow_hub-0.12.0-py2.py3-none-any.whl termcolor==1.1.0 threadpoolctl @ file:///home/conda/feedstock_root/build_artifacts/threadpoolctl_1714400101435/work tifffile @ file:///home/conda/feedstock_root/build_artifacts/tifffile_1665588749940/work typing-extensions==3.10.0.2 tzdata @ file:///home/conda/feedstock_root/build_artifacts/python-tzdata_1727140567071/work tzlocal==5.0.1 unicodedata2 @ file:///Users/runner/miniforge3/conda-bld/unicodedata2_1695848049988/work urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1726496430923/work Werkzeug @ file:///home/conda/feedstock_root/build_artifacts/werkzeug_1724330738730/work wrapt==1.12.1 yarl @ file:///Users/runner/miniforge3/conda-bld/yarl_1729423571118/work zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1726248574750/work zstandard==0.23.0

Logs
# paste relevant logs here, if any

Screenshots

How to reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

ValeriePineauNoel avatar Oct 22 '24 17:10 ValeriePineauNoel