cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Can't build 3.13b1 on Ubuntu: no module named math

Open RobH123 opened this issue 1 year ago • 8 comments

Bug report

Bug description:

After successfully running ./configure --enable-optimizations on Ubuntu 23.10

~/Downloads/Python-3.13.0b1$ make
Running code to generate profile data (this can take a while):
# First, we need to create a clean build with profile generation
# enabled.
make profile-gen-stamp
make[1]: Entering directory '/home/me/Downloads/Python-3.13.0b1'
make[1]: 'profile-gen-stamp' is up to date.
make[1]: Leaving directory '/home/me/Downloads/Python-3.13.0b1'
# Next, run the profile task to generate the profile information.
./python -m test --pgo --timeout=
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/robert/Downloads/Python-3.13.0b1/Lib/test/__main__.py", line 1, in <module>
    from test.libregrtest.main import main
  File "/home/robert/Downloads/Python-3.13.0b1/Lib/test/libregrtest/main.py", line 2, in <module>
    import random
  File "/home/robert/Downloads/Python-3.13.0b1/Lib/random.py", line 53, in <module>
    from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
ModuleNotFoundError: No module named 'math'
make: *** [Makefile:886: profile-run-stamp] Error 1

CPython versions tested on:

3.13

Operating systems tested on:

Linux

RobH123 avatar May 08 '24 23:05 RobH123

I have installed Python 3.13 with the Deadsnakes PPA (Personal Package Archive) for my native Ubuntu 22.04.x LTS. However, I am currently stuck on alpha and lack the majority of modules available on earlier stable versions. The alpha--and beta--versions of Python software are generally not ready for full production, but we assume that you are a Python developer and/or contributor. In this case you may also have to fall back on your earlier or default version available (depending on a specific context).

novaTopFlex avatar May 09 '24 00:05 novaTopFlex

@novaTopFlex Please open a new issue if you have a specific problem.

hugovk avatar May 09 '24 04:05 hugovk

I'm unable to reproduce this on Ubuntu 23.10 on main. Did you install build-essential?

erlend-aasland avatar May 20 '24 18:05 erlend-aasland

Thanks for looking at this. 'build-essential is already the newest version (12.10ubuntu1)' But wouldn't ./configure have caught that if it was missing? I've built Python3.12 many times in the past, so it's likely something new required by 3.13.

Ok, I've upgraded to 24.04 since first submitting this, so did a 'make clean' and './configure --enable-optimizations' and got a lot further (for some reason that I don't understand), but after more research, I suspect the culprit is libmpdec-dev. (After lots of compiling, I now get 'no module named _decimal'.)

Unfortunately, the instructions at https://devguide.python.org/getting-started/setup-building/#build-dependencies aren't really correct for recent Ubuntu versions, e.g., Ubuntu now uses a folder sources.list.d/ rather than a file /etc/apt/sources.list.

I tried to adapt the instructions and follow the suggestions (including enabling the source repo), but still ended up with: Unable to locate package libmpdec-dev Perhaps https://packages.ubuntu.com/search?keywords=libmpdec-dev is telling me that Ubuntu Noble doesn't have it???

RobH123 avatar May 20 '24 21:05 RobH123

Yes, the libmpdec issue was just fixed on main. You can specify --without-system-libmpdec to mitigate it for now.

erlend-aasland avatar May 20 '24 21:05 erlend-aasland

Hmmh, we seem to be getting there slowly, thanks. (I assumed the above parameter goes on the './configure --enable-optimizations' line.)

Now 'test test_sqlite3 failed' yet 'libsqlite3-dev is already the newest version (3.45.1-1ubuntu2)'.

RobH123 avatar May 20 '24 21:05 RobH123

BTW, should I submit a documentation issue for https://devguide.python.org/getting-started/setup-building/#build-dependencies (see https://github.com/python/cpython/issues/118809#issuecomment-2121201344 above). If so, where should that be done?

RobH123 avatar May 20 '24 21:05 RobH123

BTW, should I submit a documentation issue for https://devguide.python.org/getting-started/setup-building/#build-dependencies (see #118809 (comment) above). If so, where should that be done?

It seems to me this is a devguide issue, yeah. Let's close this as not-planned. Thanks for the report, though.

erlend-aasland avatar May 21 '24 15:05 erlend-aasland