ModuleNotFoundError: No module named ‘paramiko’

20 篇文章 0 订阅
7 篇文章 0 订阅

环境:docker odoo15.0

自动备份插件来自:https://github.com/Yenthe666/auto_backup

报错信息一

安装时报错信息如下:
RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
File “/mnt/b8water/auto_backup/models/db_backup.py”, line 17, in
import paramiko
ModuleNotFoundError: No module named ‘paramiko’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py”, line 237, in _dispatch
result = request.dispatch()
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 688, in dispatch
result = self._call_function(**self.params)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 360, in _call_function
return checked_call(self.db, *args, **kwargs)
File “/usr/lib/python3/dist-packages/odoo/service/model.py”, line 94, in wrapper
return f(dbname, *args, **kwargs)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 349, in checked_call
result = self.endpoint(*a, **kw)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 917, in call
return self.method(*args, **kw)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 536, in response_wrap
response = f(*args, **kw)
File “/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py”, line 1352, in call_button
action = self._call_kw(model, method, args, kwargs)
File “/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py”, line 1340, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File “/usr/lib/python3/dist-packages/odoo/api.py”, line 464, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File “/usr/lib/python3/dist-packages/odoo/api.py”, line 451, in _call_kw_multi
result = method(recs, *args, **kwargs)
File “”, line 2, in button_immediate_install
File “/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py”, line 74, in check_and_log
return method(self, *args, **kwargs)
File “/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py”, line 483, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File “/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py”, line 600, in _button_immediate_function
registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)
File “/usr/lib/python3/dist-packages/odoo/modules/registry.py”, line 87, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File “/usr/lib/python3/dist-packages/odoo/modules/loading.py”, line 474, in load_modules
processed_modules += load_marked_modules(cr, graph,
File “/usr/lib/python3/dist-packages/odoo/modules/loading.py”, line 363, in load_marked_modules
loaded, processed = load_module_graph(
File “/usr/lib/python3/dist-packages/odoo/modules/loading.py”, line 179, in load_module_graph
load_openerp_module(package.name)
File “/usr/lib/python3/dist-packages/odoo/modules/module.py”, line 396, in load_openerp_module
import(‘odoo.addons.’ + module_name)
File “/mnt/b8water/auto_backup/init.py”, line 1, in
from . import models
File “/mnt/b8water/auto_backup/models/init.py”, line 2, in
from . import db_backup
File “/mnt/b8water/auto_backup/models/db_backup.py”, line 19, in
raise ImportError(
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 644, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 302, in _handle_exception
raise exception.with_traceback(None) from new_cause
ImportError: This module needs paramiko to automatically write backups to the FTP through SFTP. Please install paramiko on your system. (sudo pip3 install paramiko)

原因:ModuleNotFoundError: No module named ‘paramiko’

运行环境中缺少了’paramiko’这个模块

解决办法:

1、以root身份进入odoo 15容器中

docker ps
docker exec -it --user root container_id /bin/bash

2、安装’paramiko’

pip3 install paramiko
补充:在odoo12容器中会报错,可以这样来安装:
apt-get update
apt-get install build-essential python3-dev libssl-dev \
 libffi-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev
pip3 install wheel
pip3 install pysftp==0.2.8
pip3 install cryptography==2.3
pip3 install paramiko==2.4.2 

报错信息二

在这里插入图片描述

在开发者模式下,技术-安排的动作-Backup scheduler-手动执行,报错信息如下:
RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py”, line 330, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File “”, line 1, in
File “/mnt/b8water/auto_backup/models/db_backup.py”, line 123, in schedule_backup
os.makedirs(rec.folder)
File “/usr/lib/python3.9/os.py”, line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File “/usr/lib/python3.9/os.py”, line 225, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: ‘/opt/odoo’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py”, line 237, in _dispatch
result = request.dispatch()
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 688, in dispatch
result = self._call_function(**self.params)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 360, in _call_function
return checked_call(self.db, *args, **kwargs)
File “/usr/lib/python3/dist-packages/odoo/service/model.py”, line 94, in wrapper
return f(dbname, *args, **kwargs)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 349, in checked_call
result = self.endpoint(*a, **kw)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 917, in call
return self.method(*args, **kw)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 536, in response_wrap
response = f(*args, **kw)
File “/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py”, line 1352, in call_button
action = self._call_kw(model, method, args, kwargs)
File “/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py”, line 1340, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File “/usr/lib/python3/dist-packages/odoo/api.py”, line 464, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File “/usr/lib/python3/dist-packages/odoo/api.py”, line 451, in _call_kw_multi
result = method(recs, *args, **kwargs)
File “/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_cron.py”, line 85, in method_direct_trigger
cron.with_user(cron.user_id).with_context(lastcall=cron.lastcall).ir_actions_server_id.run()
File “/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions.py”, line 639, in run
res = runner(run_self, eval_context=eval_context)
File “/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions.py”, line 508, in _run_action_code_multi
safe_eval(self.code.strip(), eval_context, mode=“exec”, nocopy=True) # nocopy allows to return ‘action’
File “/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py”, line 346, in safe_eval
raise ValueError(‘%s: “%s” while evaluating\n%r’ % (ustr(type(e)), ustr(e), expr))
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 644, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File “/usr/lib/python3/dist-packages/odoo/http.py”, line 302, in _handle_exception
raise exception.with_traceback(None) from new_cause
ValueError: <class ‘PermissionError’>: “13
Permission denied” while evaluating
‘model.schedule_backup()’

原因:PermissionError: [Errno 13] Permission denied: ‘/opt/odoo’

备份文件夹权限不足

解决办法:

1、以root身份进入odoo 15容器中

docker ps
docker exec -it --user root container_id /bin/bash

2、在root的根目录下创建备份文件夹:/opt/odoo/dbbackups

cd /opt
mkdir odoo
cd odoo
mkdir dbbackups

3、对备份文件夹设置权限

chmod o+w /opt/odoo/dbbackups
chmod g-x /opt/odoo/dbbackups
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值