[SERVER-28881] MongoDB failed to build due to ImportError: No module named typing Created: 20/Apr/17  Updated: 20/Apr/17  Resolved: 20/Apr/17

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

Type: Question Priority: Major - P3
Reporter: KarenHuang [X] Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows Server 2012 R2 + VS2017 RTM + Python 2.7 + SCons 2.5.1


Issue Links:
Duplicate
duplicates SERVER-28879 MongoDB failed to build due to Import... Closed
Participants:

 Description   

I tried to build Mongodb with master barnch latest revision on Windows. It failed due to ImportError: No module named typing. This issue can be produced form master branch revision c776e095 (https://github.com/mongodb/mongo/commit/c776e095ac25d0426624f4a84c03f0094c3c661f)

Some investigation on my side:
It seems that module typing is supported from python 3.5. But SCons does not run under Python version 3.6.1. Python 3 and above are not yet supported. Is there any workaround for this issue? Thanks!

You can repro the issue as the steps below:
1. git clone -c core.autocrlf=true https://github.com/mongodb/mongo D:\MongoDB\src
2. Open a VS 2015 x64 command prompt and browse to D:\MongoDB\src
3. scons all -j4

Error info:
C:\tools\Python2\python.exe buildscripts/idl/idlc.py --base_dir build/opt --header build\opt\mongo\idl\unittest_gen.h --output build\opt\mongo\idl\unittest_gen.cpp src\mongo\idl\unittest.idl
Traceback (most recent call last):
File "buildscripts/idl/idlc.py", line 23, in <module>
import idl.compiler
File "D:\MongoDB\src\buildscripts\idl\idl\compiler.py", line 26, in <module>
from typing import Any, List
ImportError: No module named typing
scons: *** [build\opt\mongo\idl\unittest_gen.cpp] Error 1



 Comments   
Comment by Stennie Steneker (Inactive) [ 20/Apr/17 ]

Hi,

To build MongoDB from source please follow the requirements as documented on the MongoDB GitHub wiki instructions:
https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source

As you've noted SCons does not fully support Python 3 yet, so you will have to use Python 2.7.

I also noticed you originally filed this question in the MONGOID project, which is for reporting bugs or feature suggestions for the Mongoid ODM.

For future discussion around building MongoDB or working with the source code please post in the mongodb-dev discussion group.

If you have questions about using MongoDB, the mongodb-user discussion forum would be a more appropriate starting point.

Regards,
Stephen

Generated at Thu Feb 08 04:19:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.