mulllhausen
mulllhausen

Reputation: 4435

sympy 0.7.1 plot does not work

how can i fix this, or find the logs to investigate it?

$ python
Python 2.7.3 (default, Dec 18 2014, 19:10:20) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy import symbols
>>> from sympy.plotting import plot
OpenGL Warning: Failed to connect to host. Make sure 3D acceleration is enabled for this VM.
>>> x = symbols('x')
>>> p1 = plot(x*x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable
>>> import sympy
>>> sympy.__version__
'0.7.1.rc1'

it looks like the plotting module has not been fully installed?

Upvotes: 0

Views: 324

Answers (1)

mulllhausen
mulllhausen

Reputation: 4435

this seems to be a very old version of sympy. the api has changed. in sympy 0.7.1.rc1, plot is a module, not a function.

i solved the issue by removing the existing versions of mpmath and sympy (which had been installed with apt) and installing the latest versions like so:

$ sudo apt-get remove --purge python-mpmath python-sympy
$ sudo python -m easy_install mpmath
$ python
Python 2.7.3 (default, Mar 14 2014, 11:57:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mpmath
>>> mpmath.__version__
'0.19'
$ sudo python -m easy_install sympy
$ python
Python 2.7.3 (default, Mar 14 2014, 11:57:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sympy
>>> sympy.__version__
'0.7.6'

now plot() shows the graph.

in future, use python -m easy_install to install the latest version, and not apt-get which has old versions it seems.

Upvotes: 1

Related Questions