pyhsmm icon indicating copy to clipboard operation
pyhsmm copied to clipboard

scipy's logsumexp moved in Scipy 0.19.0

Open tdhopper opened this issue 5 years ago • 9 comments

In scipy==0.19.0, the misc module was removed so scipy.misc.logsumexp becomes scipy.special.logsumexp. Six imports need fixed to resolve that.

One option is

try:
    from scipy.special import logsumexp
except ImportError:
    from scipy.misc import logsumexp  # removed in scipy 0.19.0

Otherwise, pin scipy>=0.19.0.

tdhopper avatar May 28 '19 15:05 tdhopper

Ran the following bash snippet in my anaconda python's site-packages directory: ~/anaconda3/lib/python3.6/site-packages$

FILES=$(find pyhsmm pybasicbayes -name "*.py")
for FILE in $FILES
do
  echo $FILE
  sed -i s/"from scipy.misc import logsumexp"/"from scipy.special import logsumexp"/g $FILE
done

python -c "import pyhsmm" # Should work now

satpreetsingh avatar Sep 23 '19 22:09 satpreetsingh

@satpreetsingh Condolences.

tdhopper avatar Sep 24 '19 14:09 tdhopper

hello to all, I am trying to set up the pyhsmmon my Windows x64 (python3.6), but when I tyr to run the examples, I get: ImportError: No module named 'hmm_messages_interface' colud you give me your environment?

Wusir2018 avatar Oct 16 '19 02:10 Wusir2018

This is still an issue when installing from pip as of 04/08/2020, but is fixed when install from the git repo.

@Wusir2018 are you installing from pip or from the git repo? If the latter, what compiler are you using? I saw similar issues when trying to install from the repo due to this issue. Try applying the fix suggested there to pyhssm/internals/util.h then installing again.

johnmbarrett avatar Apr 08 '20 21:04 johnmbarrett

Hi @johnmbarrett, I installed from pip. Thank you for you reply! I am so sorry about reply you late. I gave up using this project because I didn't install it successfully. Thank you very much! I will try it from git again!

Wusir2018 avatar Jul 01 '20 02:07 Wusir2018

I solved the issue by brute force. First I downloaded the package from Github on my laptop. Then I replaced from scipy.misc import logsumexp with from scipy.special import logsumexp in the following files: \pyhsmm\models.py \pybasicbayes\util\stats.py \pybasicbayes\distributions\negativebinomial.py \pybasicbayes\models\mixture.py. In the command prompt of windows python setup.py install. My set up is Windows 10 with Python 3.9.5.

KristanRomano avatar Jun 04 '21 09:06 KristanRomano

hey @KristanRomano would you be willing to write and submit a PR incorporating the changes you made?

mathDR avatar Jun 04 '21 14:06 mathDR

@mathDR I am actually pretty new to python and github. So I don't know how to satisfy your request. Maybe @mattjj might help you. I would also like to know his opinion on the solution I provided.

KristanRomano avatar Jun 04 '21 15:06 KristanRomano

Oh, okay. If you have a working solution to fix the logsumexp issue, you can do the following:

  1. clone the repo locally
  2. create a new branch (called something like: fix_logsumexp_issue_pyhsmm) from the main/master branch
  3. implement your changes there
  4. push those changes back to pyhsmm
  5. generate a "pull request" and tag some people (feel free to tag me) to review.
  6. Once reviewed, @mattjj can merge that code into main/master

Note, this is a typical workflow for adding new capabilities/ fixing bugs etc. to a repo. Please tag me with any questions if you want help working through the steps

mathDR avatar Jun 04 '21 15:06 mathDR