abedavis / visbeat

Code for making anything dance to anything
Other
231 stars 43 forks source link

ImportError: No module named functools_lru_cache #6

Open RuoniWang opened 4 years ago

RuoniWang commented 4 years ago

I run into this issue when running the Dockerfile. I tried fixing it by pip install backports.functools_lru_cache but still get the same error ...

Stack trace:

Step 6/13 : RUN $CONDA_DIR/envs/python2/bin/python -m ipykernel install &&     $CONDA_DIR/envs/python2/bin/kernda -o -y /usr/local/share/jupyter/kernels/python2/kernel.json &&     . activate python2 &&     $CONDA_DIR/envs/python2/bin/pip install numpy     scipy     librosa     imageio     moviepy     youtube-dl     requests     bs4     matplotlib     visbeat
 ---> Running in e32da285e42b
Traceback (most recent call last):
  File "/opt/conda/envs/python2/lib/python2.7/runpy.py", line 163, in _run_module_as_main
    mod_name, _Error)
  File "/opt/conda/envs/python2/lib/python2.7/runpy.py", line 111, in _get_module_details
    __import__(mod_name)  # Do not catch exceptions initializing package
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/ipykernel/__init__.py", line 2, in <module>
    from .connect import *
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/ipykernel/connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/IPython/__init__.py", line 49, in <module>
    from .terminal.embed import embed
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/IPython/terminal/embed.py", line 18, in <module>
    from IPython.terminal.interactiveshell import TerminalInteractiveShell
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 16, in <module>
    from prompt_toolkit.document import Document
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/prompt_toolkit/__init__.py", line 16, in <module>
    from .interface import CommandLineInterface
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/prompt_toolkit/interface.py", line 19, in <module>
    from .application import Application, AbortAction
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/prompt_toolkit/application.py", line 3, in <module>
    from .buffer import Buffer, AcceptAction
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/prompt_toolkit/buffer.py", line 7, in <module>
    from .auto_suggest import AutoSuggest
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/prompt_toolkit/auto_suggest.py", line 13, in <module>
    from .filters import to_cli_filter
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/prompt_toolkit/filters/__init__.py", line 33, in <module>
    from .base import *
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/prompt_toolkit/filters/base.py", line 5, in <module>
    from prompt_toolkit.utils import test_callable_args
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/prompt_toolkit/utils.py", line 9, in <module>
    from wcwidth import wcwidth
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/wcwidth/__init__.py", line 12, in <module>
    from .wcwidth import ZERO_WIDTH  # noqa
  File "/opt/conda/envs/python2/lib/python2.7/site-packages/wcwidth/wcwidth.py", line 82, in <module>
    from backports.functools_lru_cache import lru_cache
ImportError: No module named functools_lru_cache

Wonder anyone knows how to fix this?

jquast commented 4 years ago

Hello, I author the wcwidth module. I did add this functools_lru_cache backports dependency for python versions earlier than 3.2. I do automatic tests and it is passing, and I have gone ahead and done a manual test in notice of this issue, and this is also working.

I can only guess, that in the setup.py file of wcwidth, we use this expression:

        install_requires=('backports.functools-lru-cache>=1.2.1;'
                          'python_version < "3.2"'),

And perhaps your version of pip+setuptools is so old to not support it. Can I suggest the following?

pip install --upgrade pip setuptools
pip install --force-reinstall --upgrade wcwidth

For reference, here is my test results

$ pyenv shell 2.7.16
$ pip install --upgrade wcwidth
Collecting wcwidth
  Downloading https://files.pythonhosted.org/packages/ef/94/a17155b400812f0558093c6fb99f92ba823e24757d5884e3ec60f5e81319/wcwidth-0.2.4-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: backports.functools-lru-cache>=1.2.1; python_version < "3.2" in ./.pyenv/versions/2.7.16/lib/python2.7/site-packages (from wcwidth) (1.6.1)
Installing collected packages: wcwidth
  Found existing installation: wcwidth 0.1.9
    Uninstalling wcwidth-0.1.9:
      Successfully uninstalled wcwidth-0.1.9
Successfully installed wcwidth-0.2.4
You are using pip version 18.1, however version 20.2b1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
$ python
Python 2.7.16 (default, Jan 14 2020, 23:44:47)
[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import wcwidth
>>>

I also installed IPython without issue.

jquast commented 4 years ago

Also, you say,

I tried fixing it by pip install backports.functools_lru_cache but still get the same error

The correct module name is backports.functools-lru-cache, I'm not sure if it makes a difference, but be sure to try to use hyphens.