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

Installation of pyearth with python 3.8.10

Open pgr123 opened this issue 2 years ago • 2 comments

Good evening I tried to install pyearth with pip3 install sklearn-contrib-py-earth but I got errors. I have installed sklearn with pip3 install -U scikit-learn without problem. What can I do ? How can I install pyearth on python 3.8 ? Thank you to help me. Excuse my bad english (I am french). P. Grandeau

pgr123 avatar May 07 '22 17:05 pgr123

@pgr123 Have you tried building it directly from source? I always have good luck with that. Assuming you are using anaconda in the default location, it would be:

git clone -b issue191 https://github.com/jcrudy/py-earth.git
cd py-earth && ${HOME}/anaconda3/bin/python setup.py -q install --cythonize
rm -Rf ${HOME}/anaconda3/bin/pyearth && mv pyearth ${HOME}/anaconda3/bin/

kevin-dietz avatar May 10 '22 14:05 kevin-dietz

This project is largely abandoned, and the pip release is out of date. There is a branch here that seems to work for most folks: https://github.com/scikit-learn-contrib/py-earth/issues/210#issuecomment-874390577

bmreiniger avatar May 10 '22 14:05 bmreiniger

This project is largely abandoned, and the pip release is out of date. There is a branch here that seems to work for most folks: #210 (comment)

Are there any reasons for it being abandoned other than time cost to update the package?

jhogg11 avatar Nov 08 '22 16:11 jhogg11

@jhogg11 The main author has largely abandoned the project. However, there is nothing to stop someone from forking the repo and taking up the reins

kevin-dietz avatar Nov 08 '22 16:11 kevin-dietz

Thank you for your responses. I know the "pip install git+https://github.com/scikit-learn-contrib/[email protected]". It worked with Python 3.8 but it does not work with Python 3.10 (and then with the new Ubuntu 22.04). I don't know why !

pgr123 avatar Nov 08 '22 19:11 pgr123

@pgr123 Haven't tried it on 3.10 but I can confirm it does work on 3.9. If you want to try it on 3.10, the following code may work for you:

git clone https://github.com/jcrudy/py-earth.git
cd py-earth  
python setup.py build_ext --inplace --cythonize
mv pyearth path/to/site-packages/python3.9/site-packages

kevin-dietz avatar Nov 08 '22 19:11 kevin-dietz

@pgr123 Haven't tried it on 3.10 but I can confirm it does work on 3.9. If you want to try it on 3.10, the following code may work for you:

git clone https://github.com/jcrudy/py-earth.git
cd py-earth  
python setup.py build_ext --inplace --cythonize
mv pyearth path/to/site-packages/python3.9/site-packages

I'm also using 3.9 and this works for me. Thank you!

jhogg11 avatar Nov 08 '22 20:11 jhogg11

Thank you but that does not work. I got many errors like : error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’? error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’? error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?

and at the end I got : error: Command "x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/lib/python3/dist-packages/numpy/core/include -I/usr/include/python3.10 -c pyearth/_util.c -o build/temp.linux-x86_64-3.10/pyearth/_util.o" failed with exit status 1

Do you think there is a solution ? Have a good day.

pgr123 avatar Nov 09 '22 06:11 pgr123

@pgr123 the project has been abandoned so if you are dead set on using py-earth then my suggestion would be to use python 3.8 or 3.9

kevin-dietz avatar Nov 09 '22 13:11 kevin-dietz

It's a pity ! So, there is no mean to uses MARS (earth) with Python ? And else, how can I downgrade to Python 3.9 ? Thank you.

pgr123 avatar Nov 09 '22 13:11 pgr123

The problem seems to be with Python 3.10. I installed Python 3.9 but when I try python3.9 -m pip install git+https://github.com/scikit-learn-contrib/[email protected]" I get an error : No module named distutils.cmd I don't know what to do ! That new version of Ubuntu with python 3.10 (bugged) is very difficult and for me, it seems unusable and take me a lot of time. So I think there is for me only one solution : go back to Ubuntu 20.04 which works perfectly !!!! Thank you but that new version is not usable, I'll wait the version 22.04.5 or 22.04.6 !!!!!!!

pgr123 avatar Nov 10 '22 07:11 pgr123

Even Spyder does not work with Ubuntu 22.04.1 and Python 3.10 !

pgr123 avatar Nov 10 '22 07:11 pgr123

@pgr123 Haven't tried it on 3.10 but I can confirm it does work on 3.9. If you want to try it on 3.10, the following code may work for you:

git clone https://github.com/jcrudy/py-earth.git
cd py-earth  
python setup.py build_ext --inplace --cythonize
mv pyearth path/to/site-packages/python3.9/site-packages

does this work when I'm installing pyEarth on a virtual environment? (i.e a Django environment)

vea-therese avatar Nov 12 '22 09:11 vea-therese

How can I install py-earth on a virtual environment ? I never used virtual environment and I don't know what Django is. Thank you. Have a good day.

pgr123 avatar Nov 12 '22 09:11 pgr123

The update to Spyder 5.4.0 works with Ubuntu 22.04.1 and Python 3.10.6 but I have actually no solution for py-earth. Someone know how to do a earth model ( MARS : Multivariate Adaptive Regression Splines) with Python under Python 3.10 ? Thank you.

pgr123 avatar Nov 12 '22 10:11 pgr123

@vea-therese it installs fine using pipenv, so I see no reason why it wouldn’t install in other virtual environment setups

