'Failed to install pyearth module(close)

As mentioned in comments, because the module sklearn-contrib-py-earth was built in 2017, possibly Python version 3.9 is no longer supported this one.

I had tried a lot of ways to install pyearth; however, they all didn't work.
So does anyone know how to solve it?

Environment: GCP ubuntu 18.04.6 LTS, vscode version 1.64, python 3.9.10 64-bit.

pip3 install pyearth

(using sklearn-contrib-py-earth also got the same result.)

Defaulting to user installation because normal site-packages is not writeable
Collecting sklearn-contrib-py-earth
  Using cached sklearn-contrib-py-earth-0.1.0.tar.gz (1.0 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: scipy>=0.16 in /home/jameshuang/.local/lib/python3.9/site-packages (from sklearn-contrib-py-earth) (1.7.3)
Requirement already satisfied: scikit-learn>=0.16 in /home/jameshuang/.local/lib/python3.9/site-packages (from sklearn-contrib-py-earth) (1.0.2)
Requirement already satisfied: six in /home/jameshuang/.local/lib/python3.9/site-packages (from sklearn-contrib-py-earth) (1.16.0)
Requirement already satisfied: numpy>=1.14.6 in /home/jameshuang/.local/lib/python3.9/site-packages (from scikit-learn>=0.16->sklearn-contrib-py-earth) (1.21.4)
Requirement already satisfied: threadpoolctl>=2.0.0 in /home/jameshuang/.local/lib/python3.9/site-packages (from scikit-learn>=0.16->sklearn-contrib-py-earth) (3.0.0)
Requirement already satisfied: joblib>=0.11 in /home/jameshuang/.local/lib/python3.9/site-packages (from scikit-learn>=0.16->sklearn-contrib-py-earth) (1.1.0)
Building wheels for collected packages: sklearn-contrib-py-earth
  Building wheel for sklearn-contrib-py-earth (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [255 lines of output]

git clone can download the fold successfully but there is still a problem for installing.

git clone git://github.com/scikit-learn-contrib/py-earth.git
cd py-earth
sudo python3 setup.py install

https://pypi.org/project/sklearn-contrib-py-earth/
(using --cythonize option got the same result.)

/home/jameshuang/.local/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it with " \
  ^~~~~~~
pyearth/_util.c: In function ‘__Pyx_ParseOptionalKeywords’:
pyearth/_util.c:7561:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                     ^
In file included from /usr/include/python3.9/unicodeobject.h:1026:0,
                 from /usr/include/python3.9/Python.h:93,
                 from pyearth/_util.c:24:
/usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
 static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
pyearth/_util.c:7561:21: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                     ^
In file included from /usr/include/python3.9/unicodeobject.h:1026:0,
                 from /usr/include/python3.9/Python.h:93,
                 from pyearth/_util.c:24:
/usr/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
 Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
                                             ^~~~~~~~~~~~~~~~~~~
pyearth/_util.c:7561:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                     ^
In file included from /usr/include/python3.9/unicodeobject.h:1026:0,
                 from /usr/include/python3.9/Python.h:93,
                 from pyearth/_util.c:24:
/usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
 static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
pyearth/_util.c:7561:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                     ^
In file included from /usr/include/python3.9/unicodeobject.h:1026:0,
                 from /usr/include/python3.9/Python.h:93,
                 from pyearth/_util.c:24:
/usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
 static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
pyearth/_util.c:7561:21: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                     ^
In file included from /usr/include/python3.9/unicodeobject.h:1026:0,
                 from /usr/include/python3.9/Python.h:93,
                 from pyearth/_util.c:24:
/usr/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
 Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
                                             ^~~~~~~~~~~~~~~~~~~
pyearth/_util.c:7561:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                     ^
In file included from /usr/include/python3.9/unicodeobject.h:1026:0,
                 from /usr/include/python3.9/Python.h:93,
                 from pyearth/_util.c:24:
/usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
 static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
pyearth/_util.c:7577:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
In file included from /usr/include/python3.9/unicodeobject.h:1026:0,
                 from /usr/include/python3.9/Python.h:93,
                 from pyearth/_util.c:24:
/usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
 static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
pyearth/_util.c:7577:25: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
In file included from /usr/include/python3.9/unicodeobject.h:1026:0,
                 from /usr/include/python3.9/Python.h:93,
                 from pyearth/_util.c:24:
/usr/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
 Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
                                             ^~~~~~~~~~~~~~~~~~~
pyearth/_util.c:7577:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
In file included from /usr/include/python3.9/unicodeobject.h:1026:0,
                 from /usr/include/python3.9/Python.h:93,
                 from pyearth/_util.c:24:
/usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
 static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
pyearth/_util.c:7577:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
In file included from /usr/include/python3.9/unicodeobject.h:1026:0,
                 from /usr/include/python3.9/Python.h:93,
                 from pyearth/_util.c:24:
/usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
 static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
pyearth/_util.c:7577:25: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
In file included from /usr/include/python3.9/unicodeobject.h:1026:0,
                 from /usr/include/python3.9/Python.h:93,
                 from pyearth/_util.c:24:
/usr/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
 Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
                                             ^~~~~~~~~~~~~~~~~~~
pyearth/_util.c:7577:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
In file included from /usr/include/python3.9/unicodeobject.h:1026:0,
                 from /usr/include/python3.9/Python.h:93,
                 from pyearth/_util.c:24:
/usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
 static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
pyearth/_util.c: In function ‘__Pyx__ExceptionSave’:
pyearth/_util.c:8071:21: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
     *type = tstate->exc_type;
                     ^~~~~~~~
                     curexc_type
pyearth/_util.c:8072:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
     *value = tstate->exc_value;
                      ^~~~~~~~~
                      curexc_value
pyearth/_util.c:8073:19: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
     *tb = tstate->exc_traceback;
                   ^~~~~~~~~~~~~
                   curexc_traceback
pyearth/_util.c: In function ‘__Pyx__ExceptionReset’:
pyearth/_util.c:8080:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
     tmp_type = tstate->exc_type;
                        ^~~~~~~~
                        curexc_type
pyearth/_util.c:8081:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
     tmp_value = tstate->exc_value;
                         ^~~~~~~~~
                         curexc_value
pyearth/_util.c:8082:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
     tmp_tb = tstate->exc_traceback;
                      ^~~~~~~~~~~~~
                      curexc_traceback
pyearth/_util.c:8083:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
     tstate->exc_type = type;
             ^~~~~~~~
             curexc_type
pyearth/_util.c:8084:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
     tstate->exc_value = value;
             ^~~~~~~~~
             curexc_value
pyearth/_util.c:8085:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
     tstate->exc_traceback = tb;
             ^~~~~~~~~~~~~
             curexc_traceback
pyearth/_util.c: In function ‘__Pyx__GetException’:
pyearth/_util.c:8140:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
     tmp_type = tstate->exc_type;
                        ^~~~~~~~
                        curexc_type
pyearth/_util.c:8141:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
     tmp_value = tstate->exc_value;
                         ^~~~~~~~~
                         curexc_value
pyearth/_util.c:8142:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
     tmp_tb = tstate->exc_traceback;
                      ^~~~~~~~~~~~~
                      curexc_traceback
pyearth/_util.c:8143:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
     tstate->exc_type = local_type;
             ^~~~~~~~
             curexc_type
pyearth/_util.c:8144:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
     tstate->exc_value = local_value;
             ^~~~~~~~~
             curexc_value
pyearth/_util.c:8145:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
     tstate->exc_traceback = local_tb;
             ^~~~~~~~~~~~~
             curexc_traceback
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

And I tried python3 -m pip install sklearn-contrib-py-earth and python3 -m pip install pyearth but none of these worked.

 error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [255 lines of output]
      /home/jameshuang/.local/lib/python3.9/site-packages/setuptools/dist.py:717: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
...
pyearth/_util.c:8145:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
           tstate->exc_traceback = local_tb;
                   ^~~~~~~~~~~~~
                   curexc_traceback
      error: command '/usr/bin/x86_64-linux-gnu-gcc' 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 sklearn-contrib-py-earth
  Running setup.py clean for sklearn-contrib-py-earth
Failed to build sklearn-contrib-py-earth
Installing collected packages: sklearn-contrib-py-earth
  Running setup.py install for sklearn-contrib-py-earth: started
  Running setup.py install for sklearn-contrib-py-earth: finished with status 'error'
  error: subprocess-exited-with-error
  
  × Running setup.py install for sklearn-contrib-py-earth did not run successfully.
  │ exit code: 1
  ╰─> [205 lines of output]
...

× Encountered error while trying to install package.
╰─> sklearn-contrib-py-earth

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source