简体   繁体   中英

Can't find correct directory for Python module

I'm using a docker container with from base image jupyter/tensorflow-notebook While trying to run a command kale , it shows error

Traceback (most recent call last):
  File "/usr/local/bin/kale", line 7, in <module>
    from kale.command_line import main
  File "/usr/local/lib/python3.6/dist-packages/kale/command_line.py", line 2, in <module>
    import nbformat as nb
  File "/usr/local/lib/python3.6/dist-packages/nbformat/__init__.py", line 9, in <module>
    from ipython_genutils import py3compat
ModuleNotFoundError: No module named 'ipython_genutils'

While trying to install ipython_genutils using pip install ipython_genutils , it says

Requirement already satisfied: ipython_genutils in /opt/conda/lib/python3.7/site-packages (0.2.0)

The same can be confirmed with conda list which does among others show

ipython_genutils 0.2.0 py_1 conda-forge

However pip list doesn't show the same. My question is how can I make kale know to find the module in the correct directory?

You described three different python environments-

Requirement already satisfied: ipython_genutils in /opt/conda/lib/python3.7/site-packages
File "/usr/local/lib/python3.6/dist-packages/nbformat/__init__.py"
ipython_genutils          0.2.0                      py_1    conda-forge

The first is a conda python3.7 environment. The second is a user-global python3.6 environment. The third is inside conda (am not an expert, could be the first one and the third are the same)

So "kale" is using python3.6, but ipython_genutils is installed in conda. I would uninistall kale using pip (python3.6 -m pip - have to make sure the pip for the correct environment!), and reinstall it with conda.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM