I always get this error when I try to install a python module using pip (py -m pip install (whatever) )
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\__main__.py", line 16, in <module>
from pip._internal import main as _main # noqa
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\_internal\__init__.py", line 20, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\_vendor\urllib3\__init__.py", line 8, in <module>
from .connectionpool import (
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 11, in <module>
from .exceptions import (
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\_vendor\urllib3\exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import (
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 203, in load_module
mod = mod._resolve()
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 115, in _resolve
return _import_module(self.mod)
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 82, in _import_module
__import__(name)
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 71, in <module>
import email.parser
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\email\parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "C:\Users\userAppData\Local\Programs\Python\Python35\lib\email\feedparser.py", line 27, in <module>
from email import message
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\email\message.py", line 16, in <module>
from email import utils
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\email\utils.py", line 30, in <module>
import datetime
File "C:\Users\user\Desktop\datetime.py", line 10, in <module>
date = datetime.datetime.fromtimestamp(str(['positionTS']) / 1e3)
AttributeError: module 'datetime' has no attribute 'fromtimestamp'
I've tried several options from here to fix it but each results in the same error. I am wondering if I need to uninstall then re-install, possibly with an older version.
All help appreciated.
This looks very similar to a problem I have seen (and answered already). Looks like you have either a module or a Python program that's names the same as a system module: datetime.py (I see "C:\Users\user\Desktop\datetime.py" in your stack trace).
There are many situations when this can lead to problems and should be avoided.
See here for another example of the same situation:
ModuleNotFoundError: No module named 'tensorflow.contrib'; 'tensorflow' is not a package
Related
I was working with smtplib module in python and it suddenly started giving NameError
I am getting the following error when importing smtblib or email in python:
Traceback (most recent call last):
File "/Users/Desktop/outlook_email.py", line 25, in <module>
import smtplib
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/smtplib.py", line 48, in <module>
import email.message
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/email/message.py", line 945, in <module>
class MIMEPart(Message):
NameError: name 'Message' is not defined
I am also getting the same error while running any pip command. For ex. pip install, pip uninstall, pip freeze all commands give the same error
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/configuration.py", line 20, in <module>
from pip._internal.exceptions import (
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/exceptions.py", line 13, in <module>
from pip._vendor.requests.models import Request, Response
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/requests/__init__.py", line 43, in <module>
from pip._vendor import urllib3
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/urllib3/__init__.py", line 11, in <module>
from . import exceptions
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/urllib3/exceptions.py", line 3, in <module>
from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 982, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 925, in _find_spec
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/six.py", line 192, in find_spec
return spec_from_loader(fullname, self)
File "<frozen importlib._bootstrap>", line 431, in spec_from_loader
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/six.py", line 222, in is_package
return hasattr(self.__get_module(fullname), "__path__")
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/six.py", line 121, in __getattr__
_module = self._resolve()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/six.py", line 118, in _resolve
return _import_module(self.mod)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/urllib3/packages/six.py", line 87, in _import_module
__import__(name)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 72, in <module>
import email.message
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/email/message.py", line 945, in <module>
class MIMEPart(Message):
NameError: name 'Message' is not defined
I am also getting the same error while running any python script.
What can be the solution for this. Thanks in advance.
I just reinstalled my python and upgraded to a latest 9.3 version which seemed to solve the issue.
I installed the python-certifi-win32 module (I'm so busy trying to fix this problem that I don't even remember why I originally installed it). Right after I installed it, though, I started getting this error when I run pip (extended error code below): PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\user1\\AppData\\Local\\Temp\\tmph93rz74c'
When I delete the file C:\\Users\\user1\\AppData\\Local\\Temp\\tmph93rz74c, another file pops up in its place, just with a different random combination of letters and numbers, and the error says the new file name instead.
I have no idea how to fix it, my pip hasn't been working for days. I've looked through tens of pages of google results.
Full error code:
Traceback (most recent call last):
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\Scripts\pip.exe\__main__.py", line 4, in <module>
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\configuration.py", line 20, in <module>
from pip._internal.exceptions import (
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\exceptions.py", line 13, in <module>
from pip._vendor.requests.models import Request, Response
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\requests\__init__.py", line 135, in <module>
from . import utils
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\requests\utils.py", line 27, in <module>
from . import certs
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 170, in exec_module
notify_module_loaded(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi_win32\wrapt_pip.py", line 35, in apply_patches
import certifi
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 170, in exec_module
notify_module_loaded(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi\core.py", line 37, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 95, in _tempfile
os.remove(raw_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\user1\\AppData\\Local\\Temp\\tmph93rz74c'
I ran into the same problem after installing python-certifi-win32. I installed this package in the hope to solve errors caused by the self-signed certificate used by our SSL Inspection infrastructure.
To bring pip back to a running state remove python-certifi-win32 from the installation folder:
Determine the installation path for pip packages (source):
python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
Switch to the folder and delete the package's files:
del python-certifi-win32-init.pth
rmdir /s/q python_certifi_win32-1.6.dist-info
I could observe the same error pattern when upgrading from Python 3.9 to Python 3.10. Somehow python-certifi-win32 seems to be malfunctioning in certain scenarios then.
Andrew Leech, the author of python-certifi-win32, suggests to move on to his other project pip-system-certs . Drop-in replacing the library with pip-system-certs (PyPI link) solved all issues for me.
the only solution to this problem is to delete Python from control panel.Then completely delete the Python folder from the address below
windows:
C:\Users\user1\AppData\Local\Programs\python
and linux base:
/bin/python3
() isikkaplan#iamhere# python3 manage.py loadfixtures -s=testing fixture fixtures/knock/0_ct.json -v3
Traceback (most recent call last):
File "/Users/isikkaplan/Desktop/code/---/-/--/manage.py", line 21, in <module>
main()
File "/Users/isikkaplan/Desktop/code/---/-/--/manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/alphashape/__init__.py", line 6, in <module>
from .alphashape import alphashape
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/alphashape/alphashape.py", line 15, in <module>
import geopandas
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/geopandas/__init__.py", line 1, in <module>
from geopandas._config import options # noqa
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/geopandas/_config.py", line 126, in <module>
default_value=_default_use_pygeos(),
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/geopandas/_config.py", line 112, in _default_use_pygeos
import geopandas._compat as compat
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/geopandas/_compat.py", line 202, in <module>
import rtree # noqa
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/rtree/__init__.py", line 9, in <module>
from .index import Rtree, Index # noqa
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/rtree/index.py", line 6, in <module>
from . import core
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/site-packages/rtree/core.py", line 77, in <module>
rt.Error_GetLastErrorNum.restype = ctypes.c_int
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/ctypes/__init__.py", line 395, in __getattr__
func = self.__getitem__(name)
File "/opt/homebrew/Caskroom/miniforge/base/envs/--/lib/python3.9/ctypes/__init__.py", line 400, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, Error_GetLastErrorNum): symbol not found
Almost all of the answers online leads to installing spatialindex which I already have and I have no idea how can I fix this.
If you are using a conda environment like I am, which is basically a necessity if you are on an m1 and not using docker, then you need to install the system libraries for the current environment via conda also.
conda install -c conda-forge libspatialindex
Here is the stacktrace I get from pip. I'm running Windows 10.
What to do here?
I can see the pip version and other options with main but can't download / install any packages.
D:\Python>python.exe -m pip install --upgrade pip
Traceback (most recent call last):
File "D:\Python\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "D:\Python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\Python\lib\site-packages\pip\__main__.py", line 26, in <module>
sys.exit(_main())
File "D:\Python\lib\site-packages\pip\_internal\cli\main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "D:\Python\lib\site-packages\pip\_internal\commands\__init__.py", line 104, in create_command
module = importlib.import_module(module_path)
File "D:\Python\lib\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 "D:\Python\lib\site-packages\pip\_internal\commands\install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
File "D:\Python\lib\site-packages\pip\_internal\cli\req_command.py", line 16, in <module>
from pip._internal.index.package_finder import PackageFinder
File "D:\Python\lib\site-packages\pip\_internal\index\package_finder.py", line 21, in <module>
from pip._internal.index.collector import parse_links
File "D:\Python\lib\site-packages\pip\_internal\index\collector.py", line 14, in <module>
from pip._vendor import html5lib, requests
File "D:\Python\lib\site-packages\pip\_vendor\html5lib\__init__.py", line 25, in <module>
from .html5parser import HTMLParser, parse, parseFragment
File "D:\Python\lib\site-packages\pip\_vendor\html5lib\html5parser.py", line 7, in <module>
from . import _inputstream
File "D:\Python\lib\site-packages\pip\_vendor\html5lib\_inputstream.py", line 9, in <module>
from pip._vendor import webencodings
ImportError: cannot import name 'webencodings' from 'pip._vendor' (D:\Python\lib\site-packages\pip\_vendor\__init__.py)
This is due to broken build process just revert the pip version.
Try this:
$ pip install -U "pip<20" setuptools
I am trying out tensorflow on my Mac. I use python 3.7 in a virtual environment.
I installed TensorFlow using pip install tensorflow successfully.
But now when I try to import it import tensorflow, it gives the following error
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/tensorflow/__init__.py", line 98, in <module>
from tensorflow_core import *
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/tensorflow_core/__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 959, in _find_and_load_unlocked
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/tensorflow/__init__.py", line 50, in __getattr__
module = self._load()
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/tensorflow/__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/tensorflow_core/python/__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/tensorflow_core/core/framework/graph_pb2.py", line 7, in <module>
from google.protobuf import descriptor as _descriptor
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/google/protobuf/__init__.py", line 37, in <module>
__import__('pkg_resources').declare_namespace(__name__)
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/pkg_resources/__init__.py", line 84, in <module>
__import__('pkg_resources.extern.packaging.requirements')
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 9, in <module>
from pkg_resources.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
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 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/pkg_resources/extern/__init__.py", line 43, in load_module
__import__(extant)
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 4756, in <module>
_escapedPunc = Word( _bslash, r"\[]-*.$+^?()~ ", exact=2 ).setParseAction(lambda s,l,t:t[0][1])
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1284, in setParseAction
self.parseAction = list(map(_trim_arity, list(fns)))
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1066, in _trim_arity
this_line = extract_stack(limit=2)[-1]
File "/Users/sourabh/virtualenvs/ml/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1050, in extract_stack
frame_summary = traceback.extract_stack(limit=-offset+limit-1)[offset]
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/traceback.py", line 211, in extract_stack
stack = StackSummary.extract(walk_stack(f), limit=limit)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/traceback.py", line 363, in extract
f.line
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/traceback.py", line 285, in line
self._line = linecache.getline(self.filename, self.lineno).strip()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/linecache.py", line 16, in getline
lines = getlines(filename, module_globals)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/linecache.py", line 48, in getlines
for mod in sys.modules.values():
RuntimeError: dictionary changed size during iteration
I've encountered the exact same problem, according https://github.com/tensorflow/tensorflow/issues/33183 this is an os-x catalina issue. However I found you can simply use python 3.7.6 to get rid of the problem, i.e. os-x catalina's python3 is version 3.7.3, with brew you can install python 3.7.6, backwards compatible and solves the problem :)