When I tried to run my python django project in my environment using the command
python -m manage startapp product
it showed me this error
Traceback (most recent call last):
File "C:\Users\ASHU\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\ASHU\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\ASHU\Desktop\Django Project API\project1_django\manage.py", line 22, in <module>
main()
File "C:\Users\ASHU\Desktop\Django Project API\project1_django\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\ASHU\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\ASHU\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 420, in execute
django.setup()
File "C:\Users\ASHU\AppData\Local\Programs\Python\Python310\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\ASHU\AppData\Local\Programs\Python\Python310\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\ASHU\AppData\Local\Programs\Python\Python310\lib\site-packages\django\apps\config.py", line 193, in create
import_module(entry)
File "C:\Users\ASHU\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'rest_framework'
I have already installed my Django rest framework inside my project using
pip3 install djangorestframework
Can anyone help me to reslove this error
Related
when i try to start my Django project i get this error which i am unable to solve:
ModuleNotFoundError: No module named 'database'
The error stack:
Traceback (most recent call last):
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/core/management/base.py", line 414, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/core/management/base.py", line 455, in execute
self.check()
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/core/management/base.py", line 487, in check
all_issues = checks.run_checks(
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/core/checks/caches.py", line 17, in check_default_cache_is_configured
if DEFAULT_CACHE_ALIAS not in settings.CACHES:
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 87, in __getattr__
self._setup(name)
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 74, in _setup
self._wrapped = Settings(settings_module)
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 183, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'database'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/olw/candidatis/database-rest/manage.py", line 22, in <module>
main()
File "/home/olw/candidatis/database-rest/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/core/management/base.py", line 427, in run_from_argv
connections.close_all()
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/db/utils.py", line 212, in close_all
for alias in self:
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/utils/connection.py", line 73, in __iter__
return iter(self.settings)
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/utils/functional.py", line 49, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/utils/connection.py", line 45, in settings
self._settings = self.configure_settings(self._settings)
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/db/utils.py", line 148, in configure_settings
databases = super().configure_settings(databases)
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/utils/connection.py", line 50, in configure_settings
settings = getattr(django_settings, self.settings_name)
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 87, in __getattr__
self._setup(name)
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 74, in _setup
self._wrapped = Settings(settings_module)
File "/home/olw/candidatis/database-rest/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 183, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'database'
I already tried to install the databases package (This is the recommended answer you almost find anywhere)
Trying to make sense out of the stack trace it seems that python itself cannot import this module (So there is no issue in my code or something...).
My installed packages:
The python version i am using is Python 3.10.5
Anybody any idea ?
UPDATE APPS LIST
Here is my installed apps list ->
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.admindocs.urls",
"rest",
"rest_framework",
"custom_db_logger",
]
When running the final command which is sudo waagent –force -deprovision after preparing a Debian VHD for Kali but it keeps finishing with the below messages:
Traceback (most recent call last):
File "/usr/sbin/waagent", line 33, in <module>
sys.exit(load_entry_point('WALinuxAgent==2.2.47', 'console_scripts', 'waagent')())
File "/usr/sbin/waagent", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in load_unlocked
File "<frozen importlib.bootstrap_external>", line 790, in exec_module
File "<frozen importlib.bootstrap>", line 228, in call_with_frames_removed
File "/usr/lib/python3/dist-packages/azurelinuxagent/agent.py", line 34, in <module>
import azurelinuxagent.common.event as event
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/event.py", line 632, in <module>
event_logger = EventLogger()
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/event.py", line 304, in init
osutil = get_osutil()
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/osutil/factory.py", line 50, in get_osutil
return _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name)
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/osutil/factory.py", line 79, in _get_osutil
return DebianOSBaseUtil()
NameError: name 'DebianOSBaseUtil' is not defined`
The deployment fails in Azure and I think this may be apart of that issue. I have reviewed their documentation and seen users having the same issue. Anyone ever faced this issue?
The original document in question that was used is this: https://learn.microsoft.com/en-us/azure/virtual-machines/linux/debian-create-upload-vhd
It looks like there is an error in the factory.py file.
try changing line 25 to add ", DebianOSBaseUtil" to the end of the import statement.
Django can't find my app and it shows me "ModuleNotFoundError" when I try to run server my web
this is my setting.py :
INSTALLED_APPS = [
......
'djmoney',
'transition', --> this is my app
]
and this is the complete error :
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/dist-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/usr/local/lib/python3.8/dist-packages/django/utils/autoreload.py", line 76, in raise_last_exception
raise _exception[1]
File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 357, in execute
autoreload.check_errors(django.setup)()
File "/usr/local/lib/python3.8/dist-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.8/dist-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python3.8/dist-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/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 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'transition'
A possible reason for this error is your project directory structure. If this is indeed the case, you should change it to xxx.transition, where xxx = the name of your project.
I knew, its duplicate question, but I can't find the way to solve my issue.
I tried, tensorflow all versions.
Python 3.6.8
tensorflow = 1.15.0
Windows 10
Faced VC++ error, I installed VC++ 14
I tried via using condo, still facing the tensorflow issue.
I face the issue like, its created the project structure, but tensorflow.python.framework.errors
To get started quickly, an initial project will be created.
If you need some help, check out the documentation at https://rasa.com/docs/rasa.
Created project directory at 'C:\Users\Administrator\AppData\Local\Programs\Python\Python36\Scripts\venv\Scripts'.
Finished creating project structure.
Training an initial model...
Training Core model...
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:\Users\Administrator\AppData\Local\Programs\Python\Python36\Scripts\venv\Scripts\rasa.exe\__main__.py", line 7, in <module>
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\__main__.py", line 92, in main
cmdline_arguments.func(cmdline_arguments)
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\cli\scaffold.py", line 206, in run
init_project(args, path)
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\cli\scaffold.py", line 118, in init_project
print_train_or_instructions(args, path)
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\cli\scaffold.py", line 58, in print_train_or_instructions
args.model = rasa.train(domain, config, training_files, output)
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\train.py", line 50, in train
additional_arguments=additional_arguments,
File "C:\ProgramData\Anaconda3\lib\asyncio\base_events.py", line 583, in run_until_complete
return future.result()
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\train.py", line 101, in train_async
additional_arguments,
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\train.py", line 188, in _train_async_internal
additional_arguments=additional_arguments,
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\train.py", line 223, in _do_training
additional_arguments=additional_arguments,
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\train.py", line 361, in _train_core_with_validated_data
additional_arguments=additional_arguments,
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\core\train.py", line 43, in train
policies = config.load(policy_config)
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\core\config.py", line 28, in load
return PolicyEnsemble.from_dict(config_data)
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\core\policies\ensemble.py", line 308, in from_dict
constr_func = registry.policy_from_module_path(policy_name)
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\core\registry.py", line 21, in policy_from_module_path
module_path, lookup_path="rasa.core.policies.registry"
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\utils\common.py", line 220, in class_from_module_path
m = importlib.import_module(lookup_path)
File "C:\ProgramData\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\core\policies\registry.py", line 5, in <module>
from rasa.core.policies.ted_policy import TEDPolicy
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\rasa\core\policies\ted_policy.py", line 8, in <module>
import tensorflow_addons as tfa
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\tensorflow_addons\__init__.py", line 21, in <module>
from tensorflow_addons import activations
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\tensorflow_addons\activations\__init__.py", line 21, in <module>
from tensorflow_addons.activations.gelu import gelu
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\tensorflow_addons\activations\gelu.py", line 24, in <module>
get_path_to_datafile("custom_ops/activations/_activation_ops.so"))
File "c:\users\administrator\appdata\local\programs\python\python36\scripts\venv\lib\site-packages\tensorflow_core\python\framework\load_library.py", line 61, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Invalid name: Addons>Gelu (Did you use CamelCase?); in OpDef: name: "Addons>Gelu" input_arg { name: "features" type_attr: "T" } output_arg { name: "activations" type_attr: "T" } attr { name: "T" type: "type" allowed_values { list { type: DT_HALF type: DT_FLOAT type: DT_DOUBLE } } } attr { name: "approximate" type: "bool" default_value { b: true } }```
rasa>=1.8 supports tensorflow 2 and tensorflow-text. However, tensorflow-text is not supported on Windows, which it looks like you're developing on. You can still use Rasa, but some pipelines will not be supported. I'd recommend this video tutorial for installing Rasa on Windows: https://www.youtube.com/watch?v=4ewIABo0OkU&t=1s
I’m using Python 3.6.7 64x on windows 10.
Today after my updating (pip) I got this error when I’m trying to install any lib.
Traceback (most recent call last):
File "c:\users\admin\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\admin\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python36\Scripts\pip.exe\__main__.py", line 7, in <module>
File "c:\users\admin\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\cli\main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "c:\users\admin\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\commands\__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "c:\users\admin\appdata\local\programs\python\python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
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 "c:\users\admin\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\commands\install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
ImportError: cannot import name 'with_cleanup'
I tried to repair the installation but it didn’t help.
So please will you tell me what I can do to fix this problem!
With all respect!
I didn't get any answer for my question, and I still don't know how to solve the problem with the 20 update of pip.
but I found a way to make pip work again by using 'easy_install pip==19.3.1' in the cmd. and now i'm using the pip 19.3.1 and it works well.
hope this will help somebody!
with all respect!