I have the following error with my Django project after doing yum upgrade a few days ago
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 "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/home/joincic/GeoRouting/GeoRouting_2/lib64/python3.6/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 "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/db/models/base.py", line 117, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/db/models/base.py", line 321, in add_to_class
value.contribute_to_class(cls, name)
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/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 "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/db/__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/db/utils.py", line 201, in __getitem__
backend = load_backend(db['ENGINE'])
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/db/utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "/home/joincic/GeoRouting/GeoRouting_2/lib64/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 6, in <module>
from .features import DatabaseFeatures
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/gis/db/backends/postgis/features.py", line 1, in <module>
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/gis/db/backends/base/features.py", line 3, in <module>
from django.contrib.gis.db.models import aggregates
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/gis/db/models/__init__.py", line 3, in <module>
import django.contrib.gis.db.models.functions # NOQA
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/gis/db/models/functions.py", line 4, in <module>
from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/gis/db/models/fields.py", line 3, in <module>
from django.contrib.gis import forms, gdal
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/gis/forms/__init__.py", line 3, in <module>
from .fields import ( # NOQA
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/gis/forms/fields.py", line 2, in <module>
from django.contrib.gis.gdal import GDALException
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/gis/gdal/__init__.py", line 28, in <module>
from django.contrib.gis.gdal.datasource import DataSource
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/gis/gdal/datasource.py", line 39, in <module>
from django.contrib.gis.gdal.driver import Driver
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/gis/gdal/driver.py", line 5, in <module>
from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 9, in <module>
from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
File "/home/joincic/GeoRouting/GeoRouting_2/lib/python3.6/site-packages/django/contrib/gis/gdal/libgdal.py", line 47, in <module>
lgdal = CDLL(lib_path)
File "/usr/lib64/python3.6/ctypes/__init__.py", line 343, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/gdal30/lib/libgdal.so.26: undefined symbol: GEOSMakeValid_r
The project worked correctly before the upgrade, and trying to fix the error I installed gdal 3.0.2 but it didn't work
I don't know if you need more information about the project or about the virtual machine if so, you can ask me and I will gladly provide you any info
Any Ideas ?
I had the exact same problem with a customer and researched the cause. So while Iczub's answer is good, I think it worthwhile to explain the cause of the problem.
In my case, the error manifested like this:
test=> SELECT PostGIS_Full_Version();
ERROR: could not load library "/usr/pgsql-10/lib/rtpostgis-2.4.so": /usr/gdal30/lib/libgdal.so.26: undefined symbol: GEOSMakeValid_r
CONTEXT: SQL statement "SELECT public.postgis_gdal_version()"
PL/pgSQL function postgis_full_version() line 33 at SQL statement
The solution is simple:
# yum remove geos37
Explanation of what happened:
This was the consequence of a (minor) upgrade from postgis24_10-2.4.6-3.rhel7.x86_64 to postgis24_10-2.4.8-9.rhel7.x86_64 (repository pgdg10), which installed gdal30-libs-3.0.4 and geos38-3.8.1-1 as dependencies.
The ultimate cause of the problem is that the version of GEOS that was installed previously didn't get deinstalled:
# rpm -qa | grep geos
geos38-3.8.1-1.rhel7.x86_64
geos37-3.7.0-1.rhel7.x86_64
Now both of these packages have a library libgeos_c.so.1, installed in different directories:
/usr/geos38/lib64/libgeos_c.so.1
/usr/geos37/lib64/libgeos_c.so.1
Both packages put their directory in the shared library path by adding a configuration file to /etc/ld.so.conf.d, so we end up with two libraries of the same name on the path.
Unfortunately, the library from GEOS 3.7 happened to be the first one on the search path, so libgdal.so.26 loaded that one by mistake, which leads to the observed error.
Who is at fault?
I think there are two bugs:
The GEOS library libgeos_c has an ABI break between versions 3.7 and 3.8, but failed to change the library major version.
The PGDG RPM packages fail to implement an incompatibility between these two GEOS packages. They should never be installed at the same time.
In my case, yum had several enabled pgdg repositories and the gdal lib was installed from a different pg version as Postgis. After reducing the enabled pgdg repositories to just one (the version of interest) and reinstall ( or better erase & install) the effected packages, I was able to use pg with Postgis again.
How to disable repositories see How to enable or disable repositories in CentOS. Related file was in my case /etc/yum.repos.d/pgdg-redhat-all.repo
The mixed repository situation already exist before the upgrade and Postgis was working without trouble
[test#mytest ~]$ yum list installed | grep -i geos
geos37.x86_64 3.7.2-2.rhel7 #pgdg10
[test#mytest ~]$ yum list installed | grep -i gdal
gdal-libs.x86_64 1.11.4-12.rhel7 #pgdg96
gdal30-libs.x86_64 3.0.1-4.rhel7 #pgdg10
[test#mytest ~]$ yum list installed | grep -i postgis
postgis24_96.x86_64 2.4.8-5.rhel7 #pgdg96
postgis24_96-client.x86_64 2.4.8-5.rhel7 #pgdg96
[test#mytest ~]$ yum repolist enabled | grep -i Postgre
pgdg10/7/x86_64 PostgreSQL 10 for RHEL/CentOS 7 - x86_64 1,306
pgdg11/7/x86_64 PostgreSQL 11 for RHEL/CentOS 7 - x86_64 1,162
pgdg12/7/x86_64 PostgreSQL 12 for RHEL/CentOS 7 - x86_64 596
pgdg96/7/x86_64 PostgreSQL 9.6 for RHEL/CentOS 7 - x86_64 1,354
[test#mytest ~]$ psql
psql (9.6.15)
postgres=# CREATE DATABASE test;
CREATE DATABASE
postgres=# \connect test
You are now connected to database "test" as user "test".
test=# CREATE EXTENSION postgis;
CREATE EXTENSION
test=# \connect postgres
You are now connected to database "postgres" as user "test".
postgres=# DROP DATABASE test;
DROP DATABASE
After yum update the mixed repository situation was extended and postgis makes trouble. (grep search for pgdg to detect all effected packages)
[test#mytest ~]$ yum list installed | grep -i pgdg
CGAL.x86_64 4.7-1.rhel7.1 #pgdg11
SFCGAL.x86_64 1.3.1-2.rhel7 #pgdg12
SFCGAL-libs.x86_64 1.3.1-2.rhel7 #pgdg12
gdal-libs.x86_64 1.11.4-12.rhel7 #pgdg96
gdal30-libs.x86_64 3.0.1-4.rhel7 #pgdg10
geos37.x86_64 3.7.2-2.rhel7 #pgdg10
libgeotiff.x86_64 1.4.0-1.rhel7.1 #pgdg11
libgeotiff15.x86_64 1.5.1-2.rhel7 #pgdg12
ogdi.x86_64 3.2.0-4.rhel7.1 #pgdg11
ogdi41.x86_64 4.1.0-2.rhel7 #pgdg10
pgdg-redhat-repo.noarch 42.0-5 #pgdg10
postgis24_96.x86_64 2.4.8-5.rhel7 #pgdg96
...
proj62.x86_64 6.2.0-1.rhel7 #pgdg10
[test#mytest ~]$ psql
...
test=# CREATE EXTENSION postgis;
ERROR: could not load library "/usr/pgsql-9.6/lib/rtpostgis-2.4.so": /usr/gdal30/lib/libgdal.so.26: undefined symbol: GEOSMakeValid_r
test=#
I tried to reinstall Postgis with only only one pgpdg repository enabled. This was not reinstalling the dependent geos, gdal, proj packages. So I removed all effected packages and install them again.
[test#mytest ~]$ sudo yum erase CGAL geos37 proj62 proj49 ogdi41
[test#mytest ~]$ sudo yum install postgis24_96
[test#mytest ~]$ yum list installed | grep -i pgdg
CGAL.x86_64 4.7-1.rhel7 #pgdg96
SFCGAL.x86_64 1.3.1-1.rhel7 #pgdg96
SFCGAL-libs.x86_64 1.3.1-1.rhel7 #pgdg96
gdal30-libs.x86_64 3.0.4-2.rhel7 #pgdg96
geos38.x86_64 3.8.0-1.rhel7 #pgdg96
...
postgis24_96.x86_64 2.4.8-8.rhel7 #pgdg96
This is a hard system change, ensure to have a backup (e.g. VM snapshot). And also check, if dependent other installations (e.g. python shapely) still works with the changed libraries or requires a reinstall.
Related
I was trying to run the polyglot for my sentimental analysis. After a lot of struggling,, I successfully installed Polyglot and pyicu. However when I ran my program, it gave me this error, and I don't know how to fix it
Traceback (most recent call last):
File "/Users/siyizhou/Documents/2020Fall/COMMresearch/code2/Pos_Neg.py", line 6, in <module>
from polyglot.text import Text
File "/usr/local/lib/python3.9/site-packages/polyglot/text.py", line 9, in <module>
from polyglot.detect import Detector, Language
File "/usr/local/lib/python3.9/site-packages/polyglot/detect/__init__.py", line 1, in <module>
from .base import Detector, Language
File "/usr/local/lib/python3.9/site-packages/polyglot/detect/base.py", line 11, in <module>
from icu import Locale
ImportError: cannot import name 'Locale' from 'icu' (/usr/local/lib/python3.9/site-
packages/icu/__init__.py)
siyizhou#Siyis-MBP code2 % polyglot download sentiment.en
Traceback (most recent call last):
File "/usr/local/bin/polyglot", line 33, in <module>
sys.exit(load_entry_point('polyglot==16.7.4', 'console_scripts', 'polyglot')())
File "/usr/local/bin/polyglot", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/local/Cellar/python#3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/local/Cellar/python#3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/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/local/Cellar/python#3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/polyglot/__main__.py", line 16, in <module> from icu import Locale
ImportError: cannot import name 'Locale' from 'icu' (/usr/local/Cellar/python#3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/icu/__init__.py)
The problem is package dependency. Run the following commands in order:
1- pip3 install pyicu
2- pip3 install pycld2
3- pip3 install morfessor
That should work for your case. Also, for more detailed answers, check this link
If you are on MacOSX with a version around 13 (M1 or other), you may need some extra steps beforehand to update the search paths:
Start by installing pkg-config and icu4c, necessary for pyicu to work:
brew install pkg-config icu4c
Next, get the correct path to icu4c with the following command:
brew info icu4c
You will get an output like this:
==> icu4c: stable 71.1 (bottled) [keg-only] C/C++ and Java libraries for Unicode and globalization https://icu.unicode.org/home /opt/homebrew/Cellar/icu4c/71.1 (262 files, 76.8MB) Poured from bottle on 2023-01-02 at 16:21:11 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/icu4c.rb License: ICU
==> Caveats icu4c is keg-only, which means it was not symlinked into /opt/homebrew, because macOS provides libicucore.dylib (but nothing else).
If you need to have icu4c first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/icu4c/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/icu4c/sbin:$PATH"' >> ~/.zshrc
For compilers to find icu4c you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/icu4c/lib"
export CPPFLAGS="-I/opt/homebrew/opt/icu4c/include"
For pkg-config to find icu4c you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/icu4c/lib/pkgconfig"
==> Analytics install: 375,450 (30 days), 1,501,837 (90 days), 5,475,904 (365 days) install-on-request: 6,461 (30 days), 20,819 (90 days), 87,520 (365 days) build-error: 15 (30 days)
Look at the export sections, in this case, my path to icu4c is: /opt/homebrew/opt/icu4c/
Use this path you got to update the following commands:
export PATH="/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/icu4c/sbin:$PATH"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/opt/homebrew/opt/icu4c/lib/pkgconfig"
export PYICU_INCLUDES=/opt/homebrew/opt/icu4c/include
export PYICU_LFLAGS=-L/opt/homebrew/opt/icu4c/58.2/lib
You are now ready to follow the steps indicated by #Berkay 🤗
pip install pyicu
pip install morfessor
pip install pycld2
I am working on a Flask Application with a Postgres database.
When I run nose tests locally everything works fine, but when I upload the code to GitLab this happens in my pipeline. I am using gitlab-ci. Any suggestions on how to solve this issue are welcome.
$ nosetests --with-coverage --cover-package=app
EEEEE
======================================================================
ERROR: Failure: TypeError (can't apply this __setattr__ to DefaultMeta object)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builds/Mubangizi1/mobile_shop_backend/venv/lib/python3.8/site-packages/nose/failure.py", line 39, in runTest
raise self.exc_val.with_traceback(self.tb)
File "/builds/Mubangizi1/mobile_shop_backend/venv/lib/python3.8/site-packages/nose/loader.py", line 417, in loadTestsFromName
module = self.importer.importFromPath(
File "/builds/Mubangizi1/mobile_shop_backend/venv/lib/python3.8/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/builds/Mubangizi1/mobile_shop_backend/venv/lib/python3.8/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/usr/local/lib/python3.8/imp.py", line 244, in load_module
return load_package(name, filename)
File "/usr/local/lib/python3.8/imp.py", line 216, in load_package
return _load(spec)
File "<frozen importlib._bootstrap>", line 702, in _load
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 "/builds/Mubangizi1/mobile_shop_backend/app/controllers/__init__.py", line 2, in <module>
from .product import (ProductDetailView, ProductView)
File "/builds/Mubangizi1/mobile_shop_backend/app/controllers/product.py", line 6, in <module>
from app.models.product import Product
File "/builds/Mubangizi1/mobile_shop_backend/app/models/__init__.py", line 3, in <module>
db = SQLAlchemy()
File "/builds/Mubangizi1/mobile_shop_backend/venv/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 715, in __init__
self.Model = self.make_declarative_base(model_class, metadata)
File "/builds/Mubangizi1/mobile_shop_backend/venv/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 797, in make_declarative_base
model.query_class = self.Query
File "/builds/Mubangizi1/mobile_shop_backend/venv/lib/python3.8/site-packages/sqlalchemy/ext/declarative/api.py", line 79, in __setattr__
_add_attribute(cls, key, value)
File "/builds/Mubangizi1/mobile_shop_backend/venv/lib/python3.8/site-packages/sqlalchemy/ext/declarative/base.py", line 802, in _add_attribute
type.__setattr__(cls, key, value)
TypeError: can't apply this __setattr__ to DefaultMeta object
======================================================================
ERROR: Failure: TypeError (can't apply this __setattr__ to DefaultMeta object)
----------------------------------------------------------------------
.
.
.
Ran 5 tests in 0.550s
FAILED (errors=5)
ERROR: Job failed: exit code 1
This is my .gitlab-ci.yml file containing the pipeline configurations.
image: python:latest
# # Change pip's cache directory to be inside the project directory since we can
# # only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
- venv/
before_script:
- python -V # Print out python version for debugging
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
stages:
- test
test:
stage: test
services:
- postgres:alpine
variables:
POSTGRES_DB: mobile_shop_test_db
POSTGRES_USER: postgres
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_PASSWORD: password
script:
- export FLASK_APP=server.py
- export FLASK_ENV=testing
- export DATABASE_TEST_URI=postgres://$POSTGRES_USER:$POSTGRES_PASSWORD#$POSTGRES_HOST:$POSTGRES_PORT/mobile_shop_test_db
- export FLASK_APP_SECRET=qY2i691SX2sEuZ7LUjY180RS98mw3qCeUiyV0i0vzmg
- apt-get update -qy
- apt-get install -y python-dev python-pip
- pip install -r requirements.txt
- nosetests --with-coverage --cover-package=app
- codecov
This looks like an issue that was introduced into the python language.
To fix this:
You can revert the version of python you are building with, or if you are using docker, fix the python image temporarily using python:3.8.3-slim or an equivalent image. You can also wait until the fix is out.
You can see the related pull request here:
https://github.com/python/cpython/pull/21473
Introduced here:
https://bugs.python.org/issue39960
Patch bug here:
https://bugs.python.org/issue41295
Another issue in an unrelated package that is the same error:
flask_sqlalchemy: error with `__setattr__` to `DefaultMeta`
Edit: A newer version with the fix is out. Check out any image of python:3.8.5 +
I'm trying implement elastic search in my Django application.
For that i need to install open JDK-7 in my ubuntu 16.04 system.
While installing i'm getting the following error.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libatk-wrapper-java libatk-wrapper-java-jni openjdk-7-jre
Suggested packages:
openjdk-7-demo openjdk-7-source visualvm icedtea-7-jre-jamvm sun-java6-fonts
fonts-ipafont-gothic fonts-ipafont-mincho fonts-indic
The following packages will be REMOVED:
openstack-dashboard-ubuntu-theme
The following NEW packages will be installed:
libatk-wrapper-java libatk-wrapper-java-jni openjdk-7-jdk openjdk-7-jre
openjdk-7-jre-headless
0 upgraded, 5 newly installed, 1 to remove and 28 not upgraded.
2 not fully installed or removed.
Need to get 0 B/55.9 MB of archives.
After this operation, 77.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 515256 files and directories currently installed.)
Removing openstack-dashboard-ubuntu-theme (2:9.1.0-0ubuntu1) ...
Collecting and compressing static assets...
Traceback (most recent call last):
File "manage.py", line 25, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 302, in execute
settings.INSTALLED_APPS
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 55, in __getattr__
self._setup(name)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 99, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/share/openstack-dashboard/openstack_dashboard/settings.py", line 381, in <module>
from openstack_auth import policy
File "/usr/lib/python2.7/dist-packages/openstack_auth/policy.py", line 24, in <module>
from openstack_auth import user as auth_user
File "/usr/lib/python2.7/dist-packages/openstack_auth/user.py", line 18, in <module>
from django.contrib.auth import models
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/base_user.py", line 49, in <module>
class AbstractBaseUser(models.Model):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 94, in __new__
app_config = apps.get_containing_app_config(module)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 239, in get_containing_app_config
self.check_apps_ready()
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 124, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
dpkg: error processing package openstack-dashboard-ubuntu-theme (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
openstack-dashboard-ubuntu-theme
E: Sub-process /usr/bin/dpkg returned an error code (1)
I also tried following commands to fix these issues.But it didn't worked
apt-get remove --auto-remove openstack-dashboard-ubuntu-theme
Thanks in advance
I was able to discern in my case it was an issue to do with apache not restarting due to a missing module namely : wsgi
I installed it :
apt-get install libapache2-mod-wsgi
The activated it :
sudo a2enmod wsgi
sudo /etc/init.d/apache2 reload
or
service apache2 restart
The I was able to uninstall the openstack-dashboard-ubuntu-theme:
dpkg --remove --force-remove-reinstreq openstack-dashboard-ubuntu-theme
Hope it helps.
Since I did a pip install google-api-python-client I have my Gunicorn workers stoping after timeout.
Django==1.5.3
Gunicorn==0.12.2
I'm not really sure if it comes from the pip but I did nothing particular except a database migration which migrated without error.
I use this command for Gunicorn:
gunicorn_django myapp.py --bind 127.0.0.1:8181 --timeout 120 --log-file /tmp/myapp.gunicorn.log --log-level info --workers 8 --pid /tmp/myapp.pid
I tryed the param --spew to have some trace but it doesn't help me:
[2016-06-13 21:09:52 +0000] [15602] [INFO] Worker exiting (pid: 15602)
[2016-06-13 21:09:52 +0000] [15601] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/gunicorn/arbiter.py", line 557, in spawn_worker
worker.init_process()
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/gunicorn/workers/base.py", line 136, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/gunicorn/app/djangoapp.py", line 106, in load
return mod.make_wsgi_application()
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/gunicorn/app/django_wsgi.py", line 37, in make_wsgi_application
if get_validation_errors(s):
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/django/db/models/loading.py", line 166, in get_app_errors
self._populate()
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/django/db/models/loading.py", line 72, in _populate
self.load_app(app_name, True)
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/django/db/models/loading.py", line 96, in load_app
models = import_module('.models', app_name)
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/myapp/prod/apps/admin/models.py", line 5, in <module>
from django.contrib.auth.models import User
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/django/contrib/auth/models.py", line 18, in <module>
from django.contrib.auth.hashers import (
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/django/contrib/auth/hashers.py", line 8, in <module>
from django.test.signals import setting_changed
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/django/test/__init__.py", line 6, in <module>
from django.test.testcases import (TestCase, TransactionTestCase,
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/django/test/testcases.py", line 35, in <module>
from django.test import _doctest as doctest
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/django/test/_doctest.py", line 104, in <module>
import unittest, difflib, pdb, tempfile
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/pdbpp-0.7.2-py2.7.egg/pdb.py", line 38, in <module>
pdb = import_from_stdlib('pdb')
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/pdbpp-0.7.2-py2.7.egg/pdb.py", line 35, in import_from_stdlib
mydict = execfile(pyfile, result.__dict__)
File "/usr/local/lib/python2.7/pdb.py", line 3, in <module>
"""A Python debugger."""
File "/usr/local/lib/python2.7/pdb.py", line 3, in <module>
"""A Python debugger."""
File "/home/myapp/.local/share/virtualenvs/myapp/lib/python2.7/site-packages/gunicorn/debug.py", line 40, in __call__
line = src[lineno]
IndexError: tuple index out of range
[2016-06-13 21:09:52 +0000] [15601] [INFO] Worker exiting (pid: 15601)
As the problem came in the same time I installed google api client, I suspect pip to have upgraded some libs that are not compatible with my gunicorn or Django. I checked the pip log without success also.
If I run my Django app with runserver I can't see any bug, it seems very related to Gunicorn.
Is there a deeper way to debug Gunicorn ?
After struggling hours I finally found a clue in the pip log (HOME/.pip/pip.log) .
Installing google api client upgraded some of my previous libs like these:
Installing collected packages: pyopenssl, six, cryptography, idna, pyasn1, setuptools, enum34, ipaddress, cffi, pycparser
Found existing installation: pyOpenSSL 0.14
Uninstalling pyOpenSSL:
...
Found existing installation: six 1.9.0
Uninstalling six:
...
Found existing installation: cryptography 0.7.1
Uninstalling cryptography:
I noticed also some installing warning for cyptography. I decided to put back the old libs.
pyOpenSSL 0.14
six 1.9.0
cryptography 0.7.1
And it solved the problem. I don't know if it is pyopenssl or cryptography but it is getting really boring to have all these libs problems.
Hope this will help someone next time.
I tried to install django-chronograph to django-1.7 for assigning scheduled task in my django web-app.
I followed the instruction as shown here but it gives me the following error when running python manage.py makemigrations or python manage.py syncdb:
user#(none):~/mysite$ python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/apps.py", line 22, in ready
self.module.autodiscover()
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/__init__.py", line 23, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/usr/local/lib/python2.7/dist-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/chronograph/admin.py", line 2, in <module>
from django.conf.urls.defaults import patterns, url
ImportError: No module named defaults
Is it django-chronograph not supported by django-1.7?
I've never heard of this package, but if you search for that error you will find that that import path hasn't worked since Django 1.6.
It could be that it's just the PyPI version that's old, and that the master branch works fine. However, the last commit to this package was in March 2013, and there's an open issue on the project's bitbucket page indicating that it fails to work on 1.6, so I doubt it.
In sum, it appears that this package supports neither Django 1.6 nor 1.7.
They already committed a fix, so to get rid of this error, don't go through:
pip install django-chronograph
I've just installed on Django 1.8 without issues (so far..) using:
pip install -e hg+https://bitbucket.org/wnielson/django-chronograph#f561106f6aaab62f2817e08e51c799320fd916d9#egg=django-chronograph