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

Failed to prepare distributions #1350

Open
Inasayang opened this issue Aug 24, 2024 · 9 comments
Open

Failed to prepare distributions #1350

Inasayang opened this issue Aug 24, 2024 · 9 comments

Comments

@Inasayang
Copy link

Steps to Reproduce

I uninstalled rye and reinstalled it in a different ___location.
When I open the previous project again and run rye sync, it gives an error.

❯ rye sync       
Reusing already existing virtualenv
Generating production lockfile: C:\Users\inasa\Desktop\pyproject\requirements.lock
Generating dev lockfile: C:\Users\inasa\Desktop\pyproject\requirements-dev.lock
Installing dependencies
Resolved 14 packages in 12ms
error: Failed to prepare distributions
  Caused by: Failed to fetch wheel: pyproject @ file:///C:/Users/inasa/Desktop/pyproject
  Caused by: Failed to create temporary virtualenv
  Caused by: Could not find a suitable Python executable for the virtual environment based on the interpreter: C:\Users\inasa\.rye\py\[email protected]\python.exe
error: Installation of dependencies failed in venv at C:\Users\inasa\Desktop\pyproject\.venv. uv exited with status: exit code: 2

But rye show can output the information correctly.

❯ rye show
project: pyproject
path: C:\Users\inasa\Desktop\pyproject
venv: C:\Users\inasa\Desktop\pyproject\.venv
target python: 3.8
venv python: [email protected]
virtual: false
configured sources:
  default (index: https://pypi.org/simple/)

But there are no issues with newly created projects.

I tried to delete .venv and then run rye sync, but there was still no change.

Expected Result

❯ rye sync
Reusing already existing virtualenv
Generating production lockfile: C:\Users\inasa\Desktop\pyproject2\requirements.lock
Generating dev lockfile: C:\Users\inasa\Desktop\pyproject2\requirements-dev.lock
Installing dependencies
Resolved 1 package in 6ms
Audited 1 package in 0.37ms
Done!

Actual Result

❯ rye sync
Reusing already existing virtualenv
Generating production lockfile: C:\Users\92867\Desktop\pyproject\requirements.lock
Generating dev lockfile: C:\Users\92867\Desktop\pyproject\requirements-dev.lock
Installing dependencies
Resolved 14 packages in 13ms
error: Failed to prepare distributions                                                                                                                                 
  Caused by: Failed to fetch wheel: pyproject @ file:///C:/Users/92867/Desktop/pyproject
  Caused by: Failed to create temporary virtualenv
  Caused by: Could not find a suitable Python executable for the virtual environment based on the interpreter: C:\Users\92867\.rye\py\[email protected]\python.exe        
error: Installation of dependencies failed in venv at C:\Users\92867\Desktop\pyproject\.venv. uv exited with status: exit code: 2

Version Info

❯ rye --version
rye 0.39.0
commit: 0.39.0 (bf3ccf818 2024-08-21)
platform: windows (x86_64)
self-python: [email protected]
symlink support: false
uv enabled: true

Stacktrace

No response

@lorenzogatti
Copy link

Where is "[email protected]", which evidently doesn't exist any more after uninstalling Rye, referenced in the files of your project? Do you want to download [email protected] as a "toolchain" or upgrade the project to the already available [email protected] of the new Rye installation?

@Inasayang
Copy link
Author

upgrade the project to the already available [email protected] of the new Rye installation. How to do this?

@bluss
Copy link
Contributor

bluss commented Aug 25, 2024

I would try the following:

rye pin 3.12
rye sync -f

Using -f on sync will delete the old .venv instead of trying to use it, so it needs to reinstall everything.

@Inasayang
Copy link
Author

When I execute rye sync -f, the following error occurs:

❯ rye sync -f 
error: failed to delete existing virtualenv (at 'C:\Users\inasa\Desktop\pyproject\.venv')

Caused by:
    Access is denied. (os error 5)

Running the cmd with administrator privileges also results in the same error.

But when I manually delete the .venv and then execute rye sync -f, it works.

@Inasayang
Copy link
Author

When I open it again, it doesn't work.

pyproject on  main [?] is 📦 v0.1.0 via 🐍 v3.12.5 (pyproject) 
❯ rye pin 3.12
pinned 3.12.5 in C:\Users\inasa\Desktop\pyproject\.python-version

pyproject on  main [?] is 📦 v0.1.0 via 🐍 v3.12.5 (pyproject) 
❯ rye sync -f 
Initializing new virtualenv in C:\Users\inasa\Desktop\pyproject\.venv
Python version: [email protected]
Generating production lockfile: C:\Users\inasa\Desktop\pyproject\requirements.lock
Generating dev lockfile: C:\Users\inasa\Desktop\pyproject\requirements-dev.lock
Installing dependencies
Resolved 14 packages in 13ms
error: Failed to prepare distributions
  Caused by: Failed to fetch wheel: pyproject @ file:///C:/Users/inasa/Desktop/pyproject
  Caused by: Failed to create temporary virtualenv
  Caused by: Could not find a suitable Python executable for the virtual environment based on the interpreter: C:\Users\inasa\.rye\py\[email protected]\python.exe
error: Installation of dependencies failed in venv at C:\Users\inasa\Desktop\pyproject\.venv. uv exited with status: exit code: 2

@bluss
Copy link
Contributor

bluss commented Aug 26, 2024

Do you have any .python-version or .python-versions files in this directory or any above? Look everywhere :)

@Inasayang
Copy link
Author

image

@lumina37
Copy link

I also met the same issue, here's the log

  Caused by: Failed to create temporary virtualenv
  Caused by: Could not find a suitable Python executable for the virtual environment based on the interpreter: C:\Users\Administrator\.rye\py\[email protected]\python.exe

the temporary solution is rye fetch 3.12.3. I wonder why my rye requires 3.12.3 to operate everything?

@Inasayang
Copy link
Author

Inasayang commented Aug 30, 2024

the environment variables

RYE_HOME=D:\rye\bin
RYE_TOOLCHAIN=D:\rye\toolchain

Always look in the C:\Users\inasa\.rye directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants