UnicodeDecodeError just by importing Pandas - python

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

Related

Pyinstaller Error when try to create exe file

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

I am finding it difficult to create an .exe from python script using pyinstaller. My script executes perfectly but when i run the .exe i get traceback

My Python script executes perfectly in a virtual environment which has python 3.9.2 but when i create an exe using pyinstaller the exe doesn.t work, i get tracebacks of certain modules missing but when i add the missing modules with the help of spec files it then gives a traceback of some other modules missing on and on.
File “modin\config\pubsub.py”, line 118, in get
File “modin\config\envvars.py”, line 32, in _get_raw_from_config
File “os.py”, line 669, in getitem
KeyError: ‘MODIN_ENGINE’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “file.py”, line 1
118, in
File “file.py”, line 8
38, in commonsteps
File “swifter\swifter.py”, line 358, in apply
File “swifter\swifter.py”, line 259, in _modin_apply
File “”, line 961, in _find_and_load
File “”, line 950, in find_and_load_unlocked
File “”, line 655, in load_unlocked
File “PyInstaller\loader\pyimod03_importers.py”, line 476, in exec_module
File "modin\pandas_init.py", line 180, in
File “modin\config\pubsub.py”, line 107, in subscribe
File "modin\pandas_init.py", line 109, in _update_engine
File “modin\config\pubsub.py”, line 120, in get
File “modin\config\envvars.py”, line 75, in _get_default
File “”, line 961, in _find_and_load
File “”, line 950, in _find_and_load_unlocked
File “”, line 655, in load_unlocked
File “PyInstaller\loader\pyimod03_importers.py”, line 476, in exec_module
File "distributed_init.py", line 1, in
File “”, line 961, in _find_and_load
File “”, line 950, in _find_and_load_unlocked
File “”, line 655, in _load_unlocked
File “PyInstaller\loader\pyimod03_importers.py”, line 476, in exec_module
File “distributed\config.py”, line 17, in
FileNotFoundError: [Errno 2] No such file or directory: 'D:\01_xew\02_ret
after getting this traceback i tried to specify the modin engine in the script but then got this traceback
Traceback (most recent call last):
File "swifter\swifter.py", line 340, in apply
File "DTC_dask.py", line 840, in compare
File "pandas\core\ops\common.py", line 65, in new_method
File "pandas\core\ops\__init__.py", line 365, in wrapper
ValueError: Can only compare identically-labeled Series objects
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "DTC_dask.py", line 1127, in <module>
File "DTC_dask.py", line 847, in commonsteps
File "swifter\swifter.py", line 358, in apply
File "swifter\swifter.py", line 259, in _modin_apply
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 "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
File "modin\pandas\__init__.py", line 180, in <module>
File "modin\config\pubsub.py", line 107, in subscribe
File "modin\pandas\__init__.py", line 122, in _update_engine
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 "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
File "distributed\__init__.py", line 1, in <module>
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 "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
File "distributed\config.py", line 17, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\TTC01017\\Documents\\My Received Files\\exe_392_dask\\distributed\\distributed.yaml'
[16400] Failed to execute script 'DTC_dask' due to unhandled exception!
After this when i try to add the missing directory to the exe using spec file it further then gives a traceback of some other module missing
I guess the main issue here is pyinstaller not properly coping the dependent libraries to the exe.... can anyone help with this issue and how to create the pyinstaller with spec file which takes care of all the dependent libraries.
In both cases a FileNotFoundError is thrown, double check that the file path is correct and if that is the case try using / instead of \\
'C:/Users/TTC01017/Documents/My Received Files/exe_392_dask/distributed/distributed.yaml'

How do I get local server running - here with language error message?

I have a Django app (with a postgres database) running in a virtual environment. Everything has been working on my localhost until a few days ago when I got an error saying my SSL certificate had expired (localhost:8000). Today, when I tried the python manage.py runserver command I got an error saying psycopg2 was not installed. I know it was because I have been using this app for the last nine months! Anyway, I reinstalled psycopg2 and tried the runserver command again. This time I got the following error message:
$ python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\threading.py", line 954, in _bootstrap_inner
self.run()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "E:\coding\registrations\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "E:\coding\registrations\lib\site-packages\django\core\management\commands\runserver.py", line 110, in inner_run
autoreload.raise_last_exception()
File "E:\coding\registrations\lib\site-packages\django\utils\autoreload.py", line 76, in raise_last_exception
raise _exception[1]
File "E:\coding\registrations\lib\site-packages\django\core\management\__init__.py", line 357, in execute
autoreload.check_errors(django.setup)()
File "E:\coding\registrations\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "E:\coding\registrations\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "E:\coding\registrations\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "E:\coding\registrations\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\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 "E:\coding\registrations\lib\site-packages\django\contrib\auth\models.py", line 90, in <module>
class Group(models.Model):
File "E:\coding\registrations\lib\site-packages\django\db\models\base.py", line 161, in __new__
new_class.add_to_class(obj_name, obj)
File "E:\coding\registrations\lib\site-packages\django\db\models\base.py", line 326, in add_to_class
value.contribute_to_class(cls, name)
File "E:\coding\registrations\lib\site-packages\django\db\models\fields\related.py", line 1637, in contribute_to_class
self.remote_field.through = create_many_to_many_intermediary_model(self, cls)
File "E:\coding\registrations\lib\site-packages\django\db\models\fields\related.py", line 1099, in create_many_to_many_intermediary_model
'verbose_name': _('%(from)s-%(to)s relationship') % {'from': from_, 'to': to},
File "E:\coding\registrations\lib\site-packages\django\utils\functional.py", line 176, in __mod__
return str(self) % rhs
File "E:\coding\registrations\lib\site-packages\django\utils\functional.py", line 140, in __text_cast
return func(*self.__args, **self.__kw)
File "E:\coding\registrations\lib\site-packages\django\utils\translation\__init__.py", line 94, in gettext
return _trans.gettext(message)
File "E:\coding\registrations\lib\site-packages\django\utils\translation\trans_real.py", line 355, in gettext
_default = _default or translation(settings.LANGUAGE_CODE)
File "E:\coding\registrations\lib\site-packages\django\utils\translation\trans_real.py", line 268, in translation
_translations[language] = DjangoTranslation(language)
File "E:\coding\registrations\lib\site-packages\django\utils\translation\trans_real.py", line 160, in __init__
raise OSError('No translation files found for default language %s.' % settings.LANGUAGE_CODE)
OSError: No translation files found for default language en-gb.
Any ideas on what may be happening here? As I said, everything was working well until a few days ago, then the gremlins got in.

How to fix Pyinstaller Attribute Error? Python Py Qt5

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.

LookupError: No installed app with label "admin"

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

Categories