pycscope icon indicating copy to clipboard operation
pycscope copied to clipboard

Cannot install: No module named 'parser'

Open ClayShoaf opened this issue 2 years ago • 8 comments

When I try to install, I get the following output:

[user ~/github/pycscope]$ python setup.py install
Traceback (most recent call last):
  File "/home/user/github/pycscope/setup.py", line 5, in <module>
    from pycscope import __version__
  File "/home/user/github/pycscope/pycscope/__init__.py", line 25, in <module>
    import keyword, parser, symbol, token
ModuleNotFoundError: No module named 'parser'

ClayShoaf avatar Mar 04 '22 21:03 ClayShoaf

I think the issue is basically that pycscope cannot be run using Python 3.10 because the parser module has been removed. It works on Python 3.8 and older, though.

ruben2020 avatar Apr 10 '22 15:04 ruben2020

Ugh.

portante avatar Apr 11 '22 15:04 portante

That's not the only thing that is gone in 3.10, so is the symbol module.

arkdae avatar Apr 26 '22 00:04 arkdae

Hi Peter!

And at least one new distro (Ubuntu 22.04) is 3.10+ only now ;-( I guess ast is the closest replacement? I might have to start looking at this as I use it every day, until then can generate cscope.out files on an older system.

brianphaley avatar Aug 25 '22 15:08 brianphaley

Any help you can offer would be great. I have not had a chance to dive into this work for a long time now.

portante avatar Sep 20 '22 22:09 portante

@portante The parser module has been deprecated since Python 3.10. The only way left is the ast (abstract syntax tree) module. However, I think pycscope requires a concrete syntax tree that preserves the original source code, rather than an abstract syntax tree that's lossy. So, instead of using the ast module, you may need something like LibCST.

ruben2020 avatar Oct 05 '22 10:10 ruben2020

@portante oh. I'm mistaken. There might be a far simpler way to fix this. Please see this page. The change looks trivial. They simply replaced parser.suite with ast.parse.

ruben2020 avatar Oct 05 '22 22:10 ruben2020

@portante I tried it, but it doesn't work. I think the old tuple structure is no longer used. Looks like you have no other choice but to port pycscope to ast or LibCST, which is a huge change to pycscope. It's almost a rewrite I expect. The other alternative is for you to get the old parser and symbol modules' source code from 3.9 and incorporate it into pycscope.

ruben2020 avatar Oct 07 '22 04:10 ruben2020