yade installation: AttributeError: module 'mpmath.ctx_mp_python' has no attribute 'mpf'

Asked by Rohit John

Hello,

I tried compiling yade in my Ubuntu 20.04 machine. I followed the instructions in [1]. The compilation completed without any errors. However, when I try to run yade, I get the following:

rohit@rkj-hp:~/personal/yade_source/yade_2020/install/bin$ ./yade-2020-11-05.git-7d0ae90
Welcome to Yade 2020-11-05.git-7d0ae90
Using python version: 3.8.5 (default, May 27 2021, 13:30:53)
[GCC 9.3.0]
TCP python prompt on localhost:9000, auth cookie `ycaekd'
XMLRPC info provider on http://localhost:21000
Traceback (most recent call last):
  File "./yade-2020-11-05.git-7d0ae90", line 416, in <module>
    import yade.qt
  File "/home/rohit/personal/yade_source/yade_2020/install/lib/x86_64-linux-gnu/yade-2020-11-05.git-7d0ae90/py/yade/qt/__init__.py", line 22, in <module>
    from yade.qt.Inspector import *
  File "/home/rohit/personal/yade_source/yade_2020/install/lib/x86_64-linux-gnu/yade-2020-11-05.git-7d0ae90/py/yade/qt/Inspector.py", line 8, in <module>
    from yade.qt.SerializableEditor import *
  File "/home/rohit/personal/yade_source/yade_2020/install/lib/x86_64-linux-gnu/yade-2020-11-05.git-7d0ae90/py/yade/qt/SerializableEditor.py", line 399, in <module>
    _fundamentalEditorMap[mpmath.ctx_mp_python.mpf]=AttrEditor_Mpmath
AttributeError: module 'mpmath.ctx_mp_python' has no attribute 'mpf'

I tried installing mpmath using pip3 install mpmath and I got the following:
Requirement already satisfied: mpmath in /usr/lib/python3/dist-packages (1.1.0)

How do I fix this? Please let me know if I have missed any information.

Kind regards,
Rohit K. John

[1] https://yade-dem.org/doc/installation.html#source-code

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Rohit John
Solved:
Last query:
Last reply:
Revision history for this message
Janek Kozicki (cosurgi) said :
#1

Hi, mixing third party package management software (e.g. pip) with native apt/aptitude/dpkg/*.deb package management does not go well. I recommended complete uninstall of packages installed with pip and use the system native method for installing packages.

Otherwise if you want to use pip you will have to find yourself what non-standard paths are necessary for python to find mpmath.

This isn't related much to yade in fact.

Revision history for this message
Rohit John (rohitkjohn) said :
#2

Dear Janek Kozicki,

I thought pip was the standard method to install python modules.

I am able to import mpmath to python, however, it says it does not have the attribute 'mpf' in it. Moreover, I had this problem way before I tried installing mpmath using pip.

Kind regards,
Rohit K. John

Revision history for this message
Janek Kozicki (cosurgi) said :
#3

No, The standard method to install is following:

sudo apt install cmake git freeglut3-dev libloki-dev libboost-all-dev fakeroot \
dpkg-dev build-essential g++ python3-dev python3-ipython python3-matplotlib \
libsqlite3-dev python3-numpy python3-tk gnuplot libgts-dev python3-pygraphviz \
libvtk6-dev libeigen3-dev python3-xlib python3-pyqt5 pyqt5-dev-tools python3-mpi4py \
python3-pyqt5.qtwebkit gtk2-engines-pixbuf python3-pyqt5.qtsvg libqglviewer-dev-qt5 \
python3-pil libjs-jquery python3-sphinx python3-git libxmu-dev libxi-dev libcgal-dev \
help2man libbz2-dev zlib1g-dev libopenblas-dev libsuitesparse-dev \
libmetis-dev python3-bibtexparser python3-future coinor-clp coinor-libclp-dev \
python3-mpmath libmpfr-dev libmpfrc++-dev

note the package: python3-mpmath above.

Revision history for this message
Rohit John (rohitkjohn) said :
#4

Dear Janek Kozicki,

Thanks for your advice. The problem is solved. I did the following

- uninstalling mpmath using pip
$ pip3 uninstall mpmath.
This did not work

- Uninstalling mpmath using apt-get
$ sudo apt-get remove python3-mpmath
This uninstalled mpmath

- Reinstall mpmath using command given in [1]
$ sudo apt install cmake git freeglut3-dev libloki-dev libboost-all-dev fakeroot \
dpkg-dev build-essential g++ python3-dev python3-ipython python3-matplotlib \
libsqlite3-dev python3-numpy python3-tk gnuplot libgts-dev python3-pygraphviz \
libvtk6-dev libeigen3-dev python3-xlib python3-pyqt5 pyqt5-dev-tools python3-mpi4py \
python3-pyqt5.qtwebkit gtk2-engines-pixbuf python3-pyqt5.qtsvg libqglviewer-dev-qt5 \
python3-pil libjs-jquery python3-sphinx python3-git libxmu-dev libxi-dev libcgal-dev \
help2man libbz2-dev zlib1g-dev libopenblas-dev libsuitesparse-dev \
libmetis-dev python3-bibtexparser python3-future coinor-clp coinor-libclp-dev \
python3-mpmath libmpfr-dev libmpfrc++-dev

This installed mpmath

When I ran yade it worked.

Kind regards,
Rohit K. John
[1] https://yade-dem.org/doc/installation.html#source-code

Revision history for this message
Janek Kozicki (cosurgi) said :
#5

Very nice! Thank you for posting the whole solution :)