When i try to create the executable for my program using pyinstaller --onefile gui.py it gives me this error. pyqt5 and all the required packages are installed for the program but when i tried to create the executable it gives me this error what is wrong with the process
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\__init__.py", line 8, in <module>
from . import util as _util
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util\__init__.py", line 103, in <module>
from .concurrency import asyncio
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util\concurrency.py", line 20, in <module>
from ._concurrency_py3k import await_only
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 8, in <module>
import asyncio
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\asyncio\__init__.py", line 21, in <module>
from .base_events import *
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\asyncio\base_events.py", line 296
future = tasks.async(future, loop=self)
^^^^^
SyntaxError: invalid syntax
Traceback (most recent call last):
File "C:\Users\oshada.i\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\oshada.i\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py", line 178, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py", line 59, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 845, in main
build(specfile, distpath, workpath, clean_build)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 767, in build
exec(code, spec_namespace)
File "E:\Imalka\VarCheck\gui.spec", line 7, in <module>
a = Analysis(
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 319, in __init__
self.__postinit__()
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\datastruct.py", line 173, in __postinit__
self.assemble()
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 487, in assemble
self.graph.process_post_graph_hooks(self)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 326, in process_post_graph_hooks
module_hook.post_graph(analysis)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\imphook.py", line 398, in post_graph
self._load_hook_module()
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\imphook.py", line 361, in _load_hook_module
self._hook_module = importlib_load_source(self.hook_module_name, self.hook_filename)
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\compat.py", line 620, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 548, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 1063, in load_module
File "<frozen importlib._bootstrap_external>", line 888, in load_module
File "<frozen importlib._bootstrap>", line 290, in _load_module_shim
File "<frozen importlib._bootstrap>", line 719, in _load
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\oshada.i\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\hooks\hook-sqlalchemy.py", line 31, in <module>
dialects = eval(dialects.strip())
File "<string>", line 0
SyntaxError: invalid syntax
Finally i found a solution to fix the error. it because of the asyncio package remove the package using pip uninstall asyncio and run the pyinstaller it will compile the .exe file
Related
So when I download a package (site-packages), from bitbucket, using this command-line:
pip install --upgrade git+ssh://git#bitbucket.ggf.com:7999/pyt/jira, pip starts to not work.
I tried to debug and find the issue in this output:
Traceback (most recent call last):
File "C:\Programs\Python\lib\importlib\_common.py", line 89, in _tempfile
os.write(fd, reader())
File "C:\Programs\Python\lib\importlib\abc.py", line 371, in read_bytes
with self.open('rb') as strm:
File "C:\Programs\Python\lib\importlib\_adapters.py", line 54, in open
raise ValueError()
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Programs\Python\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Programs\Python\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Programs\Python\Scripts\pip.exe\__main__.py", line 4, in <module>
File "C:\Programs\Python\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Programs\Python\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Programs\Python\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:\Programs\Python\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "C:\Programs\Python\lib\site-packages\pip\_internal\cli\parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "C:\Programs\Python\lib\site-packages\pip\_internal\configuration.py", line 20, in <module>
from pip._internal.exceptions import (
File "C:\Programs\Python\lib\site-packages\pip\_internal\exceptions.py", line 13, in <module>
from pip._vendor.requests.models import Request, Response
File "C:\Programs\Python\lib\site-packages\pip\_vendor\requests\__init__.py", line 135, in <module>
from . import utils
File "C:\Programs\Python\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:\Programs\Python\lib\site-packages\wrapt\importer.py", line 177, in _exec_module
notify_module_loaded(module)
File "C:\Programs\Python\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Programs\Python\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Programs\Python\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:\Programs\Python\lib\site-packages\wrapt\importer.py", line 177, in _exec_module
notify_module_loaded(module)
File "C:\Programs\Python\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Programs\Python\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Programs\Python\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Programs\Python\lib\site-packages\certifi\core.py", line 37, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Programs\Python\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Programs\Python\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\\a77870\\AppData\\Local\\Temp\\3\\tmpjivq2gz5'
I found out that if I removed these two files from site-packages then pip worked again, so for some reason these files make it stuck, but I don't know why?
python-certifi-win32-init.pth
distutils-precedence.pth
Now the problem with doing this is that the package which is installed jira, is an API that needs to connect over SSL, and I guess by deleting these .pth files that this creates some error now?
I get this output running a simple command, and its trying to connect to Jira:
Traceback (most recent call last):
File "C:\Programs\Python\Python3102\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "C:\Programs\Python\Python3102\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "C:\Programs\Python\Python3102\lib\site-packages\urllib3\connectionpool.py", line 1040, in _validate_conn
conn.connect()
File "C:\Programs\Python\Python3102\lib\site-packages\urllib3\connection.py", line 414, in connect
self.sock = ssl_wrap_socket(
File "C:\Programs\Python\Python3102\lib\site-packages\urllib3\util\ssl_.py", line 449, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(
File "C:\Programs\Python\Python3102\lib\site-packages\urllib3\util\ssl_.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Programs\Python\Python3102\lib\ssl.py", line 512, in wrap_socket
return self.sslsocket_class._create(
File "C:\Programs\Python\Python3102\lib\ssl.py", line 1070, in _create
self.do_handshake()
File "C:\Programs\Python\Python3102\lib\ssl.py", line 1341, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)
Any ideas on a way where I should delete these files?
By removing python-certifi-win32-init.pth the functionality of the library is effectively lost with doing so.
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.
I was trying to get Selenium to work, and so followed the suggestion here to brew install geckodriver in the relevant virtual environment (pipenv). After having done that, my other virtual environments stopped working.
I was able to get most of them to work again by re-installing pipenv outside of any virtual environment (using pip3 install pipenv).
But all of my Django projects that rely on Postgres still don't work: I'm able to start their virtual environment (with pipenv shell), but python manage.py runserver gives me the following traceback:
Watching for file changes with StatReloader
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/autoreload.py", line 77, in raise_last_exception
raise _exception[0](_exception[1]).with_traceback(_exception[2])
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/db/models/base.py", line 117, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/db/models/base.py", line 321, in add_to_class
value.contribute_to_class(cls, name)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/db/models/options.py", line 204, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/db/__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/db/utils.py", line 201, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/db/utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "/usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 24, in <module>
raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/psycopg2/_psycopg.cpython-38-darwin.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /usr/local/opt/postgresql/lib/libpq.5.dylib
Reason: image not found
Traceback (most recent call last):
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/apps/registry.py", line 155, in get_app_config
return self.app_configs[app_label]
KeyError: 'admin'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 60, in execute
super().execute(*args, **options)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 95, in handle
self.run(**options)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/autoreload.py", line 579, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/autoreload.py", line 564, in start_django
reloader.run(django_main_thread)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/autoreload.py", line 272, in run
get_resolver().urlconf_module
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/urls/resolvers.py", line 564, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/my_last_name/Django/pred_market_pg_copy/pm_project/urls.py", line 7, in <module>
path('mp/', admin.site.urls),
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/utils/functional.py", line 256, in inner
self._setup()
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/contrib/admin/sites.py", line 529, in _setup
AdminSiteClass = import_string(apps.get_app_config('admin').default_site)
File "/Users/my_last_name/.local/share/virtualenvs/pred_market_pg_copy-ZXHemaJW/lib/python3.8/site-packages/django/apps/registry.py", line 162, in get_app_config
raise LookupError(message)
LookupError: No installed app with label 'admin'.
I have 'django.contrib.admin' among my INSTALLED_APPS. And, again, everything was working just fine prior to my geckodriver adventure.
Re-installing psycopg2 with pipenv install psycopg2 doesn't solve it. I've also tried uninstalling psycopg2, but when I then try to install it again, I get Locking Failed.
Any advice here on what's going on would be appreciated.
I have a Python file which is work properly but
When I triyng to convert py to exe there are a lot of errors like this :
104794 WARNING: Cannot read QLibraryInfo output: raised Expecting value: line 1 column 1 (char 0) when decoding:
PySide2/__init__.py: Unable to import shiboken2 from , C:\Users\Vlad\Desktop\Sysan, C:\Users\Vlad, c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages, c:\users\vlad\appdata\local\programs\python\python37-32\python37.zip, c:\users\vlad\appdata\local\programs\python\python37-32\DLLs, c:\users\vlad\appdata\local\programs\python\python37-32\lib, c:\users\vlad\appdata\local\programs\python\python37-32, C:\Users\Vlad\AppData\Roaming\Python\Python37\site-packages
False
Traceback (most recent call last):
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Vlad\AppData\Local\Programs\Python\Python37-32\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\building\build_main.py", line 844, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\building\build_main.py", line 791, in build
exec(code, spec_namespace)
File "C:\Users\Vlad\Sysan7_2_last.spec", line 17, in <module>
noarchive=False)
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\building\build_main.py", line 243, in __init__
self.__postinit__()
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
self.assemble()
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\building\build_main.py", line 502, in assemble
module_hook.post_graph()
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\building\imphook.py", line 410, in post_graph
self._load_hook_module()
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\building\imphook.py", line 377, in _load_hook_module
self.hook_module_name, self.hook_filename)
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\compat.py", line 793, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 907, in load_module
File "<frozen importlib._bootstrap_external>", line 732, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 696, in _load
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 "c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\hooks\hook-PySide2.py", line 18, in <module>
collect_system_data_files(pyside2_library_info.location['PrefixPath'],
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\utils\hooks\qt.py", line 87, in __getattr__
return getattr(self, name)
File "c:\users\vlad\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\utils\hooks\qt.py", line 89, in __getattr__
raise AttributeError
AttributeError
C:\Users\Vlad>
My code contains a lot of modules such as Networkx, Plotly, Py Qt5, may be problem with it.
So I'm trying to run my development server using the command "python manage.py runserver"
But whenever I try to run it, it gives me this error;
Watching for file changes with StatReloader
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 77, in raise_last_exception
raise _exception[0](_exception[1]).with_traceback(_exception[2])
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 125, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_countries'
Traceback (most recent call last):
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 155, in get_app_config
return self.app_configs[app_label]
KeyError: 'admin'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 95, in handle
self.run(**options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 579, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 564, in start_django
reloader.run(django_main_thread)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 272, in run
get_resolver().urlconf_module
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 564, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 125, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "F:\Users\Kasutaja\Documents\Veebipood v4\django-ecommerce\djecommerce\urls.py",
line 6, in <module>
path('admin/', admin.site.urls),
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 256, in inner
self._setup()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\admin\sites.py", line 529, in _setup
AdminSiteClass = import_string(apps.get_app_config('admin').default_site)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 162, in get_app_config
raise LookupError(message)
LookupError: No installed app with label 'admin'.
I have tried searching for solutions to this problem but nothing seems to be working. There seems to also be a weird issue with django-countries. Whenever I try installing it, it says;
Collecting django-countries
Using cached django-countries-6.0.tar.gz (617 kB)
WARNING: Generating metadata for package django-countries produced metadata for project name unknown. Fix your #egg=django-countries fragments.
Requirement already satisfied (use --upgrade to upgrade): unknown from https://files.pythonhosted.org/packages/6d/7a/4046a82f6f0c7d00ad24b3a4fc30d10c562949bb6cd40ef7f3051ed7e2bc/django-countries-6.0.tar.gz#sha256=cca351f304d18187b6200e1aae381c2902045c33aea5f4da58fd74685b7cd4fc in c:\users\kasutaja\appdata\local\programs\python\python36-32\lib\site-packages
The weird thing with this is, that whenever I try to run "python manage.py makemigrations", it says;
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 357, in execute
django.setup()
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Users\Kasutaja\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 125, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_countries'
Does anyone know how to fix this?
Thanks in advance,
Nimetu.
Ok, figured it out. Just putting this out there just incase anyone has the same issue. If your project has a requirements.txt file (if it doesn't make one) and add (If you want to use django-countries)
django-countries==5.3.3
To it, you can also use the latest version but I chose to use version 5.3.3 in this case. After that run the command
pip install -r requirements.txt
I want to extract data from csv for python practice.
I wrote about 30 lines of code and tried to convert .ipynb-> .py-> .exe in that order.
However, UnicodeDecodeError occurred when compiling to .py-> .exe.
I commented out all the descriptions and investigated the cause,
It turns out that this problem occurs just by importing pandas.
Could you tell me how to solve this problem?
=========================
[Development environment]
・jupyter notebook
・PyInstaller 3.5
・Python 3.7.1
[Steps to reproduce]
Create an empty file with jupyter notebook.
Write only [import pandas as pd] in the first line.
Convert to [Test001.py].
Command line: jupyter nbconvert --to script Test001.ipynb
Compile.
Command line: pyinstaller Test001.py --onefile --noconsole
[Error]
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 130: invalid start byte
[Test001.py]
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import pandas as pd
[Traceback]
Traceback (most recent call last):
File "c:\programdata\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\programdata\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 844, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 791, in build
exec(code, spec_namespace)
File "C:\Users\******\python_workspace\Test001.spec", line 17, in <module>
noarchive=False)
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 243, in __init__
self.__postinit__()
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
self.assemble()
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 502, in assemble
module_hook.post_graph()
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\building\imphook.py", line 410, in post_graph
self._load_hook_module()
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\building\imphook.py", line 377, in _load_hook_module
self.hook_module_name, self.hook_filename)
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\compat.py", line 793, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 907, in load_module
File "<frozen importlib._bootstrap_external>", line 732, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 696, in _load
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 "c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks\hook-zmq.py", line 18, in <module>
hiddenimports = ['zmq.utils.garbage'] + collect_submodules('zmq.backend')
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 624, in collect_submodules
repr(pkg_dir), package))
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 83, in exec_statement
return __exec_python_cmd(cmd)
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 72, in __exec_python_cmd
txt = exec_python(*cmd, env=pp_env)
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\compat.py", line 637, in exec_python
return exec_command(*cmdargs, **kwargs)
File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\compat.py", line 427, in exec_command
out = out.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 130: invalid start byte
=========================
Thanks,
Hisa
I continued to investigate PyInstaller issues for solutions.
There was a report that it was solved by rewriting a part of 'compat.py', so I tried it.
As a result, the executable file was output normally.
(I confirmed that it works properly on another computer)
The link of the site which became reference is as follows.
https://qiita.com/mamon/items/01e5dc5c24cf9e81b689
Thank you for your comments.
Hisa