Are there any conflicts betweenusing Pyenv and installing the VOLTTRON Reference Application? - volttron

I'm having a hell of a time installing the Volttron Reference Application, and can't figure out what I'm doing wrong.
I've been using Pyenv to manage running multiple versions of Volttron at once -- I've been able to install the versions that use both Python 2.7.x (the current 'master' branch) and the version using Python 3.6.x (the 'volttron-7-preview' branch), but I'm having a hell of a time getting the Reference Application up and running.
Specifically, I can't get Celery to play nicely with the OpenADR VTN server (installation instructions) mentioned in the jupyter notebook. I've followed the instructions to the letter (with the exception of the rabbit-mq step, since that gets installed as part of Volttron and would then be installed twice in different ways), and I've been making sure to link directly to specific versions of Python (3.6.9) to avoid any weirdness with pyenv, but when I run this command
celery -A openadr worker -B
I get this error:
[2019-11-05 16:23:02,570: ERROR/Beat] Process Beat
Traceback (most recent call last):
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/utils/objects.py", line 42, in __get__
return obj.__dict__[self.__name__]
KeyError: 'producer'
and the thing dies after a few additional errors get thrown while trying to handle the above exception (at bottom, since it's a bit long).
Anybody have any suggestions on what I might be doing wrong?
(Separately: I hear there's a Slack channel, but the sign-up link (https://volttron-community.signup.team/) seems to be broken. Any links there, either?)
My setup:
Using current master of Volttron (which uses Python 2.7) and current master of Volttron-applications (link) on Ubuntu 18.04 inside a VirtualBox; Python versions managed with pyenv.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/billiard/process.py", line 327, in _bootstrap
self.run()
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/celery/beat.py", line 634, in run
self.service.start(embedded_process=True)
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/celery/beat.py", line 558, in start
interval = self.scheduler.tick()
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/celery/beat.py", line 279, in tick
self.apply_entry(entry, producer=self.producer)
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/utils/objects.py", line 44, in __get__
value = obj.__dict__[self.__name__] = self.__get(obj)
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/celery/beat.py", line 411, in producer
return self.Producer(self._ensure_connected(), auto_declare=False)
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/celery/beat.py", line 395, in _ensure_connected
_error_handler, self.app.conf.broker_connection_max_retries
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/connection.py", line 405, in ensure_connection
callback)
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/utils/functional.py", line 333, in retry_over_time
return fun(*args, **kwargs)
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/connection.py", line 261, in connect
return self.connection
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/connection.py", line 802, in connection
self._connection = self._establish_connection()
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/connection.py", line 757, in _establish_connection
conn = self.transport.establish_connection()
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/transport/pyamqp.py", line 130, in establish_connection
conn.connect()
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/connection.py", line 288, in connect
self.drain_events(timeout=self.connect_timeout)
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/connection.py", line 471, in drain_events
while not self.blocking_read(timeout):
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/connection.py", line 477, in blocking_read
return self.on_inbound_frame(frame)
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/method_framing.py", line 55, in on_frame
callback(channel, method_sig, buf, None)
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/connection.py", line 481, in on_inbound_method
method_sig, payload, content,
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/abstract_channel.py", line 128, in dispatch_method
listener(*args)
File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/connection.py", line 368, in _on_start
b", ".join(self.mechanisms).decode()))
amqp.exceptions.ConnectionError: Couldn't find appropriate auth mechanism (can offer: AMQPLAIN, PLAIN; available: )
[2019-11-11 13:41:24,210: WARNING/Beat] Process Beat:
[2019-11-11 13:41:24,211: WARNING/Beat] Traceback (most recent call last):
[2019-11-11 13:41:24,211: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/utils/objects.py", line 42, in __get__
return obj.__dict__[self.__name__]
[2019-11-11 13:41:24,211: WARNING/Beat] KeyError: 'producer'
[2019-11-11 13:41:24,212: WARNING/Beat] During handling of the above exception, another exception occurred:
[2019-11-11 13:41:24,212: WARNING/Beat] Traceback (most recent call last):
[2019-11-11 13:41:24,212: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/billiard/process.py", line 327, in _bootstrap
self.run()
[2019-11-11 13:41:24,212: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/celery/beat.py", line 634, in run
self.service.start(embedded_process=True)
[2019-11-11 13:41:24,212: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/celery/beat.py", line 558, in start
interval = self.scheduler.tick()
[2019-11-11 13:41:24,212: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/celery/beat.py", line 279, in tick
self.apply_entry(entry, producer=self.producer)
[2019-11-11 13:41:24,213: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/utils/objects.py", line 44, in __get__
value = obj.__dict__[self.__name__] = self.__get(obj)
[2019-11-11 13:41:24,213: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/celery/beat.py", line 411, in producer
return self.Producer(self._ensure_connected(), auto_declare=False)
[2019-11-11 13:41:24,213: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/celery/beat.py", line 395, in _ensure_connected
_error_handler, self.app.conf.broker_connection_max_retries
[2019-11-11 13:41:24,213: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/connection.py", line 405, in ensure_connection
callback)
[2019-11-11 13:41:24,213: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/utils/functional.py", line 333, in retry_over_time
return fun(*args, **kwargs)
[2019-11-11 13:41:24,213: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/connection.py", line 261, in connect
return self.connection
[2019-11-11 13:41:24,214: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/connection.py", line 802, in connection
self._connection = self._establish_connection()
[2019-11-11 13:41:24,214: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/connection.py", line 757, in _establish_connection
conn = self.transport.establish_connection()
[2019-11-11 13:41:24,214: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/kombu/transport/pyamqp.py", line 130, in establish_connection
conn.connect()
[2019-11-11 13:41:24,214: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/connection.py", line 288, in connect
self.drain_events(timeout=self.connect_timeout)
[2019-11-11 13:41:24,214: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/connection.py", line 471, in drain_events
while not self.blocking_read(timeout):
[2019-11-11 13:41:24,214: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/connection.py", line 477, in blocking_read
return self.on_inbound_frame(frame)
[2019-11-11 13:41:24,214: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/method_framing.py", line 55, in on_frame
callback(channel, method_sig, buf, None)
[2019-11-11 13:41:24,215: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/connection.py", line 481, in on_inbound_method
method_sig, payload, content,
[2019-11-11 13:41:24,215: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/abstract_channel.py", line 128, in dispatch_method
listener(*args)
[2019-11-11 13:41:24,215: WARNING/Beat] File "~/.virtualenvs/openadr/lib/python3.6/site-packages/amqp/connection.py", line 368, in _on_start
b", ".join(self.mechanisms).decode()))
[2019-11-11 13:41:24,215: WARNING/Beat] amqp.exceptions.ConnectionError: Couldn't find appropriate auth mechanism (can offer: AMQPLAIN, PLAIN; available: )
[2019-11-11 13:41:24,419: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**#localhost:5672//: Couldn't find appropriate auth mechanism (can offer: AMQPLAIN, PLAIN; available: ).
Trying to reconnect...

I was eventually able to address it, in case anybody else runs into the same problem. It looks like pyenv doesn't interfere, and the problem was with RabbitMQ. Specifically, I had installed RabbitMQ as part of the Volttron installation; but that means you have to get clever about separating ports and/or permissions if you want to also use RabbitMQ for the OpenADR VTN Server (turns out celery was failing on connecting to the RabbitMQ server, which is apparent but not super clear from the above error messages). I re-installed Volttron using the ZeroMQ option, which effectively separates the two, and the installation continued.

Related

I created a virtual environmnt for my new projec, instaled django and started the new project. whnvr I run code with manage.py i get this long error

`when i run line of code: python manage.py startapp blog error below displays
Traceback (most recent call last):
File "C:\Users\lenevo\Desktop\portfolio-project\manage.py", line 22, in <module>
main()
File "C:\Users\lenevo\Desktop\portfolio-project\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\core\management_init_.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\core\management_init_.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\core\management\base.py", line 336, in run_from_argv
connections.close_all()
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\djayour textngo\db\utils.py", line 224, in close_all
connection.close()
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\db\backends\sqlite3\base.py", line 248, in close
if not self.is_in_memory_db():
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\db\backends\sqlite3\base.py", line 367, in is_in_memory_db
return self.creation.is_in_memory_db(self.settings_dict['NAME'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\db\backends\sqlite3\creation.py", line 12, in is_in_memory_db
return database name == ':memory:' or 'mode=memory' in database name
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type Error: argument of type 'Windows Path' is not Iterable
plz help me solve this problem `

Chromedriver not found in path but I can open in the terminal and ChromeDriverManager gives me and error

I'm new to coding but have been using selenium for chrome in python fine for a few weeks, I don't know what I changed but I am now getting an error message.
I simplified it as much as I can to see what I'm doing wrong, but I can't work it out.
from selenium import webdriver
driver = webdriver.Chrome(r"C:\Users\smim1\PycharmProjects\test\chromedriver.exe")
Error:
Traceback (most recent call last):
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Users\smim1\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 832, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\Users\smim1\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1294, in _get_handles
c2pwrite = msvcrt.get_osfhandle(self._get_devnull())
File "C:\Users\smim1\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1077, in _get_devnull
self._devnull = os.open(os.devnull, os.O_RDWR)
FileNotFoundError: [Errno 2] No such file or directory: 'nul'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\smim1\PycharmProjects\test\test5.py", line 43, in <module>
driver = webdriver.Chrome(service = s)
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, in __init__
super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 90, in __init__
self.service.start()
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home
But when I open that file location in the terminal it starts successfully:
PS C:\Users\smim1\PycharmProjects\test> C:\Users\smim1\PycharmProjects\test\chro
medriver.exe
Starting ChromeDriver 101.0.4951.41 (93c720db8323b3ec10d056025ab95c23a31997c9-re
fs/branch-heads/4951#{#904}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggest
ions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
My chrome is the same build:
Chrome is up to date
Version 101.0.4951.54 (Official Build) (64-bit)
I have also tried to move it to the project folder and remove the path but it comes up with the same error
I have tried the webdriver-manager 3.5.4 but get an error:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
Error:
====== WebDriver manager ======
Traceback (most recent call last):
File "C:\Users\smim1\PycharmProjects\test\test5.py", line 51, in <module>
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\chrome.py", line 32, in install
driver_path = self._get_driver_path(self.driver)
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\manager.py", line 19, in _get_driver_path
binary_path = self.driver_cache.find_driver(driver)
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\driver_cache.py", line 74, in find_driver
driver_version = driver.get_version()
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\driver.py", line 39, in get_version
self.get_latest_release_version()
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\driver.py", line 65, in get_latest_release_version
self.browser_version = get_browser_version_from_os(self.chrome_type)
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\utils.py", line 144, in get_browser_version_from_os
OSType.WIN: windows_browser_apps_to_cmd(
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\utils.py", line 125, in windows_browser_apps_to_cmd
powershell = determine_powershell()
File "C:\Users\smim1\PycharmProjects\test\venv\lib\site-packages\webdriver_manager\utils.py", line 245, in determine_powershell
with subprocess.Popen(
File "C:\Users\smim1\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 832, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\Users\smim1\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1276, in _get_handles
p2cread = msvcrt.get_osfhandle(self._get_devnull())
File "C:\Users\smim1\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1077, in _get_devnull
self._devnull = os.open(os.devnull, os.O_RDWR)
FileNotFoundError: [Errno 2] No such file or directory: 'nul'
I'm sure there is something simple that I am doing wrong but I have tried everything I can find online

Sqlalchemy trusted connection not working

Using sqlalchemy in python3, I am attempting to connect to a MS Sql Server 2016 database. Here is the command:
engine = sql.create_engine('mssql+pyodbc://#localhost/dbname?trusted_connection=yes&driver=ODBC+Driver+17+for+SQL+Server')
Attempting any transaction after this, such as:
engine.execute(text('DELETE FROM tablename').execution_options(autocommit = True))
produces the following error:
Traceback (most recent call last):
File "C:\python-ratings\lib\site-packages\sqlalchemy\engine\base.py", line 2339, in _wrap_pool_connect
return fn()
File "C:\python-ratings\lib\site-packages\sqlalchemy\pool\base.py", line 364, in connect
return _ConnectionFairy._checkout(self)
File "C:\python-ratings\lib\site-packages\sqlalchemy\pool\base.py", line 778, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "C:\python-ratings\lib\site-packages\sqlalchemy\pool\base.py", line 495, in checkout
rec = pool._do_get()
File "C:\python-ratings\lib\site-packages\sqlalchemy\pool\impl.py", line 140, in _do_get
self._dec_overflow()
File "C:\python-ratings\lib\site-packages\sqlalchemy\util\langhelpers.py", line 68, in __exit__
compat.raise_(
File "C:\python-ratings\lib\site-packages\sqlalchemy\util\compat.py", line 178, in raise_
raise exception
File "C:\python-ratings\lib\site-packages\sqlalchemy\pool\impl.py", line 137, in _do_get
return self._create_connection()
File "C:\python-ratings\lib\site-packages\sqlalchemy\pool\base.py", line 309, in _create_connection
return _ConnectionRecord(self)
File "C:\python-ratings\lib\site-packages\sqlalchemy\pool\base.py", line 440, in __init__
self.__connect(first_connect_check=True)
File "C:\python-ratings\lib\site-packages\sqlalchemy\pool\base.py", line 661, in __connect
pool.logger.debug("Error on connect(): %s", e)
File "C:\python-ratings\lib\site-packages\sqlalchemy\util\langhelpers.py", line 68, in __exit__
compat.raise_(
File "C:\python-ratings\lib\site-packages\sqlalchemy\util\compat.py", line 178, in raise_
raise exception
File "C:\python-ratings\lib\site-packages\sqlalchemy\pool\base.py", line 656, in __connect
connection = pool._invoke_creator(self)
File "C:\python-ratings\lib\site-packages\sqlalchemy\engine\strategies.py", line 114, in connect
return dialect.connect(*cargs, **cparams)
File "C:\python-ratings\lib\site-packages\sqlalchemy\engine\default.py", line 493, in connect
return self.dbapi.connect(*cargs, **cparams)
pyodbc.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default dri
ver specified (0) (SQLDriverConnect)')
Any clues as to what I am doing wrong? The user I am logged in as can connect to the db with Windows Authentication.
Sorry, I was trying to use an ms odbc driver version that wasn't installed on the machine. All good now.

KiwiTCMS - MySQL DB with mysql_native_password encryption method

Setup
kiwi - latest
mysql -latest (v8.0.21)
os - mac
I have change the docker-compose.yml as below, and it can start-up the two containers.
services:
db:
container_name: kiwi_db
image: mysql:latest
volumes:
- db_data:/var/lib/kiwi_mysql/data
# workaround for missing charset & collation support
# https://github.com/sclorg/mariadb-container/pull/125
- ./99-charset.sh:/usr/share/container-scripts/mysql/init/99-charset.sh:Z
- ./99-charset.cnf:/usr/share/container-scripts/mysql/cnf/99-charset.cnf:Z
restart: always
environment:
MYSQL_ROOT_PASSWORD: kiwi-1s-aw3s0m3
MYSQL_DATABASE: kiwi
MYSQL_USER: kiwi
MYSQL_PASSWORD: kiwi
MYSQL_CHARSET: utf8mb4
MYSQL_COLLATION: utf8mb4_unicode_ci
web:
container_name: kiwi_web
depends_on:
- db
restart: always
image: kiwitcms/kiwi:latest
ports:
- 9001:8080
- 9443:8443
volumes:
- uploads:/Kiwi/uploads:Z
environment:
KIWI_DB_HOST: db
KIWI_DB_PORT: 3306
KIWI_DB_NAME: kiwi
KIWI_DB_USER: kiwi
KIWI_DB_PASSWORD: kiwi
KIWI_DONT_ENFORCE_HTTPS: "true"
links:
- db
volumes:
db_data:
uploads:
When I execute docker exec -it kiwi_web /Kiwi/manage.py migrate, it will get some error message.
I am trying to change the encryption method of user password from caching_ sha2_ Password to mysql_native_password, but it still pop up the same error message.
Traceback of the error:
Traceback (most recent call last):
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 197, in connect
self.connection = self.get_new_connection(conn_params)
File "/venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 233, in get_new_connection
return Database.connect(**conn_params)
File "/venv/lib/python3.6/site-packages/MySQLdb/__init__.py", line 130, in Connect
return Connection(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/MySQLdb/connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (2059, 'Plugin caching_sha2_password could not be loaded: lib64/mariadb/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Kiwi/manage.py", line 12, in <module>
execute_from_command_line(sys.argv)
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 366, in execute
self.check()
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 395, in check
include_deployment_checks=include_deployment_checks,
File "/venv/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 63, in _run_checks
issues = run_checks(tags=[Tags.database])
File "/venv/lib/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/venv/lib/python3.6/site-packages/django/core/checks/database.py", line 10, in check_database_backends
issues.extend(conn.validation.check(**kwargs))
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/validation.py", line 9, in check
issues.extend(self._check_sql_mode(**kwargs))
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/validation.py", line 13, in _check_sql_mode
with self.connection.cursor() as cursor:
File "/venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 260, in cursor
return self._cursor()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 236, in _cursor
self.ensure_connection()
File "/venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 197, in connect
self.connection = self.get_new_connection(conn_params)
File "/venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 233, in get_new_connection
return Database.connect(**conn_params)
File "/venv/lib/python3.6/site-packages/MySQLdb/__init__.py", line 130, in Connect
return Connection(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/MySQLdb/connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2059, 'Plugin caching_sha2_password could not be loaded: lib64/mariadb/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory')
You are trying to use the official MySQL docker images with a docker-compose.yml configuration for the CentOS MariaDB image which Kiwi TCMS uses by default.
A quick look at MySQL's container image at https://hub.docker.com/_/mysql tells me it doesn't support some of the environment variables used in the MariaDB image.
The error which I see is caused by trying to use the mariadb client library (to make the connection) which seems incompatible with MySQL. And I think there are quite a few incompatibilities between MariaDB and MySQL latest versions these days.
So you need to do 2 things:
Figure out how to properly configure the MySQL container via environment variables as per their documentation
Figure out if the MariaDB client libraries will work with a MySQL server (or not).
Also see https://docs.djangoproject.com/en/3.0/ref/databases/#mariadb-notes for references.
For 2) you can open an issue on GitHub so we don't forget to add it to our test suite. IDK at the top of my head what is the state of mysql/mariadb libraries lately and if they can be installed and used side-by-side or if they will conflict with each other.

Installation step fails: docker exec -it kiwi_web /Kiwi/manage.py migrate: unable to connect to DB

Kiwi version: 7.2
I am running a CentOS 8 VirtualBox on a Windows 10 host.
The basic problem seems to be that kiwi_web cannot connect to kiwi_db.
When I run the command:
docker exec -it kiwi_web /Kiwi/manage.py migrate
I get the error (full response at the end):
MySQLdb._exceptions.OperationalError: (2002, "Can't connect to MySQL server on 'db' (115)")
I also get this error if I log into kiwi_web and run "/Kiwi/manage.py migrate".
I get the same error when I run the createsuperuser command:
docker exec -it kiwi_web /Kiwi/manage.py createsuperuser
After adding mysql command line to kiwi_web, when I run:
mysql -h kiwi_db -u kiwi -p
I get the error:
ERROR 2003 (HY000): Can't connect to MySQL server on 'kiwi_db' (113)
Same error if I use different hostnames such as kiwi_db or the IP address.
I don't think I deviated from the instructions at https://kiwitcms.readthedocs.io/en/latest/installing_docker.html during the installation, except that I tried to open the Kiwi page and got the 500 internal server error before running the migrate command.
Any ideas on how to get past this?
Thanks,
..Ron
Data:
The full response when I run the command is:
# docker exec -it kiwi_web /Kiwi/manage.py migrate
Traceback (most recent call last):
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 195, in connect
self.connection = self.get_new_connection(conn_params)
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 227, in get_new_connection
return Database.connect(**conn_params)
File "/venv/lib/python3.6/site-packages/MySQLdb/__init__.py", line 84, in Connect
return Connection(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/MySQLdb/connections.py", line 179, in __init__
super(Connection, self).__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (2002, "Can't connect to MySQL server on 'db' (115)")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Kiwi/manage.py", line 12, in <module>
execute_from_command_line(sys.argv)
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 361, in execute
self.check()
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "/venv/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 64, in _run_checks
issues = run_checks(tags=[Tags.database])
File "/venv/lib/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/venv/lib/python3.6/site-packages/django/core/checks/database.py", line 10, in check_database_backends
issues.extend(conn.validation.check(**kwargs))
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/validation.py", line 9, in check
issues.extend(self._check_sql_mode(**kwargs))
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/validation.py", line 13, in _check_sql_mode
with self.connection.cursor() as cursor:
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 256, in cursor
return self._cursor()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 233, in _cursor
self.ensure_connection()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 195, in connect
self.connection = self.get_new_connection(conn_params)
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 227, in get_new_connection
return Database.connect(**conn_params)
File "/venv/lib/python3.6/site-packages/MySQLdb/__init__.py", line 84, in Connect
return Connection(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/MySQLdb/connections.py", line 179, in __init__
super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2002, "Can't connect to MySQL server on 'db' (115)")
And full response from createsuperuser command:
# docker exec -it kiwi_web /Kiwi/manage.py createsuperuser
Traceback (most recent call last):
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 195, in connect
self.connection = self.get_new_connection(conn_params)
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 227, in get_new_connection
return Database.connect(**conn_params)
File "/venv/lib/python3.6/site-packages/MySQLdb/__init__.py", line 84, in Connect
return Connection(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/MySQLdb/connections.py", line 179, in __init__
super(Connection, self).__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (2002, "Can't connect to MySQL server on 'db' (115)")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Kiwi/manage.py", line 12, in <module>
execute_from_command_line(sys.argv)
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/venv/lib/python3.6/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 61, in execute
return super().execute(*args, **options)
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 363, in execute
self.check_migrations()
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 453, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "/venv/lib/python3.6/site-packages/django/db/migrations/executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 49, in __init__
self.build_graph()
File "/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 212, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/venv/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 73, in applied_migrations
if self.has_table():
File "/venv/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 56, in has_table
return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor())
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 256, in cursor
return self._cursor()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 233, in _cursor
self.ensure_connection()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 195, in connect
self.connection = self.get_new_connection(conn_params)
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 227, in get_new_connection
return Database.connect(**conn_params)
File "/venv/lib/python3.6/site-packages/MySQLdb/__init__.py", line 84, in Connect
return Connection(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/MySQLdb/connections.py", line 179, in __init__
super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2002, "Can't connect to MySQL server on 'db' (115)")
Hello and happy new year first.
I am running a CentOS 8 VirtualBox on a Windows 10 host.
Do you mean to say that you have Docker running inside the CentOS VM or not ?
The basic problem seems to be that kiwi_web cannot connect to kiwi_db.
Assuming Docker is running inside the VM and you are trying to run the Kiwi TCMS container then:
Does docker-compose up bring the 2 containers up? Can you verify that they are present, e.g. docker ps ?
... I tried to open the Kiwi page and got the 500 internal server error before running the migrate command.
The 500 here is likely because there is no database (no tables, no connection, something else). If you were seing a Kiwi TCMS branded error page or anything at all that means kiwi_web container is running. Can you verify that this container is running ? You should be redirected to https://localhost (or FQDN, IP address) and the page should be using our own self-signed SSL certificate. Is this the case ?
Everything that you've shown looks like you've got the web container running but not the database container running ? You can try to docker exec ... /bin/bash for each of the containers to make sure they are there. If that happens then try any networking tools for Linux (e.g. ping, netstat) to see if there is a network connectivity between the two containers. They should be on the same virtual network (in Docker terms) and their names should also serve as host names on that same network.

Resources