py-earth icon indicating copy to clipboard operation
py-earth copied to clipboard

Installation fails on python3.7

Open ChingzhiWU opened this issue 4 years ago • 7 comments

Dear @jcrudy

I tried several ways to install py-earth but all failed. I have Win10 and a python 3.7 environment.

Firstly, I used the git clone repository method to install, it gives me: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio". I don't want to install visual studio because it's too big (7GB)

Secondly, I used "conda install --channel "conda-forge" sklearn-contrib-py-earth" to install, it gives me: "An HTTP error occurred when trying to retrieve this URL."

Finally, I used I used the "sklearn_contrib_py_earth-0.1.0-cp36-cp36m-in_amd64" to install, it gives me: "ERROR: sklearn_contrib_py_earth-0.1.0-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform."

I am using anaconda, and can you give me guidance on py-earth installation on python 3.7 environments?

Many Thanks

ChingzhiWU avatar Mar 12 '20 16:03 ChingzhiWU

hey, i just solved this problem. Go to the website :[(https://www.lfd.uci.edu/~gohlke/pythonlibs/)] , find the corresponding py-earth package according to your python version , you can download the package to the pkgs directory. Switch Anaconda Prompt to the current path of the installation package, input pip install sklearn_contrib_py_earth-0.1.0-cp36-cp36m-win_amd64.whl(my version is 3.6), In spyder compiler,then import the pyearth. you are done!

RenTTing avatar Apr 19 '20 06:04 RenTTing

or just clone the repo and replace python setup.py install with python setup.py install --cythonize

see issue 191

sparkdoc avatar Dec 10 '20 00:12 sparkdoc

@sparkdoc the clone option does not work for me (Python 3.7.9, GCC 8.3.0, cython 0.29.24). The cythonize flag still returns the same traceback as trying to install from PyPI

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

pzivich avatar Sep 08 '21 14:09 pzivich

@pzivich have you tried

git clone -b issue191 git://github.com/jcrudy/py-earth.git
cd py-earth && python setup.py -q install --cythonize

kevin-dietz avatar Sep 08 '21 14:09 kevin-dietz

@kevin-dietz it looks like it installs (ignoring the warnings for unitialized vars or decprecated numpy API). However, when I try to import, I get the following error

>>> from pyearth import Earth
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/shared/code/PythonLibs/py-earth/pyearth/__init__.py", line 6, in <module>
    from .earth import Earth
  File "/mnt/shared/code/PythonLibs/py-earth/pyearth/earth.py", line 1, in <module>
    from ._forward import ForwardPasser
ModuleNotFoundError: No module named 'pyearth._forward'

pzivich avatar Sep 08 '21 15:09 pzivich

@pzivich One of two issues come to mind. You may have to manually move the pyearth directory that the install creates (e.g. /Users/pzvivich)/py-earth/pyearth) into your python packages directory.

Or you could have installed it into the wrong python version. You can use the actual python path to be explicit -- e.g. /Users/pzivich/anaconda3/bin/python setup.py -q install --cythonize

kevin-dietz avatar Sep 08 '21 17:09 kevin-dietz

Regarding the below issue of "No module named pyearth._forward" ... I found a solution in stackoverflow somewhere. When you create the example script to test the py-earth build (as in the readme), do not put that example script in the py-earth folder, put it in your home dir or some other dir. Then run it from there.

@kevin-dietz it looks like it installs (ignoring the warnings for unitialized vars or decprecated numpy API). However, when I try to import, I get the following error

>>> from pyearth import Earth
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/shared/code/PythonLibs/py-earth/pyearth/__init__.py", line 6, in <module>
    from .earth import Earth
  File "/mnt/shared/code/PythonLibs/py-earth/pyearth/earth.py", line 1, in <module>
    from ._forward import ForwardPasser
ModuleNotFoundError: No module named 'pyearth._forward'

diffent avatar Dec 27 '22 22:12 diffent