BiomedicalMachineLearning / stLearn

A novel machine learning pipeline to analyse spatial transcriptomics data
Other
176 stars 23 forks source link

Installation issue on Mac M3 #278

Open earn97 opened 5 months ago

earn97 commented 5 months ago

Hello,

I'm encountering issues while trying to install stlearn on my M3 Mac. I've followed the installation instructions using both conda and pip.

Here is the error message from conda install conda install -c conda-forge stlearn :

Channels:
 - conda-forge
 - defaults
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: failed

LibMambaUnsatisfiableError: Encountered problems while solving:
  - nothing provides louvain needed by stlearn-0.4.7-pyhd8ed1ab_0

Could not solve for environment specs
The following package could not be installed
└─ stlearn is not installable because it requires
   └─ louvain, which does not exist (perhaps a missing channel).

I installed the louvain with pip but the same error came out.

Also i tried installation with pip pip install -U stlearn :

Building wheels for collected packages: fa2
  Building wheel for fa2 (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [214 lines of output]
      Installing fa2 package (fastest forceatlas2 python implementation)

      >>>> Cython is installed?
      Cython is not installed; using pre-generated C files if available
      Please install Cython first and try again if you face any installation problems

      >>>> Are pre-generated C files available?
      Yes

      >>>> Starting to install!

      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-11.0-arm64-cpython-310
      creating build/lib.macosx-11.0-arm64-cpython-310/fa2
      copying fa2/fa2util.py -> build/lib.macosx-11.0-arm64-cpython-310/fa2
      copying fa2/__init__.py -> build/lib.macosx-11.0-arm64-cpython-310/fa2
      copying fa2/forceatlas2.py -> build/lib.macosx-11.0-arm64-cpython-310/fa2
      running egg_info
      writing fa2.egg-info/PKG-INFO
      writing dependency_links to fa2.egg-info/dependency_links.txt
      writing requirements to fa2.egg-info/requires.txt
      writing top-level names to fa2.egg-info/top_level.txt
      reading manifest file 'fa2.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      writing manifest file 'fa2.egg-info/SOURCES.txt'
      copying fa2/fa2util.c -> build/lib.macosx-11.0-arm64-cpython-310/fa2
      copying fa2/fa2util.pxd -> build/lib.macosx-11.0-arm64-cpython-310/fa2
      running build_ext
      building 'fa2.fa2util' extension
      creating build/temp.macosx-11.0-arm64-cpython-310
      creating build/temp.macosx-11.0-arm64-cpython-310/fa2
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/gudo-eon/miniconda3/envs/python-3.10/include -arch arm64 -fPIC -O2 -isystem /Users/gudo-eon/miniconda3/envs/python-3.10/include -arch arm64 -I/Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10 -c fa2/fa2util.c -o build/temp.macosx-11.0-arm64-cpython-310/fa2/fa2util.o
      fa2/fa2util.c:10939:33: error: no member named 'tp_print' in 'struct _typeobject'
        __pyx_type_3fa2_7fa2util_Node.tp_print = 0;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
      fa2/fa2util.c:10947:33: error: no member named 'tp_print' in 'struct _typeobject'
        __pyx_type_3fa2_7fa2util_Edge.tp_print = 0;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
      fa2/fa2util.c:10960:35: error: no member named 'tp_print' in 'struct _typeobject'
        __pyx_type_3fa2_7fa2util_Region.tp_print = 0;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
      fa2/fa2util.c:12133:22: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                          (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                           ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
            PyUnicode_WSTR_LENGTH(op) :                    \
            ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      fa2/fa2util.c:12133:22: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                          (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                           ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
            ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
                   ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
      ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      fa2/fa2util.c:12133:22: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                          (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                           ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
             PyUnicode_WSTR_LENGTH(op)))
             ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      fa2/fa2util.c:12133:52: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                          (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                         ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
            PyUnicode_WSTR_LENGTH(op) :                    \
            ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      fa2/fa2util.c:12133:52: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                          (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                         ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
            ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
                   ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
      ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      fa2/fa2util.c:12133:52: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                          (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                         ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
             PyUnicode_WSTR_LENGTH(op)))
             ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      fa2/fa2util.c:12149:26: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                              (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                               ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
            PyUnicode_WSTR_LENGTH(op) :                    \
            ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      fa2/fa2util.c:12149:26: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                              (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                               ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
            ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
                   ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
      ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      fa2/fa2util.c:12149:26: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                              (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                               ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
             PyUnicode_WSTR_LENGTH(op)))
             ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      fa2/fa2util.c:12149:59: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                              (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                                ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
            PyUnicode_WSTR_LENGTH(op) :                    \
            ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      fa2/fa2util.c:12149:59: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                              (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                                ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
            ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
                   ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
      ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      fa2/fa2util.c:12149:59: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                              (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                                ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
             PyUnicode_WSTR_LENGTH(op)))
             ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Users/gudo-eon/miniconda3/envs/python-3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      12 warnings and 3 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

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

And I installed fa2 and wheel but also the same error came out.

xiao233333 commented 5 months ago

Hi, it seems the error came from installing the fa2 dependency package. You can try building it from source

git clone https://github.com/bhargavchippada/forceatlas2
cd forceatlas2
pip install . --user

or downgrading your Python version to 3.8.

alexwang8 commented 5 months ago

I'm also having similar issues. Downgrading python and building fa2 dependency package from scratch did not solve issues. Am on M2 chip though.

chiwwong commented 2 months ago

@xiao233333 @alexwang8 I use M2 Mac and both build from source and downgrading are not working. Do you get chance to figure out a solution? Thanks!