简体   繁体   English

运行代码后已安装的库丢失

[英]Already installed libraries missing after running the code

I am trying to run a code in a virtual python environment on a cluster.我正在尝试在集群上的虚拟 python 环境中运行代码。 Here, I installed all the relevant libraries such as h5py, plotly, tqdm, mpi4py and vtk using pip install ____ command and all of these libraries installed just fine.在这里,我使用 pip install ____ 命令安装了所有相关库,例如 h5py、plotly、tqdm、mpi4py 和 vtk,并且所有这些库都安装得很好。 But when I run my code, the system start asking for these libraries again.但是当我运行我的代码时,系统又开始要求这些库。 At this point, if I try to reinstall these libraries I get prompts like:此时,如果我尝试重新安装这些库,我会收到如下提示:

WARNING: The directory '/gpfs/fs1/home//a5saieed/.cache/pip' or its parent directory is not owned or is not writable by the current user.警告:目录 '/gpfs/fs1/home//a5saieed/.cache/pip' 或其父目录不属于当前用户或不可写。 The cache has been disabled.缓存已被禁用。 Check the permissions and owner of that directory.检查该目录的权限和所有者。 If executing pip with sudo, you may want sudo's -H flag.如果使用 sudo 执行 pip,您可能需要 sudo 的 -H 标志。 Defaulting to user installation because normal site-packages is not writeable默认为用户安装,因为普通站点包不可写

sudo command doesn't work since it's a cluster on which I do not have the right to use it. sudo 命令不起作用,因为它是一个我无权使用它的集群。

What might be causing this problem and what could be it's possible solution?什么可能导致此问题以及可能的解决方案是什么?

..... ......

you should not use sudo with pip while having virtualenv activated.在激活 virtualenv 时, 您不应将 sudo 与 pip一起使用。 Try install the libraries in this way:尝试以这种方式安装库:

# installs on virtualenv's python:
$ .env/bin/python -m pip install yourlibrary

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在没有安装库的情况下运行 python 脚本 - Running python script without installed libraries 如何测试运行我的代码的机器上是否已经安装了 nltk 资源? - How do I test whether an nltk resource is already installed on the machine running my code? 我已经安装了父模块,如何解决缺少的实用程序模块阻止我的可执行文件运行的问题? - How do I resolve a missing utility module preventing my executable from running when I already installed the parent module? 新创建的 anaconda 环境如何已经安装了所有库? - How a newly created anaconda environment has already all the libraries installed in it? 如何在 python 项目中安装 python 库? - How to have python libraries already installed in python project? 运行 pyinstaller 后缺少依赖项 - missing dependency after running pyinstaller 使用 tox 运行 python 单元测试时遇到问题 - 已安装模块的 ImportError - Trouble running python unit tests with tox - ImportError for module that is already installed PyCharm代码完成不适用于已安装的库 - PyCharm code completion doesn't work for installed libraries atom:已安装氢气,但代码未运行(在macOS上) - atom: hydrogen installed, but the code is not running (on macOS) 如何自动下载 PyCharm venv 上已安装的 python 库的 tar.gz 包 - How to automatically download tar.gz packages of python libraries that already installed on venv at PyCharm
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM