securisec / chepy

Chepy is a python lib/cli equivalent of the awesome CyberChef tool.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImportError: cannot import name 'FuzzyCompleter' from 'prompt_toolkit.completion'

wesinator opened this issue · comments

commented

Describe the bug
$ chepy

File "/usr/local/bin/chepy", line 5, in <module>
    from chepy.__main__ import main
  File "/usr/local/lib/python3.7/site-packages/chepy/__main__.py", line 9, in <module>
    from prompt_toolkit.completion import (
ImportError: cannot import name 'FuzzyCompleter' from 'prompt_toolkit.completion' (/usr/local/lib/python3.7/site-packages/prompt_toolkit/completion/__init__.py)

To Reproduce
macOS 10.14.6
python 3.7.6 brew

pip3 install chepy as admin user

got error on install

ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/data'
Consider using the `--user` option or check the permissions.

(is this a dependency issue ? the directory /usr/local/data/ does not exist, isn't found in chepy codebase)
Updated pip and reran, installed successfully

Ran $ chepy

Expected behavior
chepy runs

Desktop (please complete the following information):

  • OS: macOS 10.14.6
  • Python Version 3.7.6 brew
  • Chepy Version 2.2.3

It is not a Chepy issue. The issue is installing things as the admin or root user. Chepy along with some of its dependencies will try to link to $PATH for their entry points, so when you are trying to install as root, it will first try to install in root accessible folders, and fire an error if that folder does not exist. If you try to install again, then the cache will know that those paths doesnt exist and try alternate paths that do exist.

Chepy does not have any dependencies on any /usr/* level folders. It is tested against all three major operating systems to make sure that it doesnt have weird installation issues.

Simplest solution is, dont install packages as root/admin. Use virtualenv.

It sounds to me that chepy ran for you successfully?

commented

It is not a Chepy issue. The issue is installing things as the admin or root user. Chepy along with some of its dependencies will try to link to $PATH for their entry points, so when you are trying to install as root, it will first try to install in root accessible folders, and fire an error if that folder does not exist. If you try to install again, then the cache will know that those paths doesnt exist and try alternate paths that do exist.

Chepy does not have any dependencies on any /usr/* level folders. It is tested against all three major operating systems to make sure that it doesnt have weird installation issues.

Simplest solution is, dont install packages as root/admin. Use virtualenv.

It sounds to me that chepy ran for you successfully?

no it didn't, there were two issues I mentioned here, the output at the top is running chepy.

The import of prompt_toolkit needs to be updated probably

FuzzyCompleter,

please reopen

The the issue might be that you have an older version of prompt_toolkit installed from another package which does not have FuzzyCompleter. Chepy uses a newer version of prompt_toolkit, but to make sure you dont break your other tools, try installing Chepy in a virtualenv. Chepy is developed in a mac with the same setup you have, and I cannot replicate the issue.

commented

ah, you're correct. Thanks

I forgot pip doesn't automatically update dependencies : /

Yep! The wonderful hell of pip. haha. I have considered version locking the deps, but then that might break other things for people.