mattjj / pyhsmm

MIT License
545 stars 172 forks source link

scipy's logsumexp moved in Scipy 0.19.0 #97

Open tdhopper opened 5 years ago

tdhopper commented 5 years ago

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.

satpreetsingh commented 4 years ago

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
tdhopper commented 4 years ago

@satpreetsingh Condolences.

Wusir2018 commented 4 years ago

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?

johnmbarrett commented 4 years ago

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.

Wusir2018 commented 4 years ago

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!

KristanRomano commented 3 years ago

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.

mathDR commented 3 years ago

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

KristanRomano commented 3 years ago

@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.

mathDR commented 3 years ago

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