Search code examples
pythonpython-3.xpippython-3.7

python failed to map segment from shared memory


i have python3.7. i am getting the below error for everytime i run a script or even pip install

root@geek:/# python3.7 -m pip install pandas --proxy=https:______
Traceback (most recent call last):
 File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
 File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.7/site-packages/pip/__main__.py", line 19, in <module>
sys.exit(_main())
File "/usr/local/lib/python3.7/site-packages/pip/_internal/main.py", line 45, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
 File "/usr/local/lib/python3.7/site-packages/pip/_internal/commands/__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
 File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
 File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
 File "<frozen importlib._bootstrap>", line 983, in _find_and_load
 File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
 File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
 File "<frozen importlib._bootstrap_external>", line 728, in exec_module
 File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
 File "/usr/local/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 23, in <module>
from pip._internal.cli.req_command import RequirementCommand
 File "/usr/local/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 20, in <module>
from pip._internal.network.session import PipSession
 File "/usr/local/lib/python3.7/site-packages/pip/_internal/network/session.py", line 17, in <module>
from pip._vendor import requests, six, urllib3
 File "/usr/local/lib/python3.7/site-packages/pip/_vendor/requests/__init__.py", line 115, in <module>
from . import packages
 File "/usr/local/lib/python3.7/site-packages/pip/_vendor/requests/packages.py", line 8, in <module>
locals()[package] = __import__(vendored_package)
 File "/usr/local/lib/python3.7/site-packages/pip/_vendor/idna/__init__.py", line 2, in <module>
from .core import *
 File "/usr/local/lib/python3.7/site-packages/pip/_vendor/idna/core.py", line 3, in <module>
import unicodedata
ImportError: /usr/local/lib/python3.7/lib-dynload/unicodedata.cpython-37m-x86_64-linux-gnu.so: failed to map segment from shared object

this was working fine till last week. this error has arised suddenly. i did export the path, i did umount of /tmp i did increase the ulimit -m unlimited; ulimit -v unlimited. released some memory and none of this worked. Please help me


Solution

  • On windows server 2019 standard, running Docker EE for linux(lcow) this issue was caused by low memory allocation when using docker run command. It was resolved by setting docker run --memory="1g" or whatever is appropriate. Hope this helps someone else.