kevin-dietz avatar Nov 12 '22 11:11 kevin-dietz

@vea-therese it installs fine using pipenv, so I see no reason why it wouldn’t install in other virtual environment setups

I've tried pip install and cloning but it still won't work. Though I haven't tried downgrading my python version, I currently have 3.10

vea-therese avatar Nov 12 '22 12:11 vea-therese

@vea-therese Others have mentioned it won’t install properly on 3.10 but should install fine on <= 3.9

kevin-dietz avatar Nov 12 '22 13:11 kevin-dietz

That is true but how can I change the Python 3.10 do downgrade to Python 3.9. And I must reinstall all my python packages and the problem is that Ubuntu 22.04.1 use Python 3.10.6 so it is used by the OS and I cannot change it. What can I do ? Thank you.

pgr123 avatar Nov 12 '22 13:11 pgr123

@vea-therese Others have mentioned it won’t install properly on 3.10 but should install fine on <= 3.9

I downgraded my global python to 3.7, it still didn't work. I tried 3.7 because I was able to install pyearth in a conda environment with a 3.7 python weeks ago. That's why I'm wondering if it is possible to connect a virtual environment or the Django project into my conda environment with pyearth.

vea-therese avatar Nov 12 '22 15:11 vea-therese

That is true but how can I change the Python 3.10 do downgrade to Python 3.9. And I must reinstall all my python packages and the problem is that Ubuntu 22.04.1 use Python 3.10.6 so it is used by the OS and I cannot change it. What can I do ? Thank you.

if you're using conda, I just typed: conda install python=3.7 or 3.9 since that's the version that you prefer.

Though if you're referring to the global python, I just uninstalled the 3.10 and installed 3.7. I use Windows, I'm not familiar with Ubuntu.

vea-therese avatar Nov 12 '22 15:11 vea-therese

Thank you, I don't use conda. Maybe, I must install it (or anaconda) but I don't know how install and use it on Ubuntu. And is it sure that py-earth will work with it ? Seen the big changes in Python 3.10, I think it should have been called Python 4 (LOL !)

pgr123 avatar Nov 12 '22 15:11 pgr123

I downgraded my global python to 3.7, it still didn't work. I tried 3.7 because I was able to install pyearth in a conda environment with a 3.7 python weeks ago. That's why I'm wondering if it is possible to connect a virtual environment or the Django project into my conda environment with pyearth.

@vea-therese Here is a code snippet to try to install it in a virtual environment.

git clone https://github.com/jcrudy/py-earth.git
cd py-earth  

pipenv run $(pipenv --venv)/bin/python setup.py build_ext --inplace --cythonize

mv pyearth $(pipenv --venv)/lib/python3.9/site-packages

If that doesn't work, this docker image may help you install py-earth into a virtual environment: https://gitlab.com/gitlab-data/data-science

kevin-dietz avatar Nov 12 '22 18:11 kevin-dietz

Thank you, I'll try that tomorrow.

pgr123 avatar Nov 12 '22 18:11 pgr123

I forgot to thank u @kevin-dietz it worked! We're now presenting our thesis.

vea-therese avatar Nov 18 '22 17:11 vea-therese

Good morning, I managed to compile py-earth with Python 3.10. After git clone https://github.com/jcrudy/py-earth.git cd py-earth
and we must modify the files utils.c and types.c and changes the "exc_" with "curexc_". Then the compilation works and the packages works in Python 3.10 !!!! Good news ! And no need of virtual environment ! Thanks to all. Have a good day.

pgr123 avatar Nov 19 '22 09:11 pgr123

Good morning, I managed to compile py-earth with Python 3.10. After git clone https://github.com/jcrudy/py-earth.git cd py-earth and we must modify the files utils.c and types.c and changes the "exc_" with "curexc_". Then the compilation works and the packages works in Python 3.10 !!!! Good news ! And no need of virtual environment ! Thanks to all. Have a good day.

Thank you! Just an addition, I had to replace "exc_" with "curexc_" for the other .c files as well and using python setup.py install --cythonize

evertonsantanaj avatar Jan 17 '23 19:01 evertonsantanaj

I downgraded my global python to 3.7, it still didn't work. I tried 3.7 because I was able to install pyearth in a conda environment with a 3.7 python weeks ago. That's why I'm wondering if it is possible to connect a virtual environment or the Django project into my conda environment with pyearth.

@vea-therese Here is a code snippet to try to install it in a virtual environment.

git clone https://github.com/jcrudy/py-earth.git
cd py-earth  

pipenv run $(pipenv --venv)/bin/python setup.py build_ext --inplace --cythonize

mv pyearth $(pipenv --venv)/lib/python3.9/site-packages

If that doesn't work, this docker image may help you install py-earth into a virtual environment: https://gitlab.com/gitlab-data/data-science

@kevin-dietz the analytics image in your repo seems based on Python 3.7. What is the minor version of 3.9 or cython version you have to make it work? I could not compile on Linux based system. Thanks.

vancities avatar Apr 25 '23 02:04 vancities

@vancities we have stopped supporting py-earth in our image because the package has not been updated in 5.5 years.

kevin-dietz avatar Apr 25 '23 11:04 kevin-dietz

I succeeded in running py-earth with Python 3.10 with few modifs and it works well ! If somebody want to know how to do, tell me. Excuse my bad English. Pascal

pgr123 avatar Apr 25 '23 12:04 pgr123