Pyinstaller gives an error KeyError: 'CALL_FUNCTION' - python-3.x

when i try to compile my code i get this error
i have wheel module and all necessary modules
with the code itself, everything is also in order, I tried to compile other programs and had the same error, I did not find anything about this
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyInstaller\__main__.py", line 107, in run
parser = generate_parser()
^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyInstaller\__main__.py", line 78, in generate_parser
import PyInstaller.building.build_main
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyInstaller\building\build_main.py", line 35, in <module>
from PyInstaller.depend import bindepend
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyInstaller\depend\bindepend.py", line 26, in <module>
from PyInstaller.depend import dylib, utils
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyInstaller\depend\utils.py", line 33, in <module>
from PyInstaller.depend import bytecode
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyInstaller\depend\bytecode.py", line 95, in <module>
_call_function_bytecode = bytecode_regex(rb"""
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyInstaller\depend\bytecode.py", line 60, in bytecode_regex
pattern = re.sub(
^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\re\__init__.py", line 185, in sub
return _compile(pattern, flags).sub(repl, string, count)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyInstaller\depend\bytecode.py", line 62, in <lambda>
lambda m: _instruction_to_regex(m[1].decode()),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyInstaller\depend\bytecode.py", line 40, in _instruction_to_regex
return re.escape(bytes([dis.opmap[x]]))
~~~~~~~~~^^^
KeyError: 'CALL_FUNCTION'

Seeing the same thing here, and it appears to be related to the use of Python 3.11 (which is pre-release). Using 3.10 avoids this issue.

Related

Tests failling after django and python upgrade

I've upgraded Django from 4.0.5 to 4.1.6 and python from 3.9 to 3.11
I've also upgraded dependencies:
pip==23.0
pytest==7.2.1
pytest-django==4.5.2
coverage==7.1.0
pytest-cov==4.0.0
pylint==2.16.2
mock==5.0.1
These are my logs:
django-admin test
Traceback (most recent call last):
File "/usr/local/bin/django-admin", line 8, in <module>
sys.exit(execute_from_command_line())
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.11/site-packages/django/core/management/commands/test.py", line 24, in run_from_argv
super().run_from_argv(argv)
File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 394, in run_from_argv
parser = self.create_parser(argv[0], argv[1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 357, in create_parser
self.add_arguments(parser)
File "/usr/local/lib/python3.11/site-packages/django/core/management/commands/test.py", line 54, in add_arguments
test_runner_class = get_runner(settings, self.test_runner)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/test/utils.py", line 394, in get_runner
test_module = __import__(test_module_name, {}, {}, test_path[-1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django_coverage/coverage_runner.py", line 31, in <module>
from django.db.models import get_app, get_apps
ImportError: cannot import name 'get_app' from 'django.db.models' (/usr/local/lib/python3.11/site-packages/django/db/models/__init__.py)
It works with
from django.apps import apps
Import Error :cannot import name get_model
But I have other issues with this library which is very old and I removed it from my project.
Ex:
django-admin test
Traceback (most recent call last):
File "/usr/local/bin/django-admin", line 8, in <module>
sys.exit(execute_from_command_line())
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.11/site-packages/django/core/management/commands/test.py", line 24, in run_from_argv
super().run_from_argv(argv)
File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 394, in run_from_argv
parser = self.create_parser(argv[0], argv[1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 357, in create_parser
self.add_arguments(parser)
File "/usr/local/lib/python3.11/site-packages/django/core/management/commands/test.py", line 54, in add_arguments
test_runner_class = get_runner(settings, self.test_runner)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/test/utils.py", line 394, in get_runner
test_module = __import__(test_module_name, {}, {}, test_path[-1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django_coverage/coverage_runner.py", line 37, in <module>
from django_coverage.utils.coverage_report import html_report
File "/usr/local/lib/python3.11/site-packages/django_coverage/utils/coverage_report/__init__.py", line 17, in <module>
from html_report import *
ModuleNotFoundError: No module named 'html_report'

Python 3.11. Issue

I've installed fresh version of Python 3.11. on Win 10 x64 and figured I should try Jupyter notebook, but after installing it using pip command (without any kind of error and previously adding python to environment variable path) I've received this error:
`
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Scripts\jupyter-notebook.EXE\__main__.py", line 4, in <module>
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\site-packages\notebook\notebookapp.py", line 59, in <module>
from tornado import httpserver
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\site-packages\tornado\httpserver.py", line 32, in <module>
from tornado.http1connection import HTTP1ServerConnection, HTTP1ConnectionParameters
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\site-packages\tornado\http1connection.py", line 34, in <module>
from tornado import iostream
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\site-packages\tornado\iostream.py", line 40, in <module>
from tornado.netutil import ssl_wrap_socket, _client_ssl_defaults, _server_ssl_defaults
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\site-packages\tornado\netutil.py", line 35, in <module>
_client_ssl_defaults = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 775, in create_default_context
context.load_default_certs(purpose)
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 596, in load_default_certs
self._load_windows_store_certs(storename, purpose)
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 588, in _load_windows_store_certs
self.load_verify_locations(cadata=certs)
ssl.SSLError: [ASN1] nested asn1 error (_ssl.c:4004)
`
searching stack overflow as wheel as gitHub resulted in many dead ends.
I would be very grateful for any kind of assistance.

Python, pyinstaller raised an error as follows

when I ran the application, it raised error as follows.
My python version is 3.8.10 and pyinstaller version is 4.4.
How to deal with it?
Traceback (most recent call last):
File "run.py", line 360, in huaban.run.MainWorkPanel.start_download
File "run.py", line 594, in huaban.run.MainWorkPanel.real_run
File "scrapy\crawler.py", line 280, in __init__
File "scrapy\crawler.py", line 152, in __init__
File "scrapy\crawler.py", line 146, in _get_spider_loader
File "scrapy\spiderloader.py", line 67, in from_settings
File "scrapy\spiderloader.py", line 24, in __init__
File "scrapy\spiderloader.py", line 51, in _load_all_spiders
File "scrapy\utils\misc.py", line 83, in walk_modules
File "C:\soft\VirtualenvFiles\huaban\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py", line 71, in _pyi_pkgutil_iter_modules
assert pkg_path.startswith(SYS_PREFIX)
TypeError: startswith first arg must be str or a tuple of str, not PureWindowsPath
Fixed in PyInstaller 4.5.
See here.

I am trying to run the code of "GrouPy" according to their given instruction, but it is giving me errors. I am using Python 3, Cuda 9 and gcc6

I have executed the following command just like it was asked in provided README. The main code was given for heaconv. The same error I receive when I try to run the individual code of GrouPy as well.
python train_cifar.py --modelfn=experiments/CIFAR10/models/P4WideResNet.py --epoch 300 --save_freq=100 --gpu 0 --opt=MomentumSGD --lr_decay_factor=0.1 --lr_decay_schedule=50-100-150 --batchsize 125 --transformations='' --opt_kwargs="{'lr':0.05}" --datadir=/path/to/cifar10 --resultdir=/path/to/results
After Execution of above, I received the following errors:
{'datadir': '/workspace/hexaconv-master/experiments/CIFAR10/DataCifar', 'resultdir': '/workspace/hexaconv-master/experiments/CIFAR10/DataCifarResults', 'modelfn': '/workspace/hexaconv-master/experiments/CIFAR10/models/P4WideResNet.py', 'trainfn': 'train_all.npz', 'valfn': 'test.npz', 'epochs': 300, 'batchsize': 125, 'opt': 'MomentumSGD', 'opt_kwargs': {'lr': 0.05}, 'net_kwargs': {}, 'weight_decay': 0.001, 'lr_decay_schedule': '50-100-150', 'lr_decay_factor': 0.1, 'transformations': '', 'val_freq': 40, 'save_freq': 100, 'gpu': 0, 'seed': 0, 'hex_sampling': ''}
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/cupy/cuda/compiler.py", line 241, in compile
nvrtc.compileProgram(self.ptr, options)
File "cupy/cuda/nvrtc.pyx", line 98, in cupy.cuda.nvrtc.compileProgram
File "cupy/cuda/nvrtc.pyx", line 108, in cupy.cuda.nvrtc.compileProgram
File "cupy/cuda/nvrtc.pyx", line 53, in cupy.cuda.nvrtc.check_status
cupy.cuda.nvrtc.NVRTCError: NVRTC_ERROR_COMPILATION (6)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "train_cifar.py", line 291, in <module>
val_error, model = train(logme=vargs, **vargs)
File "train_cifar.py", line 154, in train
model, optimizer = get_model_and_optimizer(resultdir, modelfn, opt, opt_kwargs, net_kwargs, gpu)
File "train_cifar.py", line 46, in get_model_and_optimizer
module = imp.load_source(model_name, modelfn)
File "/opt/conda/lib/python3.6/imp.py", line 172, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/workspace/hexaconv-master/experiments/CIFAR10/models/P4WideResNet.py", line 8, in <module>
from groupy.gconv.gconv_chainer.p4_conv import P4ConvZ2, P4ConvP4
File "/workspace/hexaconv-master/groupy/gconv/gconv_chainer/p4_conv.py", line 1, in <module>
from groupy.gconv.gconv_chainer.splitgconv2d import SplitGConv2D
File "/workspace/hexaconv-master/groupy/gconv/gconv_chainer/splitgconv2d.py", line 10, in <module>
from groupy.gconv.gconv_chainer.TransformFilter import TransformGFilter
File "/workspace/hexaconv-master/groupy/gconv/gconv_chainer/TransformFilter.py", line 8, in <module>
from groupy.gconv.gconv_chainer.kernels.integer_indexing_cuda_kernel import grad_index_group_func_kernel
File "/workspace/hexaconv-master/groupy/gconv/gconv_chainer/kernels/integer_indexing_cuda_kernel.py", line 61, in <module>
_index_group_func_kernel32 = compile_with_cache(_index_group_func_str.format('float')).get_function('indexing_kernel')
File "cupy/core/carray.pxi", line 125, in cupy.core.core.compile_with_cache
File "cupy/core/carray.pxi", line 146, in cupy.core.core.compile_with_cache
File "/opt/conda/lib/python3.6/site-packages/cupy/cuda/compiler.py", line 164, in compile_with_cache
ptx = compile_using_nvrtc(source, options, arch)
File "/opt/conda/lib/python3.6/site-packages/cupy/cuda/compiler.py", line 82, in compile_using_nvrtc
ptx = prog.compile(options)
File "/opt/conda/lib/python3.6/site-packages/cupy/cuda/compiler.py", line 245, in compile
raise CompileException(log, self.src, self.name, options)
cupy.cuda.compiler.CompileException: /tmp/tmp_vh4y1f6/kern.cu(14): error: a value of type "const ptrdiff_t *" cannot be used to initialize an entity of type "const int *"
/tmp/tmp_vh4y1f6/kern.cu(15): error: a value of type "const ptrdiff_t *" cannot be used to initialize an entity of type "const int *"
2 errors detected in the compilation of "/tmp/tmp_vh4y1f6/kern.cu".
I think this is related to https://github.com/tscohen/GrouPy/issues/13. See the pull request at the bottom.

pyramid pserve pviews P* re.compile syntax error

I used to launch the command pserve --reload development.ini in my vagrant box to launch a pyramid server locally. The command was working until the last few days.
However, I now have a syntax error preventing me from launching pserve with or without conf file.
(py32)vagrant.vm bin # pserve
Traceback (most recent call last):
File "/var/virtualenv/py32/bin/pserve", line 9, in <module>
load_entry_point('pyramid==1.5.1', 'console_scripts', 'pserve')()
File "/var/virtualenv/py32/lib/python3.2/site-packages/pkg_resources/__init__.py", line 519, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/var/virtualenv/py32/lib/python3.2/site-packages/pkg_resources/__init__.py", line 2630, in load_entry_point
return ep.load()
File "/var/virtualenv/py32/lib/python3.2/site-packages/pkg_resources/__init__.py", line 2310, in load
return self.resolve()
File "/var/virtualenv/py32/lib/python3.2/site-packages/pkg_resources/__init__.py", line 2316, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid/scripts/pserve.py", line 31, in <module>
from pyramid.paster import setup_logging
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid/paster.py", line 10, in <module>
from pyramid.scripting import prepare
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid/scripting.py", line 1, in <module>
from pyramid.config import global_registries
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid/config/__init__.py", line 9, in <module>
from webob.exc import WSGIHTTPException as WebobWSGIHTTPException
File "/var/virtualenv/py32/lib/python3.2/site-packages/webob/__init__.py", line 2, in <module>
from webob.request import *
File "/var/virtualenv/py32/lib/python3.2/site-packages/webob/request.py", line 10, in <module>
import simplejson as json
File "/var/virtualenv/py32/lib/python3.2/site-packages/simplejson/__init__.py", line 113, in <module>
from .encoder import JSONEncoder, JSONEncoderForHTML
File "/var/virtualenv/py32/lib/python3.2/site-packages/simplejson/encoder.py", line 22
ESCAPE = re.compile(u'[\\x00-\\x1f\\\\"\\b\\f\\n\\r\\t\u2028\u2029]')
^
SyntaxError: invalid syntax
I use python 3.2.3 in this virtualenv
pviews and proutes give the same error
Any help appreciated :)
Regards
==========================
Thanks to Steve Piercy I uninstalled simplejson and pserve now works launched alone! Thanks again.
However, when I launch pserve development.ini, I now have another error:
(py32)vagrant.vm app # pserve --reload development.ini
Starting subprocess with file monitor
Traceback (most recent call last):
File "/var/virtualenv/py32/bin/pserve", line 9, in <module>
load_entry_point('pyramid==1.5.1', 'console_scripts', 'pserve')()
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid/scripts/pserve.py", line 51, in main
return command.run()
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid/scripts/pserve.py", line 316, in run
global_conf=vars)
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid/scripts/pserve.py", line 340, in loadapp
return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
File "/var/virtualenv/py32/lib/python3.2/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "/var/virtualenv/py32/lib/python3.2/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
return context.create()
File "/var/virtualenv/py32/lib/python3.2/site-packages/paste/deploy/loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "/var/virtualenv/py32/lib/python3.2/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, **context.local_conf)
File "/var/virtualenv/py32/lib/python3.2/site-packages/paste/deploy/util.py", line 56, in fix_call
val = callable(*args, **kw)
File "/var/www/app/app/__init__.py", line 63, in main
request_factory=RequestFactory,
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid/config/__init__.py", line 301, in __init__
exceptionresponse_view=exceptionresponse_view,
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid/config/__init__.py", line 412, in setup_registry
self.include(inc)
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid/config/__init__.py", line 755, in include
c(configurator)
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid_jinja2/__init__.py", line 468, in includeme
_get_or_build_default_environment(config.registry)
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid_jinja2/__init__.py", line 309, in _get_or_build_default_environment
filters = parse_config(settings.get('jinja2.filters', ''))
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid_jinja2/__init__.py", line 62, in parse_config
result[name.strip()] = maybe_import_string(impl)
File "/var/virtualenv/py32/lib/python3.2/site-packages/pyramid_jinja2/__init__.py", line 44, in maybe_import_string
return import_string(val.strip())
File "/var/virtualenv/py32/lib/python3.2/site-packages/jinja2/utils.py", line 213, in import_string
return getattr(__import__(module, None, None, [obj]), obj)
File "/var/www/app/app/views/filters.py", line 1, in <module>
from babel.dates import format_datetime, get_timezone, format_timedelta, format_date, UTC
File "/usr/lib/python3.2/importlib/_bootstrap.py", line 436, in load_module
return self._load_module(fullname)
File "/usr/lib/python3.2/importlib/_bootstrap.py", line 141, in decorated
return fxn(self, module, *args, **kwargs)
File "/usr/lib/python3.2/importlib/_bootstrap.py", line 342, in _load_module
exec(code_object, module.__dict__)
File "/tmp/pip-build-z2s2e9/babel/babel/__init__.py", line 20, in <module>
File "/var/virtualenv/py32/lib/python3.2/site-packages/babel/core.py", line 394
retval += ' (%s)' % u', '.join(details)
^
SyntaxError: invalid syntax
I tried to uninstall-reinstall babel with no luck.
Thanks for your help!
Did you recently install simplejson? It was and never will be compatible with Python 3.0 - 3.2. See https://github.com/simplejson/simplejson/issues/66#issuecomment-15360824

Resources