mysql - 错误 :superset. views.core:意外错误没有名为 'pymysql' 的模块

标签 mysql docker containers superset

我在 docker 中运行 apache superset 0.36,为 redis 和 postgres 使用单独的 docker。尝试连接到在主机上运行的 MySQL 数据源时,出现错误 “错误:superset.views.core:意外错误没有名为‘pymysql’的模块” .
我尝试 bash 来超集容器“sudo docker run -it superset_superset bash”,然后 “点安装 pymysql” 但收到警告 “警告:目录'/home/superset/.cache/pip/http'或其父目录不属于当前用户并且缓存已被禁用。请检查该目录的权限和所有者。如果执行pip sudo,您可能需要 sudo 的 -H 标志。” 它不安装pymysql。
在容器内运行 pip install pymysql 时抛出的错误是“安装收集的包:pymysql 错误:由于 EnvironmentError 无法安装包:[Errno 13] Permission denied:'/usr/local/lib/python3.6/site-packages/pymysql' 考虑使用 --user 选项或检查权限。” 也试过 pip install pymysql --user 但同样的错误。
对此的任何帮助将不胜感激。

最佳答案

在某种程度上,错误消息已经显示了答案:

sudo -H pip install pymysql
sudo -H 的一个漂亮的共鸣

When you run sudo your environment is passed along while the effective user switches to root. Your environment includes that your ~/ or home directory (the value of the environment variable HOME) is /home/bijay.


pip looks for an http cache before downloading packages. Probably for a combination of security, sanity and privacy reasons pip disables the cache so as not to write to a cache directory not owned by the current user. It's just telling you that it did that.


As it hints, using sudo -H would set the HOME environment variable before executing the command passed to sudo, using root's home directory /root as $HOME instead of your user's. The cache could then be written in /root/.cache/pip/http with no errors.
As a sidenote, you probably shouldn't be running pip as root anyway.

关于mysql - 错误 :superset. views.core:意外错误没有名为 'pymysql' 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63384876/

相关文章:

c - mount() after clone() with CLONE_NEWNS set effects parent

php OOP 错误 : Call to a member function query() on null in c:blah/bla/. ./\engine\admin\cms.class.php 第 7 行

MySQL 5.6 - InnoDB - DATA_FREE 未使用,但表不断增长

docker - Cognito Identity System.IO.InvalidDataException : Cannot determine protocol. 在 Elastic beanstalk 上的 docker 中运行时

c++ - 大型 POD 作为元组进行排序

c# - 可以将具有不同泛型类型的对象添加到单个容器中吗

PHP mysql子查询过滤

mysql - 如何为具有逗号分隔值的字段设置 'where' 子句?

amazon-web-services - 如何在Elastic--Beanstalk实例中更新Docker镜像

linux - 我们可以通过 USB 设备传递到 Linux 上的 Docker 容器吗?