Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datasette cannot be installed with Rye #2065

Closed
simonw opened this issue Apr 27, 2023 · 4 comments
Closed

Datasette cannot be installed with Rye #2065

simonw opened this issue Apr 27, 2023 · 4 comments
Labels

Comments

@simonw
Copy link
Owner

simonw commented Apr 27, 2023

https://github.com/mitsuhiko/rye

I tried this:

rye install datasette

But now:

% ~/.rye/shims/datasette
Traceback (most recent call last):
  File "/Users/simon/.rye/shims/datasette", line 5, in <module>
    from datasette.cli import cli
  File "/Users/simon/.rye/tools/datasette/lib/python3.11/site-packages/datasette/cli.py", line 17, in <module>
    from .app import (
  File "/Users/simon/.rye/tools/datasette/lib/python3.11/site-packages/datasette/app.py", line 14, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

I think that's because setuptools is not included in Rye.

@simonw simonw added the bug label Apr 27, 2023
simonw added a commit that referenced this issue Apr 27, 2023
@simonw
Copy link
Owner Author

simonw commented Apr 27, 2023

Tried this:

rye install https://github.com/simonw/datasette/archive/refs/heads/main.zip

But got this error:

Error: Expected one of `@`, `(`, `<`, `=`, `>`, `~`, `!`, `;`, found `:`

I instead downloaded that file and ran:

rye install main.zip

This worked! And now:

~/.rye/tools/main-zip/bin/datasette --version
datasette, version 1.0a2

@simonw simonw closed this as completed Apr 27, 2023
@simonw
Copy link
Owner Author

simonw commented Apr 27, 2023

Turned this into a TIL: https://til.simonwillison.net/python/rye

@simonw
Copy link
Owner Author

simonw commented Apr 27, 2023

I need pip as a dependency too:

% ~/.rye/tools/main-zip/bin/datasette install datasette-graphql
Traceback (most recent call last):
  File "/Users/simon/.rye/tools/main-zip/bin/datasette", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Users/simon/.rye/tools/main-zip/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/simon/.rye/tools/main-zip/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/simon/.rye/tools/main-zip/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/simon/.rye/tools/main-zip/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/simon/.rye/tools/main-zip/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/simon/.rye/tools/main-zip/lib/python3.11/site-packages/datasette/cli.py", line 365, in install
    run_module("pip", run_name="__main__")
  File "<frozen runpy>", line 222, in run_module
  File "<frozen runpy>", line 142, in _get_module_details
ImportError: No module named pip

@simonw
Copy link
Owner Author

simonw commented Apr 27, 2023

That fixed it - after installing main.zip again I ran this and it worked:

~/.rye/tools/main-zip/bin/datasette install datasette-graphql
% ~/.rye/tools/main-zip/bin/datasette plugins                  
[
    {
        "name": "datasette-graphql",
        "static": true,
        "templates": true,
        "version": "2.2",
        "hooks": [
            "database_actions",
            "extra_template_vars",
            "menu_links",
            "register_routes",
            "startup",
            "table_actions"
        ]
    }
]

@simonw simonw closed this as completed Apr 27, 2023
simonw added a commit that referenced this issue Apr 27, 2023
simonw added a commit that referenced this issue Apr 27, 2023
simonw added a commit that referenced this issue May 26, 2023
simonw added a commit that referenced this issue Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant