nbara/python-meegkit

module 'pymanopt' has no attribute 'function'

lokinou opened this issue · 6 comments

I cloned current master aed858d and run the following command pip install .

I tested examples/example_asr.ipynb
asr = ASR(method='euclid') works just well
but when I do:
asr = ASR(method='riemann')
the asr_fit() function works well, apparently since ISSUE#18 solved by enabling non scm estimators was addressed then merged into main

But then during asr_transform()
i get the following error
module 'pymanopt' has no attribute 'function'

I removed the @pymanopt.function.Callable and tested it again. Without success
The backtrack seems to point to the trust_regions function of pymanopt. it seems that the parameter
MAX_INNER_ITER: "maximum inner iterations" is 0 or NaN

Thanks a lot :)

Edit: i followed the example_asr.ipynb

nbara commented

Hi @lokinou thanks for reporting this. I will look into it next week, there may have been an update in pymanopt that I have missed.

I fixed my issue using pymanopt from git

The latest version on pip dates to Jan 23 2020, and the @function.Callable change has been made on Jan 26 . Not your fault then.

There is yet a tooth chipping issue on the way though

Apparently there is a bug with windows and numpy 1.9.4. An on top of that pymanopt keeps nagging me about requiring MKL 2018, so you have to set the MKL env variable.
Thus before typing:
~/pymanopt>pip install .
you got to add:
set MKL_THREADING_LAYER=GNU
I guess the equivalent on UNIX is
export MKL_THREADING_LAYER=GNU
Only then it decided to work on windows 10.

So the workaround seems to be:

  1. set MKL_THREADING_LAYER=GNU
  2. Install latest pymanopt via git

example_asr.ipynb works with ASR(method='riemann') for asr.fit() and asr.transform()

nbara commented

So I finally had a bit of time to look into it and I cannot reproduce this error using ASR(method='riemann').

→ conda list | grep pymanopt
pymanopt                  0.2.5                    pypi_0    pypi

Regarding your numpy issue, I can't reproduce this either (but I'm on mac).

I'm leaving this issue open in case others are having the same problem.

Same issue here with Pypi and also solved it by installing pymanopt with Git.
The 0.2.5 version from Pypi seems outdated. I looked directly in the files and found a xrange in pymanopt/solvers/trust_regions.py line 444.
They may have mess with Pypi in some way but not with the conda forge as it looks ok for you.

nbara commented

Yeah, it would definitely be easier if pymanopt were updated on pypi. In the meantime I'm a bit reluctant to add it to the requirements.txt in MEEGkit, as it has dependencies on PyTorch and Tensorflow, and I wanted to keep MEEGkit a bit more lightweight...

Sorry for the inconvenience.

nbara commented

Closing this. I made pymanopt an optional dependency (cf Readme). It's slow to import and this issue is annoying to work around.