Open 5183nischal opened 1 day ago
I couldn't reproduce this as described. Where is "trials1" coming from?
❯ uv init --lib trials
Initialized project `trials` at `/Users/zb/workspace/uv/trials`
❯ cd trials
❯ uv run python -c "import trials"
Using Python 3.13.0rc2
Creating virtualenv at: .venv
Built trials @ file:///Users/zb/workspace/uv/trials
Installed 1 package in 0.94ms
❯ echo 'def add(): pass' > src/trials/add.py
❯ uv run python -c "import trials"
❯ echo 'from .add import add' > src/trials/__init__.py
❯ uv run python -c "import trials"
"trials1" was a typo! Ok, but it gets even stranger. I initialized a project, cd'd into it and then run uv run python -c "import trials"
, it works once and then suddenly throws the error when I run it again immediately (see the screenshot),
and if I make a project anywhere under ~/Documents/
I get the same problem, but for example if i make a project in ~/Downloads/
, I don't get this problem and things are fine. What could be the reason?
Uhh I have no clue. Sounds like something is removing the files? Is it still there if you do ls src/trials
after the failure?
Yes, it's all there, nothing is deleted:
In fact, I simply copied trials
to ~/Downloads
and then suddenly the problem is gone..
It might help to share the verbose output (with -v
) for the error case
The verbose output looks like:
DEBUG uv 0.4.10
DEBUG Found project root: `/Users/nisch/Documents/projects_uv/trials`
DEBUG No workspace root found, using project root
DEBUG Discovered project `trials` at: /Users/nisch/Documents/projects_uv/trials
DEBUG Reading requests from `/Users/nisch/Documents/projects_uv/trials/.python-version`
DEBUG The virtual environment's Python version satisfies `Python 3.10`
DEBUG Using request timeout of 30s
DEBUG Found static `pyproject.toml` for: trials @ file:///Users/nisch/Documents/projects_uv/trials
DEBUG No workspace root found, using project root
DEBUG Existing `uv.lock` satisfies workspace requirements
Resolved 1 package in 9ms
DEBUG Using request timeout of 30s
WARN Failed to read metadata for file: No such file or directory (os error 2)
WARN Failed to read metadata for file: No such file or directory (os error 2)
DEBUG Requirement already installed: trials==0.1.0 (from file:///Users/nisch/Documents/projects_uv/trials)
Audited 1 package in 1ms
DEBUG Using Python 3.10.15 interpreter at: /Users/nisch/Documents/projects_uv/trials/.venv/bin/python3
DEBUG Running `python -c import trials`
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'trials'
DEBUG Command exited with code: 1
in the case that it works, the output is identical up until the error.
Hi, Thanks for uv!
I initialize a project with
uv init --lib trials
, then go to thesrc/trials
in the project folder add a fileadd.py
with:def add(a, b): return a+b
and addfrom .add import add
to__init__.py
and then runuv run python
followed byimport trials
and i get:Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'trials1'
wheras if I had done the same without before adding the fileadd.py
to src/trials, it would work. I'm somewhat new to all this so maybe I'm missing something, what is expected and how can I makeimport trials
work? Thank you!