-
-
Notifications
You must be signed in to change notification settings - Fork 468
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
First-run experience failure: rye run hello
after rye init
+ rye sync
-- results in "ModuleNotFoundError: no module named 'xyz' ..."
#793
Comments
Thank you for reporting this. I cannot reproduce this for now:
Did pyproject.toml already exist or did you add a new There was a change in v0.26.0 that changed the templates for the projects, which should result in a new |
Try activate your virtual environment: |
Re: @T-256's comment, same result after running venv activation. Re: @dsp's comment, here's my [project]
name = "xyz"
version = "0.2.2"
description = "xyz placeholder project (under development)"
authors = [
{ name = "Andrew Montalenti", email = "git@amontalenti.com" }
]
dependencies = [
]
readme = "README.md"
requires-python = ">= 3.8"
[project.scripts]
hello = "xyz:hello"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.rye]
managed = true
dev-dependencies = []
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["src/xyz"] |
Also re: @dsp's comment, given that he mentioned that
|
FWIW I could not repro the latest example
|
I imagine it must be something about my environment (specific zsh profile, Ubuntu 20.04 LTS, etc.) ... What other environmental details can I provide to figure it out? |
@amontalenti Yes, that's a good guess. Do you have $PYTHONPATH or something similar set (you can check using |
@dsp Good idea, but didn't seem to help:
|
I also tried simplifying my PATH, with same result. Just the rye shims + system paths.
|
What would probably help me is to understand, based on this contents inside site-packages:
How is |
I have the same problem, on Windows. |
The c6ntent 6f One thing you could try @amontalenti is to see what |
Thanks @dsp, these are good tips. When I
I do have the
As for the
... but yet:
|
I also stole an idea from another GitHub issue, which is to run the
|
One more pretty whacky result. Out of sheer curiosity, I tried installing
... Sure enough, according to
|
Interesting, on my computer with most recent rye and uv, it is not empty.
Because my I am honestly a bit at a loss here. One thing to try is to disable |
It sounds like |
Alright, at least we're getting warmer. First, I tried revising
OK, so
So, not sure why neither |
Also just wanted to share all my version info that applies to my last couple comments:
|
@amontalenti your UV sohuld come from |
@dsp Ah, good point:
(Edited the original comment to remove uv version so there isn't any confusion.) |
@amontalenti I ran into something like this a bit ago, and it ended up being due to: Personally, adding a .gitignore fixed it. Could you paste the contents of your project's root? |
@jacobb VERY good find! That was it. Here's why I was affected. I run one of those setups where my Since I was just playing around with these rye projects, I didn't add them to version control or git. As a result, as you suggested, that bug in pypa/hatch was scanning for By doing |
I was also able to confirm exactly your theory with this
When there is |
Yeah this unfortunately is a bug in hatch. I'm still considering whether hatch is a good default build tool choice, and if maybe setuptools would be a better default for now. For now I'm going to close this. |
Steps to Reproduce
rye init
.rye run python
works to pull up Python 3.11.7rye sync
works without errorrye run
listshello
as a valid run argumentrye run hello
results in errorExpected Result
I would expect the
hello()
function to get called, which I imagine would just succeed since the default implementation of that function simply returns a string.Actual Result
I should mention that I can "fix" this by doing the following from the root of the project:
At that point,
rye run hello
succeeds and returns:But obviously I shouldn't have to manually copy the project source into the
.venv
directory forrye run
to work.I thought maybe this had something to do with me using
pyenv
beforerye
, but I tried the same from a shell where I removedpyenv
from the$PATH
and also removed it from zsh plugins, and yet, still,rye
behaved same way.Version Info
Stacktrace
RUST_BACKTRACE=1
has no effect onrye run
, so I guess it's not crashing.The text was updated successfully, but these errors were encountered: