How to install mpmath on my win 64 bit machine?

84 views
Skip to first unread message

LuvPeaceMoney Freedom

unread,
Jan 17, 2024, 3:10:52 PM1/17/24
to mpmath
I have been trying for at least two hours every day for at least seven days to install mpmath on my recently installed python 3.12.1 
Many moons ago, I had no trouble using the arbitrary precision module with my python version 2.7. x. I am reasonable sure that the name of the module was "decimal" and it
worked great with no problems installing or anything else. At that time my OS was win XP Professional.
So far, All my research has produced nothing except driving me in circles and sending me to broken links. The bottom line is that I need some help which would be much appreciated. 

Brian Gladman

unread,
Jan 17, 2024, 6:25:59 PM1/17/24
to mpm...@googlegroups.com, LuvPeaceMoney Freedom
Hi,

Unfortunately mpmath depends on gmpy2 for which a version has not yet
been released to run under Python 3.12 (at least not on Windows)

However, the GMPY2 master repository has a new (unreleased) build for
GMPY2 that works with Python 3.12, which suggests that there is likely
to be a compatible release fairly soon.

I have built this pre-release version and can confirm that mpmath works
fine on Windows x64 when this version of GMPY2 is made available.

with my regards,

Brian G.

Oscar Benjamin

unread,
Jan 18, 2024, 1:47:52 AM1/18/24
to mpm...@googlegroups.com
On Wed, 17 Jan 2024 at 23:26, Brian Gladman <riem...@gmail.com> wrote:
>
> On 17/01/2024 19:45, LuvPeaceMoney Freedom wrote:
> > I have been trying for at least two hours every day for at least seven
> > days to install mpmath on my recently installed python 3.12.1
> > Many moons ago, I had no trouble using the arbitrary precision module
> > with my python version 2.7. x. I am reasonable sure that the name of the
> > module was "decimal" and it
> > worked great with no problems installing or anything else.

The decimal module is separate from mpmath and is in fact part of the
Python standard library. If you want to use decimal and you have
Python installed you should be good to go (no mpmath needed just
"import decimal").

> Unfortunately mpmath depends on gmpy2 for which a version has not yet
> been released to run under Python 3.12 (at least not on Windows)

Hi Brian!

When gmpy2 is installed mpmath will use it for a speedup but mpmath
can function fine without gmpy2.

It is perfectly possible to install mpmath on Python 3.12:

pip install mpmath

--
Oscar

LuvPeaceMoney Freedom

unread,
Jan 18, 2024, 5:46:38 AM1/18/24
to mpmath
Hi Brian -- Thank you very much for that info. It makes me feel better. Maybe there is an older version of python where the mpmath module can be imported easily. I will hunt around. If you know of one, let me know.

Hi Oscar -- Thanks for the info. The problem with the decimal module in 3.12.1 is that it does not do arbitrary precision which is what I want. 
I did try to install pip but was not able to do so. In fact, 3.12.1 never even heard about it.  If you know of another way to install mpmath, please inform me. Thanks.
>>> help(pip)
NameError: name 'pip' is not defined. Did you mean: 'zip'?
>>> help(mpmath)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'mpmath' is not defined 


Brian Gladman

unread,
Jan 18, 2024, 7:01:42 AM1/18/24
to mpm...@googlegroups.com
On 18/01/2024 09:06, LuvPeaceMoney Freedom wrote:

> Hi Brian -- Thank you very much for that info. It makes me feel better.
> Maybe there is an older version of python where the mpmath module can be
> imported easily. I will hunt around. If you know of one, let me know.
> Hi Oscar -- Thanks for the info. The problem with the decimal module in
> 3.12.1 is that it does not do arbitrary precision which is what I want.
> I did try to install pip but was not able to do so. In fact, 3.12.1
> never even heard about it.  If you know of another way to install
> mpmath, please inform me. Thanks.

Hi Oscar,

Thanks for reminding me that GMPY2 is not necessary for running mpmath -
I have ben running it with GMPY2 support for so long that I had
forgotten this.

Hi Rick,

Since you are not using GMPY2, I am now puzzled that you are having
issues in installing mpmath since it has installed for me without any
problems on Windows 11.

When Python is installed, pip is also installed at the same time so I am
now wondering if your Python installation has not fully installed. It
might hence be worth uninstalling and reinstalling Python 3.12 again.

If you do this it should give you the choice of installing for your use
only or installing for all users. In my experience doing the latter
makes more sense on a single user machine since it then puts the
installation in the "C:\Program Files\Python312" directory where most
common programs are located. On my system this directory includes:

<DIR> DLLs
<DIR> Doc
<DIR> include
<DIR> Lib
<DIR> libs
36,874 LICENSE.txt
1,691,514 NEWS.txt
103,192 python.exe
68,376 python3.dll
7,003,928 python312.dll
101,656 pythonw.exe
<DIR> Scripts
<DIR> share

and the Scripts directory includes tools including pip:

f2py.exe
flint.exe
fonttools.exe
isympy.exe
pip.exe
pip3.12.exe
pip3.exe
pyftmerge.exe
pyftsubset.exe
ttx.exe

It would be worth checking if your Python install directory matches this
now (or after reinstallation).

best regards,

Brian








> >>> help(pip)
> NameError: name 'pip' is not defined. Did you mean: 'zip'?
> >>> help(mpmath)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> NameError: name 'mpmath' is not defined
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "mpmath" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to mpmath+un...@googlegroups.com
> <mailto:mpmath+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/mpmath/44970897-92c2-4d88-8ec4-4c49a89c8b4en%40googlegroups.com <https://groups.google.com/d/msgid/mpmath/44970897-92c2-4d88-8ec4-4c49a89c8b4en%40googlegroups.com?utm_medium=email&utm_source=footer>.

LuvPeaceMoney Freedom

unread,
Jan 19, 2024, 1:41:47 AM1/19/24
to mpmath
Brian -- You did it!!! Check this out.

C:\Users\freed>cd C:\Program Files\Python312

C:\Program Files\Python312>pip install mpmath
Defaulting to user installation because normal site-packages is not writeable
Collecting mpmath
  Downloading mpmath-1.3.0-py3-none-any.whl (536 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 536.2/536.2 kB 2.4 MB/s eta 0:00:00
Installing collected packages: mpmath
Successfully installed mpmath-1.3.0

[notice] A new release of pip is available: 23.2.1 -> 23.3.2
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\Program Files\Python312>
****************************************
You can skip this rant.
I strained my pea brain today for about eight hours. Uninstalled and installed 3.12.1 at least six times with no success. pip install mpmath
did not work. I then installed PowerShell, struggled with that junk and gave up, more confused than ever. It then finally occurred to me to change the directory in my terminal to C:\ Program Files\Python which is where you told me park Python and it worked! the command, pip install mpmath, worked!   
BTW, when I was using Python 2.7 to do multi precision floating point math with no installation problems, I also installed some free software, Maxima which also did multi-precision math right out of the box and was not too difficult to learn.
Thanks again.  
Reply all
Reply to author
Forward
0 new messages