markvincze / sabledocs

Simple static documentation generator for Protobuf and gRPC contracts.
MIT License
59 stars 14 forks source link

After Installing Sable via Pip Getting ModuleNotFoundError: No module named 'tomllib' #14

Closed BadgerBadgerBadgerBadger closed 1 year ago

BadgerBadgerBadgerBadger commented 1 year ago

Hi,

Came across sable while googling for a grpc documentation generator. Installed via pip install sabledocs. Running sabledocs in my proto repo gives me:

Traceback (most recent call last):
  File "/Users/shak/miniconda/bin/sabledocs", line 5, in <module>
    from sabledocs.__main__ import cli
  File "/Users/shak/miniconda/lib/python3.10/site-packages/sabledocs/__main__.py", line 5, in <module>
    from sabledocs.proto_descriptor_parser import parse_proto_descriptor
  File "/Users/shak/miniconda/lib/python3.10/site-packages/sabledocs/proto_descriptor_parser.py", line 9, in <module>
    from sabledocs.sable_config import RepositoryType, SableConfig
  File "/Users/shak/miniconda/lib/python3.10/site-packages/sabledocs/sable_config.py", line 3, in <module>
    import tomllib
ModuleNotFoundError: No module named 'tomllib'

Python 3.10.10 pip 23.0.1

Let me know if more details can help.

markvincze commented 1 year ago

Hi @BadgerBadgerBadgerBadger,

Yep, this is a known problem, this package requires Python version 3.11 or higher, because tomllib was introduced in 3.11.
I'll try to see if can highlight this in the README better, or print a better error message on the terminal.

BadgerBadgerBadgerBadger commented 1 year ago

Thanks for

Hi @BadgerBadgerBadgerBadger,

Yep, this is a known problem, this package requires Python version 3.11 or higher, because tomllib was introduced in 3.11. I'll try to see if can highlight this in the README better, or print a better error message on the terminal.

Thank for the reply!

I installed python 3.11.3 using pyenv and tried again but no dice, it seems.

❯ sabledocs
Traceback (most recent call last):
  File "/Users/shak/miniconda/bin/sabledocs", line 5, in <module>
    from sabledocs.__main__ import cli
  File "/Users/shak/miniconda/lib/python3.10/site-packages/sabledocs/__main__.py", line 5, in <module>
    from sabledocs.proto_descriptor_parser import parse_proto_descriptor
  File "/Users/shak/miniconda/lib/python3.10/site-packages/sabledocs/proto_descriptor_parser.py", line 9, in <module>
    from sabledocs.sable_config import RepositoryType, SableConfig
  File "/Users/shak/miniconda/lib/python3.10/site-packages/sabledocs/sable_config.py", line 3, in <module>
    import tomllib
ModuleNotFoundError: No module named 'tomllib'
❯ python --version
Python 3.11.3
❯ pip --version
pip 22.3.1 from /Users/shak/.pyenv/versions/3.11.3/lib/python3.11/site-packages/pip (python 3.11)
markvincze commented 1 year ago

Hi @BadgerBadgerBadgerBadger,

Thanks for trying it this way too. I'll try to investigate what might be causing this. One strange though in your terminal output is this full path:

/Users/shak/miniconda/lib/python3.10/site-packages/sabledocs/__main__.py

Which still says python3.10. Is it possible that multiple versions of Python are installed on your system, and when you run sabledocs as a CLI, the version 3.10 is picked for some reason?

BadgerBadgerBadgerBadger commented 1 year ago

I uninstalled my python 3.10 and it worked. Thank you for the prompt support! Loving the project.

markvincze commented 1 year ago

@BadgerBadgerBadgerBadger Cheers, I'm glad it worked, and that you like the project! 🙂