Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archery-1.11.1部署,执行python3 manage.py makemigrations sql报错 #2706

Closed
sky800719 opened this issue Jun 27, 2024 · 4 comments
Closed

Comments

@sky800719
Copy link

重现步骤

(venv4archery) [archery@archery Archery-1.11.1]$ python3 manage.py makemigrations sql

执行报错,ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

按照官方https://archerydms.com/installation/manual/文件进行部署,该文档版本为1.9.0。

settings.py文件仅修改了mysql数据库root用户的口令,其他未修改。

(venv4archery) [archery@archery Archery-1.11.1]$ cat ./archery/settings.py | grep mysql
DATABASE_URL=(str, "mysql://root:'oracle'@127.0.0.1:3306/archery"),

(venv4archery) [archery@archery Archery-1.11.1]$ cat ./archery/settings.py | grep redis
CACHE_URL=(str, "redis://127.0.0.1:6379/0"),

mysql及redis进程都正常,都可以正常登陆。

(venv4archery) [archery@archery Archery-1.11.1]$ ps -ef | grep -i mysql
mysql 23414 1 0 13:57 ? 00:00:12 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

(venv4archery) [archery@archery Archery-1.11.1]$ ps -ef | grep -i redis
root 29840 1 0 15:21 ? 00:00:02 ./redis-server 127.0.0.1:6379

登陆mysql
(venv4archery) [archery@archery Archery-1.11.1]$ mysql -u root -poracle -h127.0.0.1 -P 3306
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.44 MySQL Community Server (GPL)

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

登陆redis
(venv4archery) [archery@archery Archery-1.11.1]$ redis-cli
127.0.0.1:6379>

pandas版本也符合requirements的要求:

(venv4archery) [archery@archery Archery-1.11.1]$ cat requirements.txt | grep -i pandas
pandas==1.5.*
(venv4archery) [archery@archery Archery-1.11.1]$ pip list | grep -i pandas
pandas 1.5.3

请帮忙看下这个问题怎么解决,谢谢。

预期外的结果

(venv4archery) [archery@archery Archery-1.11.1]$ python3 manage.py makemigrations sql
2024-06-27 15:33:31,517 - environ.environ - INFO - /home/archery/Archery-1.11.1/.env not found - if you're not configuring your environment separately, check this.
import local settings failed, ignored
Traceback (most recent call last):
File "/home/archery/Archery-1.11.1/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/core/management/init.py", line 446, in execute_from_command_line
utility.execute()
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/core/management/init.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/core/management/base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/core/management/base.py", line 443, in execute
self.check()
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/core/management/base.py", line 475, in check
all_issues = checks.run_checks(
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/core/checks/registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/core/checks/urls.py", line 14, in check_url_config
return check_resolver(resolver)
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/core/checks/urls.py", line 24, in check_resolver
return check_method()
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 494, in check
for pattern in self.url_patterns:
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 57, in get
res = instance.dict[self.name] = self.func(instance)
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 715, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/utils/functional.py", line 57, in get
res = instance.dict[self.name] = self.func(instance)
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/home/archery/Archery-1.11.1/archery/urls.py", line 8, in
path("api/", include(("sql_api.urls", "sql_api"), namespace="sql_api")),
File "/home/archery/venv4archery/lib/python3.9/site-packages/django/urls/conf.py", line 38, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/home/archery/Archery-1.11.1/sql_api/urls.py", line 14, in
from . import api_user, api_instance, api_workflow
File "/home/archery/Archery-1.11.1/sql_api/api_user.py", line 4, in
from .serializers import (
File "/home/archery/Archery-1.11.1/sql_api/serializers.py", line 20, in
from sql.engines import get_engine
File "/home/archery/Archery-1.11.1/sql/engines/init.py", line 225, in
engine_map = get_engine_map()
File "/home/archery/Archery-1.11.1/sql/engines/init.py", line 220, in get_engine_map
engine = getattr(importlib.import_module(module), o)
File "/usr/local/python3/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/archery/Archery-1.11.1/sql/engines/mysql.py", line 18, in
from sql.utils.data_masking import data_masking
File "/home/archery/Archery-1.11.1/sql/utils/data_masking.py", line 7, in
import pandas as pd
File "/home/archery/venv4archery/lib/python3.9/site-packages/pandas/init.py", line 22, in
from pandas.compat import is_numpy_dev as _is_numpy_dev # pyright: ignore # noqa:F401
File "/home/archery/venv4archery/lib/python3.9/site-packages/pandas/compat/init.py", line 18, in
from pandas.compat.numpy import (
File "/home/archery/venv4archery/lib/python3.9/site-packages/pandas/compat/numpy/init.py", line 4, in
from pandas.util.version import Version
File "/home/archery/venv4archery/lib/python3.9/site-packages/pandas/util/init.py", line 2, in
from pandas.util._decorators import ( # noqa:F401
File "/home/archery/venv4archery/lib/python3.9/site-packages/pandas/util/_decorators.py", line 14, in
from pandas._libs.properties import cache_readonly
File "/home/archery/venv4archery/lib/python3.9/site-packages/pandas/_libs/init.py", line 13, in
from pandas._libs.interval import Interval
File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

日志文本

未生成日志

(venv4archery) [archery@archery Archery-1.11.1]$ ls -la ./logs/*
-rw-rw-r--. 1 archery archery 0 Jun 27 15:22 ./logs/archery.log
-rw-rw-r--. 1 archery archery 0 Jun 27 15:22 ./logs/qcluster.log

版本

1.11.1

部署方式

手工部署

是否还有其他可以辅助定位问题的信息?比如数据库版本等

mysql:5.7.44
Browsers:edge
goInception:未部署

OS: redhat 7.6
Python 3.9.10

@sky800719
Copy link
Author

升级 pandas 版本后,

(venv4archery) [archery@archery ~]$ pip install --upgrade numpy pandas

(venv4archery) [archery@archery ~]$ pip list | grep -i pandas
pandas 2.2.2
(venv4archery) [archery@archery ~]$ pip list | grep -i numpy
numpy 2.0.0

出现新的报错
File "/home/archery/venv4archery/lib/python3.9/site-packages/numpy/init.py", line 397, in getattr
raise AttributeError(
AttributeError: np.float_ was removed in the NumPy 2.0 release. Use np.float64 instead.

@LeoQuote
Copy link
Collaborator

已经在 #2687 解决, 可以使用 master 分支的代码

@sky800719
Copy link
Author

(venv4archery) [archery@archery ~]$ pip uninstall pandas
(venv4archery) [archery@archery ~]$ pip uninstall numpy

删除 pandas、numpy包

安装新版本,问题解决。

(venv4archery) [archery@archery ~]$ pip install pandas==1.5.3
(venv4archery) [archery@archery ~]$ pip install numpy==1.26.4

默认安装 pandas 1.5.3 时,会安装 numpy 2.0版本,存在兼容问题。

@sky800719
Copy link
Author

已经在 #2687 解决, 可以使用 master 分支的代码

感谢,换了个包解决了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants