ModuleNotFoundError: No module named '_sysconfigdata_m_darwin_darwin' - python

I'm working on a Rally reporting tool for my team in Python, and I'm trying to package it using cx-freeze. I'm getting a ModuleNotFound error, and I'm wondering if it's because pygal isn't supported by cx-freeze (really hoping this isn't the case because I'd have to rewrite a lot of things)
celinaperalta$ /Users/celinaperalta/Documents/NYLTesting/rally-exports/build/exe.macosx-10.9-x86_64-3.7/RallyGUI ; exit;
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cx_Freeze/initscripts/__startup__.py", line 40, in run
module.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cx_Freeze/initscripts/Console.py", line 37, in run
exec(code, {'__name__': '__main__'})
File "RallyGUI.py", line 8, in <module>
File "/Users/celinaperalta/Documents/NYLTesting/rally-exports/build/exe.macosx-10.9-x86_64-3.7/RallyReportTool.py", line 7, in <module>
import pygal
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pygal/__init__.py", line 28, in <module>
import pkg_resources
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 959, in <module>
class Environment:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 963, in Environment
self, search_path=None, platform=get_supported_platform(),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 190, in get_supported_platform
plat = get_build_platform()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 395, in get_build_platform
plat = get_platform()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sysconfig.py", line 675, in get_platform
get_config_vars(),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sysconfig.py", line 551, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sysconfig.py", line 422, in _init_posix
_temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
ModuleNotFoundError: No module named '_sysconfigdata_m_darwin_darwin'

cx_freeze does not include all the packages automatically. When you find ModuleNotFoundError, you need to inlcude the module explicitly in your setup like -
build_exe_options = {'packages': ['_sysconfigdata_m_darwin_darwin']}

Related

Pycharm: ModuleNotFoundError: No module named 'distutils.cmd'

I'm trying to use opencv module with python.
I have Python3.10.
I installed the module and with the use of Python interpreter in the command line, writing "import cv2" it works fine.
Now, I want to use opencv inside PyCharm.
I went to "File->Settings->Project->Python Interpreter" and then I tried to add the module "opencv-python" but it returned:
"Error occurred when installing package 'opencv-python'. Details.."
and clicking on Details, this is the command output:
Error: Traceback (most recent call last):
File "/opt/pycharm-community-2022.3.1/plugins/python-ce/helpers/packaging_tool.py", line 73, in run_pip
runpy.run_module(module_name, run_name='__main__', alter_sys=True)
File "/usr/lib/python3.9/runpy.py", line 210, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/user/Progetti/SottoProgettiPython/RiconoscimentoFacciale/venv/lib/python3.9/site-packages/pip/__main__.py", line 29, in <module>
from pip._internal.cli.main import main as _main
File "/home/user/Progetti/SottoProgettiPython/RiconoscimentoFacciale/venv/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/user/Progetti/SottoProgettiPython/RiconoscimentoFacciale/venv/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 "/home/user/Progetti/SottoProgettiPython/RiconoscimentoFacciale/venv/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py", line 9, in <module>
from pip._internal.build_env import get_runnable_pip
File "/home/user/Progetti/SottoProgettiPython/RiconoscimentoFacciale/venv/lib/python3.9/site-packages/pip/_internal/build_env.py", line 20, in <module>
from pip._internal.cli.spinners import open_spinner
File "/home/user/Progetti/SottoProgettiPython/RiconoscimentoFacciale/venv/lib/python3.9/site-packages/pip/_internal/cli/spinners.py", line 9, in <module>
from pip._internal.utils.logging import get_indentation
File "/home/user/Progetti/SottoProgettiPython/RiconoscimentoFacciale/venv/lib/python3.9/site-packages/pip/_internal/utils/logging.py", line 29, in <module>
from pip._internal.utils.misc import ensure_dir
File "/home/user/Progetti/SottoProgettiPython/RiconoscimentoFacciale/venv/lib/python3.9/site-packages/pip/_internal/utils/misc.py", line 42, in <module>
from pip._internal.locations import get_major_minor_version
File "/home/user/Progetti/SottoProgettiPython/RiconoscimentoFacciale/venv/lib/python3.9/site-packages/pip/_internal/locations/__init__.py", line 67, in <module>
from . import _distutils
File "/home/user/Progetti/SottoProgettiPython/RiconoscimentoFacciale/venv/lib/python3.9/site-packages/pip/_internal/locations/_distutils.py", line 20, in <module>
from distutils.cmd import Command as DistutilsCommand
ModuleNotFoundError: No module named 'distutils.cmd'
I didn't found any working solutions for the module distutils.
I tried to install and reinstall the module "python3.10-distutils" but it is already installed.
Someone knows how to solve the problem?
Thanks in advance,
Marco

