Bug #90326 ImportError: No module named site
Submitted: 6 Apr 2018 11:41 Modified: 29 Aug 2018 13:46
Reporter: chen chen (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Document Store: MySQL Shell Severity:S3 (Non-critical)
Version:1.0.11 OS:Red Hat (7.4)
Assigned to: CPU Architecture:Any

[6 Apr 2018 11:41] chen chen
Description:
[root@node1 bin]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.4 (Maipo)
[root@node1 bin]# uname -a
Linux node1 3.10.0-693.el7.x86_64 #1 SMP Thu Jul 6 19:56:57 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux

mysql-shell-1.0.11-linux-glibc2.12-x86-64bit.tar.gz

I tried to switch to python mode,But it is not ok。
Here is the output

[root@node1 bin]# ./mysqlsh
MySQL Shell 1.0.11

Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type '\help' or '\?' for help; '\quit' to exit.

Currently in JavaScript mode. Use \sql to switch to SQL mode and execute queries.
mysql-js> \py
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site

i located the site module

[root@node1 python2.7]# locate site.py
/usr/lib64/python2.7/site.py
/usr/lib64/python2.7/site.pyc
/usr/lib64/python2.7/site.pyo

then i set PYTHONPATH,and tried again,still not ok.

[root@node1 bin]# export PYTHONPATH=$PYTHONPATH:/usr/lib64/python2.7
[root@node1 bin]# ./mysqlsh 
MySQL Shell 1.0.11

Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type '\help' or '\?' for help; '\quit' to exit.

Currently in JavaScript mode. Use \sql to switch to SQL mode and execute queries.
mysql-js> \py
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site.py", line 556, in <module>
    main()
  File "/usr/lib64/python2.7/site.py", line 538, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib64/python2.7/site.py", line 266, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/lib64/python2.7/site.py", line 241, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib64/python2.7/site.py", line 231, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/lib64/python2.7/sysconfig.py", line 516, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib64/python2.7/sysconfig.py", line 449, in get_config_vars
    import re
  File "/usr/lib64/python2.7/re.py", line 105, in <module>
    import sre_compile
  File "/usr/lib64/python2.7/sre_compile.py", line 14, in <module>
    import sre_parse
  File "/usr/lib64/python2.7/sre_parse.py", line 17, in <module>
    from sre_constants import *
  File "/usr/lib64/python2.7/sre_constants.py", line 18, in <module>
    from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT

How to repeat:
just as mentioned above
[9 Apr 2018 7:12] MySQL Verification Team
Hello chen chen,

Thank you for the report and feedback.

Thanks,
Umesh
[17 Apr 2018 0:18] Alfredo Kojima
Please try with version 8.0.4 or later.
[29 Aug 2018 13:46] Margaret Fisher
Posted by developer:
 
Changelog entry not needed, closing.