Sympy on python 3 - mpmath

270 views
Skip to first unread message

dennis

unread,
Feb 16, 2012, 10:50:28 AM2/16/12
to sy...@googlegroups.com
Hi,

I downloaded sympy from git and ran "bin/use2to3" but seems that it does not convert mpmath. The directory is missing in "py3k-sympy".

I get the following error:

>>> import sympy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sympy\__init__.py", line 49, in <module>
    from sympy.core import *
  File "sympy\core\__init__.py", line 8, in <module>
    from .expr import Expr, AtomicExpr
  File "sympy\core\expr.py", line 4, in <module>
    from .evalf import EvalfMixin
  File "sympy\core\evalf.py", line 6, in <module>
    import sympy.mpmath.libmp as libmp
ImportError: No module named mpmath.libmp

Any ideas?

Aaron Meurer

unread,
Feb 16, 2012, 12:12:33 PM2/16/12
to sy...@googlegroups.com
I'd say that this is a bug. The paths in your traceback suggest that
you're on Windows, which unfortunately, few of us are able to test.

Can you file an issue in our tracker for this?

Aaron Meurer

> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sympy/-/NZnf8ufSjhAJ.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to
> sympy+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.

Ronan Lamy

unread,
Feb 16, 2012, 12:20:09 PM2/16/12
to sy...@googlegroups.com

Try to run bin/use2to3 again, it's been known to forget files sometimes,
for no apparent reason.


Aaron Meurer

unread,
Feb 16, 2012, 12:32:54 PM2/16/12
to sy...@googlegroups.com

Also try it in https://github.com/sympy/sympy/pull/726, which
apparently *still* hasn't been merged.

Aaron Meurer

dennis

unread,
Feb 16, 2012, 1:49:51 PM2/16/12
to sy...@googlegroups.com
I tried on linux and it converts fine and the converted files can be run with python3 on windows. This solves my problem.

How do I download the sympy code with the pull request to try converting on windows? 

Aaron Meurer

unread,
Feb 18, 2012, 5:05:58 PM2/18/12
to sy...@googlegroups.com
There is a guide at the botton of the pull request on how to get it
(click on "help" after "comment on this pull request"). Or here's a
little guide of my own

- Navigate to the user's repo who has the pull request. In this case,
you would use https://github.com/vperic/sympy/.

- Click on the copy icon after the clone url. This should put
something like https://github.com/vperic/sympy.git on your clipboard.

Type

git remote add vperic https://github.com/vperic/sympy.git # Change
vperic to the username if it's a different user
git fetch vperic
git checkout vperic/branchname

You can get the branch name from the top of the pull request (it's in
a black box). In this case, it's use2to3-fixes.

If the branch is outdated against master and you need recent changes
from both, you can do

git merge master

at this point to put them together.

If you do try this branch (or any branch), please comment on the pull
request if it works or if it doesn't work for you.

Aaron Meurer

> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/sympy/-/exMR-BDiYxYJ.

dennis

unread,
Feb 23, 2012, 7:22:27 AM2/23/12
to sy...@googlegroups.com
I don't know if I did everything correctly, but it seems that it doesn't work. When running bin/use2to3, i get this error:

Removed trailing whitespace from py3k-sympy\sympy\physics\quantum\represent.py
Traceback (most recent call last):
  File "bin/use2to3", line 132, in <module>
    text = f.read()
  File "C:\Python32\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 5511: cha
racter maps to <undefined>

Aaron Meurer

unread,
Feb 23, 2012, 12:22:56 PM2/23/12
to sy...@googlegroups.com
Can you open an issue for this in our issue tracker
(http://code.google.com/p/sympy/issues/list)? I've never seen this
error before, but that's probably because I don't use Windows.

Aaron Meurer

> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/sympy/-/pI7Py8DQIB0J.

Chris Smith

unread,
Feb 23, 2012, 12:52:19 PM2/23/12
to sy...@googlegroups.com
What version of sympy are you using? There are no problems for me under 32bit windows.

dennis

unread,
Feb 23, 2012, 6:55:33 PM2/23/12
to sy...@googlegroups.com
I am using:

Windows 7 32-bit 
Python 3.2.2
sympy cloned from git repository (https://github.com/sympy/sympy.git)

Should I use a released version of sympy for this (0.7.1)?

Aaron Meurer

unread,
Feb 23, 2012, 10:08:32 PM2/23/12
to sy...@googlegroups.com
No, the released version does not support Python 3 (and anyway, we
won't ship use2to3, but rather, just pre-built Python 3 sources).

Aaron Meurer

> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/sympy/-/b0tpJ5_Jjq4J.

Reply all
Reply to author
Forward
0 new messages