pipenv virtual environment error with package install

I am new to using pipenv virtual environments. I am using one with a Django project. Recently I tried to start the environment with pipenv shell. I got a message that something like there was no environment available even though I have been using it for several months.
I exited the directory and re-entered. Then ran pipenv shell again. This time the env was activated. However when I try to install a package or run pipenv lock --clear I get the following error:
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
Traceback (most recent call last):
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 764, in <module>
main()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 758, in main
_main(parsed.pre, parsed.clear, parsed.verbose, parsed.system, parsed.write,
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 741, in _main
resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 695, in resolve_packages
from pipenv.core import project
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/core.py", line 33, in <module>
from .project import Project
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/project.py", line 30, in <module>
from .vendor.requirementslib.models.utils import get_default_pyproject_backend
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/__init__.py", line 9, in <module>
from .models.lockfile import Lockfile
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/lockfile.py", line 14, in <module>
from ..utils import is_editable, is_vcs, merge_items
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/utils.py", line 8, in <module>
import pip_shims.shims
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/__init__.py", line 26, in <module>
from . import shims
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/shims.py", line 12, in <module>
from .models import (
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 790, in <module>
Command.add_mixin(SessionCommandMixin)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 704, in add_mixin
mixin = mixin.shim()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 752, in shim
result = self.traverse(top_path)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 744, in traverse
result = shim.shim()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 590, in shim
imported = self._import()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 615, in _import
result = self._import_module(self.calculated_module_path)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 365, in _import_module
imported = importlib.import_module(module)
File "/Users/mainuser/.pyenv/versions/3.9.2/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/cli/req_command.py", line 15, in <module>
from pipenv.patched.notpip._internal.index.package_finder import PackageFinder
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/index/package_finder.py", line 21, in <module>
from pipenv.patched.notpip._internal.index.collector import parse_links
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/index/collector.py", line 12, in <module>
from pipenv.patched.notpip._vendor import html5lib, requests
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_vendor/requests/__init__.py", line 97, in <module>
from pipenv.patched.notpip._vendor.urllib3.contrib import pyopenssl
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/OpenSSL/rand.py", line 213, in <module>
_lib.ERR_load_RAND_strings()
AttributeError: module 'lib' has no attribute 'ERR_load_RAND_strings'
I am not sure how to interpret this but it looks like python3.6 is being used when the shell and project python version is 3.9.
Any ideas about what is causing this and how to fix it?

Error While Creating A Note Book In Jupyter

Hello I am Creating A New Jupyter Note Book For The First Time Following This Documentation
I typed
jupyter notebook
and this is the error that i got
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\utils\timing.py", line 27, in <module>
import resource
ModuleNotFoundError: No module named 'resource'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\josti\AppData\Local\Programs\Python\Python38-32\Scripts\jupyter-notebook.EXE\__main__.py", line 7, in <module>
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\jupyter_core\application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\traitlets\config\application.py", line 663, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 1368, in initialize
self.init_webapp()
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 1156, in init_webapp
self.web_app = NotebookWebApplication(
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 151, in __init__
settings = self.init_settings(
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 263, in init_settings
nbextensions_path=jupyter_app.nbextensions_path,
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 874, in nbextensions_path
from IPython.paths import get_ipython_dir
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\__init__.py", line 49, in <module>
from .terminal.embed import embed
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\terminal\embed.py", line 19, in <module>
from IPython.terminal.ipapp import load_default_config
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\terminal\ipapp.py", line 30, in <module>
from IPython.core.magics import ScriptMagics
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\core\magics\__init__.py", line 21, in <module>
from .execution import ExecutionMagics
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\core\magics\execution.py", line 46, in <module>
from IPython.utils.timing import clock, clock2
File "c:\users\josti\appdata\local\programs\python\python38-32\lib\site-packages\IPython\utils\timing.py", line 64, in <module>
clocku = clocks = clock = time.clock
AttributeError: module 'time' has no attribute 'clock'
I tried to
pip3 install --upgrade pip
Even tho i have the latest version of PIP
install resource
pip install resource
and it did not work
module 'time' has no attribute 'clock'
Are you using Python 3.8? This appears to be an issue with Python 3.8. I would suggest reverting to a older version of Python (3.7 works fine) until the libraries are resolved.
Reference:
AttributeError: module 'time' has no attribute 'clock' in Python 3.8
https://github.com/jupyter/notebook/issues/5272

Docker-Cloud CLI Error on Windows

I'm trying to install the Docker-Cloud CLI with pip, and it installs successfully. However, when I check the version (as suggested by the site), I get the error in the paste below. I'm running Windows 10 and Python 3.6.
Traceback (most recent call last):
File "C:\Users\aglas\AppData\Local\Programs\Python\Python36-32\Scripts\docker-cloud-script.py", line 11, in <module>
load_entry_point('docker-cloud==1.0.7', 'console_scripts', 'docker-cloud')()
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2631, in load_entry_point
return ep.load()
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2291, in load
return self.resolve()
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2297, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\dockercloudcli\cli.py", line 10, in <module>
from dockercloudcli import commands
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\dockercloudcli\commands.py", line 15, in <module>
from dockercloudcli import utils
File "c:\users\aglas\appdata\local\programs\python\python36-32\lib\site-packages\dockercloudcli\utils.py", line 16, in <module>
from exceptions import BadParameter, StreamOutputError
ModuleNotFoundError: No module named 'exceptions'

Python Cmd/Powershell error "Traceback (Most recent call last)"

I was giving a look at the "Learn Python The Hard Way" tutorial and when it told me to try it out by typing Python in Powershell after I installed it just kept giving me this:
PS C:\Users\Zach> python
Traceback (most recent call last):
File "C:\Python27\lib\site.py", line 548, in <module>
main()
File "C:\Python27\lib\site.py", line 530, in main
known_paths = addusersitepackages(known_paths)
File "C:\Python27\lib\site.py", line 266, in addusersitepackages
user_site = getusersitepackages()
File "C:\Python27\lib\site.py", line 241, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "C:\Python27\lib\site.py", line 231, in getuserbase
USER_BASE = get_config_var('userbase')
File "C:\Python27\lib\sysconfig.py", line 516, in get_config_var
return get_config_vars().get(name)
File "C:\Python27\lib\sysconfig.py", line 449, in get_config_vars
import re
File "C:\Python27\lib\re.py", line 105, in <module>
import sre_compile
File "C:\Python27\lib\sre_compile.py", line 14, in <module>
import sre_parse
File "C:\Python27\lib\sre_parse.py", line 17, in <module>
from sre_constants import *
File "C:\Python27\lib\sre_constants.py", line 18, in <module>
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
I also tried running through the command prompt and got the same error. I've installed and uninstalled python about 3 times and have done a few reboots to no avail. I am very new to python and I'm confused on what to do here. I would also appreciate any links to other python tutorials.
In this case, from my understanding, you have no modules called "MAXREPEAT" or you(or the installer) have installed it somewhere wrong. A reinstallation or redirecting the path should get it to work.

Categories

Resources