[SERVER-52705] Rebuilding mongodb according to building.md failed because python3 is an alias/link (led to ModuleNotFoundError) Created: 09/Nov/20  Updated: 29/Oct/23  Resolved: 14/Jan/21

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: 4.2.9
Fix Version/s: 4.2.13

Type: Bug Priority: Trivial - P5
Reporter: Jialing Pei Assignee: Daniel Moody
Resolution: Fixed Votes: 0
Labels: Bug
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Amazon EC2 instance with ubuntu
gcc9.3.0
python3.8.5


Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

After installing all prerequisites indicated by the doc, executing the following scons script:

sudo python3 buildscripts/scons.py install-mongod

Sprint: Dev Platform 2021-01-25
Participants:

 Description   

I tried to rebuild mongodb according to building.md(github repo) and I got the following error when executing the scons scrtip(sudo python3 buildscripts/scons.py install-mongod):

 Generating build/opt/mongo/db/repl/rollback_gen.cpp
/usr/bin/python3 src/mongo/base/generate_error_codes.py src/mongo/base/error_codes.yml src/mongo/base/error_codes.tpl.h build/opt/mongo/base/error_codes.h
Traceback (most recent call last):
File "src/mongo/base/generate_error_codes.py", line 31, in <module>
from Cheetah.Template import Template
ModuleNotFoundError: No module named 'Cheetah'
Generating build/opt/mongo/db/repl/member_config_gen.cpp
Compiling build/opt/third_party/boost-1.70.0/libs/log/src/attribute_name.o
Compiling build/opt/third_party/icu4c-57.1/source/i18n/strrepl.o
Compiling build/opt/third_party/mozjs-60/extract/modules/fdlibm/s_rintf.o
Generating build/opt/mongo/db/ops/delete_request_gen.cpp
Compiling build/opt/third_party/mozjs-60/extract/modules/fdlibm/s_fabs.o
scons: *** [build/opt/mongo/base/error_codes.h] Error 1
scons: building terminated because of errors.
build/opt/mongo/base/error_codes.h failed: Error 1

 

Note:

I have Cheetah installed in /home/ubuntu/.local/lib/python3.8/site-packages/Cheetah and it is in PYTHONPATH. The potential problem might be that the subprocess has no idea of the original ENV variable but I don't know how to fix it. Specifically, I don't know which file invoked this subprocess.

 



 Comments   
Comment by Githook User [ 14/Jan/21 ]

Author:

{'name': 'Daniel Moody', 'email': 'daniel.moody@mongodb.com', 'username': 'dmoody256'}

Message: SERVER-52705 added better documentation around installing with pip.
Branch: v4.2
https://github.com/mongodb/mongo/commit/eb9e17ff6442f3e62b6fca0a9edc3371bbf7b0c3

Comment by Jialing Pei [ 09/Nov/20 ]

Thanks for replying so fast!

It seems that it is the case that python3 is not pointing to 3.8. It now works. Thanks!

Comment by Daniel Moody [ 09/Nov/20 ]

Is it possible python3 is an alias or link to a different version of python than python3.8?

If you install cheetah through pip from that version of python like:

sudo python3 -m pip install -U -r etc/pip/compile-requirements.txt

We upgraded the docs to suggest the use of -m pip instead of pip3 because pip3 may be pointing to a different version of python in this commit:
https://github.com/mongodb/mongo/commit/642a530878d2b7f929bedf9d93cf0ee23d05ccfa

So it may need to be further backported to make things more clear on older branches.

Generated at Thu Feb 08 05:28:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.