简体   繁体   English

ModuleNotFoundError:尽管安装了模块,但没有名为“tf_slim”的模块

[英]ModuleNotFoundError: No module named 'tf_slim' despite installing

I'd like to run call_variants.py from deepvariant .我想从deepvariant call_variants.py I was struggling for hours ans hours installing cuda, tensorflow etc... Unfortunately I ran into a problem and I don't know what to do.我在安装 cuda、tensorflow 等时苦苦挣扎了好几个小时……不幸的是,我遇到了一个问题,我不知道该怎么办。 Let's start from the beginning:让我们从头开始:

conda create --name tf tensorflow
conda activate tf
python --version
Python 3.7.9
python3 -c 'import tensorflow as tf; print(tf.__version__)'
2.3.0

Now I tried to run the command:现在我尝试运行命令:

python ${h_dir}/deepvariant/binaries/DeepVariant/1.0.0/DeepVariant-1.0.0/call_variants.zip \
--outfile ${test_dir}/test.gz \
--examples ${ex_dir}/ex_test.gz --checkpoint $model

I got:我有:

Traceback (most recent call last):
  File "/tmp/Bazel.runfiles_i55m5mpq/runfiles/com_google_deepvariant/deepvariant/call_variants.py", line 57, in <module>
    from deepvariant import modeling
  File "/tmp/Bazel.runfiles_i55m5mpq/runfiles/com_google_deepvariant/deepvariant/modeling.py", line 51, in <module>
    import tf_slim
ModuleNotFoundError: No module named 'tf_slim'

So of course I decided to install it:所以我当然决定安装它:

pip install tf_slim
Collecting tf_slim
  Using cached tf_slim-1.1.0-py2.py3-none-any.whl (352 kB)
Requirement already satisfied: absl-py>=0.2.2 in ./anaconda3/envs/tf/lib/python3.7/site-packages (from tf_slim) (0.11.0)
Requirement already satisfied: six in ./anaconda3/envs/tf/lib/python3.7/site-packages (from absl-py>=0.2.2->tf_slim) (1.15.0)
Installing collected packages: tf-slim
Successfully installed tf-slim-1.1.0

However:然而:

python3 -c 'import tf_slim as slim; print(slim.__version__)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'tf_slim' has no attribute '__version__'

An of course ModuleNotFoundError: No module named 'tf_slim' after running the command.当然ModuleNotFoundError: No module named 'tf_slim'运行命令后。 So maybe install with conda?所以也许用 conda 安装?

conda install -c conda-forge tf-slim

But it didn't help at all... I have no clue what to do next, looking forward to any ideas!但它根本没有帮助......我不知道下一步该怎么做,期待任何想法!

Edit: When I run something like this:编辑:当我运行这样的事情时:

try:
    import tf_slim as slim
    print("module 'tf_slim' is installed")
except ModuleNotFoundError:
    print("module 'tf_slim' is not installed")

python test.py
module 'tf_slim' is installed

But after command, still ModuleNotFoundError: No module named 'tf_slim'但是在命令之后,仍然是ModuleNotFoundError: No module named 'tf_slim'

¯_(ツ)_/¯ ¯_(ツ)_/¯

Ok, I think I got it.好的,我想我明白了。 As you may see I used conda to create enviroment for tensorflow.如您所见,我使用 conda 为 tensorflow 创建环境。 As I read, this procedure is recommended, otherwise you may encounter something like ModuleNotFoundError: No module named 'tensorflow' which has been described here .正如我所读到的,建议使用此过程,否则您可能会遇到类似ModuleNotFoundError: No module named 'tensorflow' which has been described here之类的问题。 So what I did?那我做了什么? I deactivated and removed any conda enviroment and I decided to run my command without it, just in terminal.我停用并删除了任何 conda 环境,我决定在没有它的情况下运行我的命令,就在终端中。 First, however I run the command with python3 then I occured same error that's ModuleNotFoundError: No module named 'tf_slim' and I installed it with pip3 install tf_slim and it worked.首先,但是我使用python3运行命令然后我发生了与ModuleNotFoundError: No module named 'tf_slim'相同的错误,我使用pip3 install tf_slim安装了它并且它工作正常。 Next I run deepvariant script postprocess_variants.py and I had the same problem with altair module but I did the same and the both commands worked!接下来,我运行 deepvariant 脚本 postprocess_variants.py,我遇到了与altair模块相同的问题,但我做了同样的事情,两个命令都有效!

Just uninstall tf_slim and then again install the tf_slim package, it will work.只需卸载tf_slim ,然后再次安装tf_slim package,它就可以工作了。

暂无
暂无

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

相关问题 ModuleNotFoundError:没有名为“tf_slim”的模块 - ModuleNotFoundError: No module named 'tf_slim' 在 colab 中使用 ssd_inceptionv2 时出现问题(错误 import tf_slim as slim ModuleNotFoundError: No module named 'tf_slim' - having problem using ssd_inceptionv2 in colab ( error import tf_slim as slim ModuleNotFoundError: No module named 'tf_slim' ModuleNotFoundError:尽管使用 pip 安装,但没有名为“Google”的模块 - ModuleNotFoundError: No module named 'Google' despite installing with pip ModuleNotFoundError:没有名为“tf”的模块 - ModuleNotFoundError: No module named 'tf' ModuleNotFoundError:尽管安装了但没有名为“cv2”的模块 - ModuleNotFoundError: No module named 'cv2' despite installation 尽管使用 pip 安装它,为什么我会收到“ModuleNotFoundError:没有名为‘pyperclip’的模块”? - Why do I get "ModuleNotFoundError: No module named 'pyperclip'" despite installing it with pip? py-script 错误指出“ModuleNotFoundError:尽管安装了 pandas,但没有名为‘pandas’的模块” - a py-script error stating "ModuleNotFoundError: No module named 'pandas" despite installing pandas 问题安装 zenipy,ModuleNotFoundError:没有名为“gi”的模块 - Issue installing zenipy, ModuleNotFoundError: no module named 'gi' ModuleNotFoundError:安装库时没有名为“_ctypes”的模块 - ModuleNotFoundError: No module named '_ctypes' while installing libraries ModuleNotFoundError:安装pyarrow时没有名为'Cython'的模块 - ModuleNotFoundError: No module named 'Cython' when installing pyarrow
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM