No module named constants error - html

I have a project in progress. In this project I have to change some reports that they implement by XML code.
When I run my project with "python manage.py runserver"it runs truthfully and I can change my XML code and see the HTML files on chrome but when I want to see the PDF file of reports I get an error that says:
>"IndexError, your list is out of range"
so I start to debug it, in this process debugger said
"from django.db.models.constants import LOOKUP_SEP No module named constants".
this is whole trace back:
>Unhandled exception in thread started by <_pydev_bundle.pydev_monkey._NewThreadStartupWithTrace instance at 0x7f45ea1f3b48>
Traceback (most recent call last):
File "/home/rajabi/pycharm-community-2017.1.4/helpers/pydev/_pydev_bundle/pydev_monkey.py", line 589, in __call__
return self.original_func(*self.args, **self.kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 91, in inner_run
self.validate(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 266, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 30, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 158, in get_app_errors
self._populate()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 67, in _populate
self.load_app(app_name)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 88, in load_app
models = import_module('.models', app_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/rajabi/Desktop/tina/clone-2017-07-05/rtis/src/saed/activities/models.py", line 7, in <module>
from saed.activities.base import models
File "/home/rajabi/Desktop/tina/clone-2017-07-05/rtis/src/saed/activities/base/models.py", line 16, in <module>
from model_utils.managers import InheritanceManager
File "/usr/local/lib/python2.7/dist-packages/model_utils/managers.py", line 13, in <module>
from django.db.models.constants import LOOKUP_SEP
ImportError: No module named constants
what should I do?
django==1.4
python==2.7.12
tastypie == 0.9.16
I can't change my django and python version.

This part of the traceback is showing you that the error is coming from django-model-utils.
File "/usr/local/lib/python2.7/dist-packages/model_utils/managers.py", line 13, in <module>
from django.db.models.constants import LOOKUP_SEP
The release notes say that support for Django 1.4 was dropped in version 3.0.
You could try installing an early version of django-model-utils, but really you should upgrade Django. Django 1.4 is years out of date and insecure.

Related

Facing such problem like no model name edge tpu found and no module name edgeTPU_cpp_wrapper

Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/edgetpu/swig/edgetpu_cpp_wrapper.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_edgetpu_cpp_wrapper', [dirname(file)])
File "/usr/lib/python3.9/imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_edgetpu_cpp_wrapper'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/DeepPiCar/models/object_detection/code/coco_object_detection.py", line 9, in <module>
import edgetpu.detection.engine
File "/usr/local/lib/python3.9/dist-packages/edgetpu/detection/engine.py", line 17, in <module>
from edgetpu.basic.basic_engine import BasicEngine
File "/usr/local/lib/python3.9/dist-packages/edgetpu/basic/basic_engine.py", line 17, in <module>
from edgetpu.swig.edgetpu_cpp_wrapper import BasicEnginePythonWrapper
File "/usr/local/lib/python3.9/dist-packages/edgetpu/swig/edgetpu_cpp_wrapper.py", line 28, in <module>
_edgetpu_cpp_wrapper = swig_import_helper()
File "/usr/local/lib/python3.9/dist-packages/edgetpu/swig/edgetpu_cpp_wrapper.py", line 20, in swig_import_helper
import _edgetpu_cpp_wrapper
ModuleNotFoundError: No module named '_edgetpu_cpp_wrapper'
Tyring to open up object detection program through edgeTPU. ERROR !! NO Module Found.
Edge TPU API is deprecated. Please modify your code/project to work with pycoral API

MkDocs RuntimeError: StopIteration on mkdocs serve

I'm trying to run MkDocs and getting a StopIteration error when running mkdocs serve. This is on a fresh MkDocs project. I've installed MkDocs, ran mkdocs new my-project and then mkdocs serve.
It appears the file_match variable is empty on line 345 of config_options.py but I can't figure out what populates file_match. Is there an additional step between installing MkDocs and then using it that I'm missing?
Thanks for any help. My full stack trace is below.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 345, in walk_docs_dir
raise StopIteration
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/mkdocs", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/mkdocs/__main__.py", line 110, in serve_command
serve.serve(
File "/usr/local/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 78, in serve
config = builder()
File "/usr/local/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 67, in builder
config = load_config(
File "/usr/local/lib/python3.8/site-packages/mkdocs/config/base.py", line 151, in load_config
errors, warnings = cfg.validate()
File "/usr/local/lib/python3.8/site-packages/mkdocs/config/base.py", line 84, in validate
self._post_validate()
File "/usr/local/lib/python3.8/site-packages/mkdocs/config/base.py", line 73, in _post_validate
config_option.post_validation(self, key_name=key)
File "/usr/local/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 370, in post_validation
for filename in self.walk_docs_dir(config['docs_dir']):
RuntimeError: generator raised StopIteration

How to fix 'AttributeError: type object 'pyfmi.fmi.ModelBase' has no attribute '__reduce_cython__''

I am importing pyfmi and get this error message. I am using Spyder (Python 3.6) on windows.
I also downloaded the latest version of Cython 0.29.13
import pyfmi
Traceback (most recent call last):
File "<ipython-input-11-df481fa81f2d>", line 1, in <module>
import pyfmi
File "C:\ProgramData\Anaconda3\lib\site-packages\pyfmi\__init__.py", line 24, in <module>
from .fmi import FMUModel, load_fmu, FMUModelME1, FMUModelME2
File "src\pyfmi\fmi.pyx", line 165, in init pyfmi.fmi
AttributeError: type object 'pyfmi.fmi.ModelBase' has no attribute '__reduce_cython__'

OSError: libcudart.so.9.2: cannot open shared object file: No such file or directory

trying to run a script, when i get
(infacepytorch) ryan#ryan-7570:/media/ryan/shakira/InsightFace_Pytorch$ python face_verify.py
Traceback (most recent call last):
File "face_verify.py", line 9, in <module>
from Learner import face_learner
File "/media/ryan/shakira/InsightFace_Pytorch/Learner.py", line 1, in <module>
from data.data_pipe import de_preprocess, get_train_loader, get_val_data
File "/media/ryan/shakira/InsightFace_Pytorch/data/data_pipe.py", line 12, in <module>
import mxnet as mx
File "/home/ryan/virtualenvs/infacepytorch/lib/python3.5/site-packages/mxnet/__init__.py", line 24, in <module>
from .context import Context, current_context, cpu, gpu, cpu_pinned
File "/home/ryan/virtualenvs/infacepytorch/lib/python3.5/site-packages/mxnet/context.py", line 24, in <module>
from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass
File "/home/ryan/virtualenvs/infacepytorch/lib/python3.5/site-packages/mxnet/base.py", line 213, in <module>
_LIB = _load_lib()
File "/home/ryan/virtualenvs/infacepytorch/lib/python3.5/site-packages/mxnet/base.py", line 204, in _load_lib
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
File "/usr/lib/python3.5/ctypes/__init__.py", line 347, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libcudart.so.9.2: cannot open shared object file: No such file or directory
I have tried
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64 && sudo ldconfig
but i still get the same error,
Any suggestions would be really helpfull, Thanks in advance.
As pointed out by talonmies you're running a version of MXNet that depends on Cuda-9.2. It would be preferable to install Cuda-9.2 and update your library path to point to 9.2.
You can also also install MXNet for 9.0 using the pip package mxnet-cu90 if you were unable to update your Cuda dependencies.

1146 "app_name.django_site missing"

I am using Django 1.11 for making an app 'cnfs', and I am using MYSQL database with it. I am constantly facing this issue where I am getting an error like this when I type the following code:
$python manage.py migrate
System check identified some issues: WARNINGS: ?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default' HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/1.11/ref/databases/#mysql-sql-mode Operations to perform: Apply all migrations: admin, auth, cnfs, contenttypes, sites Running migrations: No migrations to apply. Traceback (most recent call last): File "manage.py", line 22, in execute_from_command_line(sys.argv) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/management/init.py", line 363, in execute_from_command_line utility.execute() File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/management/init.py", line 355, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 227, in handle self.verbosity, self.interactive, connection.alias, apps=post_migrate_apps, plan=plan, File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/management/sql.py", line 53, in emit_post_migrate_signal **kwargs File "/home/ubuntu/.local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 193, in send for receiver in self._live_receivers(sender) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/contrib/sites/management.py", line 20, in create_default_site if not Site.objects.using(using).exists(): File "/home/ubuntu/.local/lib/python2.7/site-packages/django/db/models/query.py", line 670, in exists return self.query.has_results(using=self.db) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 517, in has_results return compiler.has_results() File "/home/ubuntu/.local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 845, in has_results return bool(self.execute_sql(SINGLE)) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 886, in execute_sql raise original_exception django.db.utils.ProgrammingError: (1146, "Table 'cnfs.django_site' doesn't exist")
I have literally spent days on this, I did not face this issue when i was using the default django database engine, sqlite3.
I have tried doing this:
$python manage.py migrate sites
My SITE_ID setting is set to 1.
I tried removing the 'django.contrib.sites' thing from the INSTALLED_APPS setting, but that throws this error:
Internal Server Error: / Traceback (most recent call last): File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/utils/deprecation.py", line 138, in call response = self.process_request(request) File "/home/ubuntu/.local/lib/python2.7/site-packages/subdomains/middleware.py", line 62, in process_request super(SubdomainURLRoutingMiddleware, self).process_request(request) File "/home/ubuntu/.local/lib/python2.7/site-packages/subdomains/middleware.py", line 38, in process_request (self.get_domain_for_request(request), request.get_host())) File "/home/ubuntu/.local/lib/python2.7/site-packages/subdomains/middleware.py", line 31, in get_domain_for_request return get_domain() File "/home/ubuntu/.local/lib/python2.7/site-packages/subdomains/utils.py", line 12, in current_site_domain from django.contrib.sites.models import Site File "/home/ubuntu/.local/lib/python2.7/site-packages/django/contrib/sites/models.py", line 84, in class Site(models.Model): File "/home/ubuntu/.local/lib/python2.7/site-packages/django/db/models/base.py", line 118, in new "INSTALLED_APPS." % (module, name) RuntimeError: Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Any suggestions would be much appreciated.
Thanks.
uncomment the django.contrib.sites from installed apps
then
python manage.py migrate sites
python manage.py migrate
if you have few table in the database, drop the tables and then run this