rye
rye copied to clipboard
ImportError: cannot import name 'DEV_PKGS' from 'pip._internal.commands.freeze'
Steps to Reproduce
I have the following error when trying rye sync on last rye version on my pc
C:\Users\xxx\xx\x>rye sync
Expected Result
sync all normaly
Actual Result
Reusing already existing virtualenv
Generating production lockfile: C:\Users\xxx\xx\x\requirements.lock
WARNING: the legacy dependency resolver is deprecated and will be removed in future versions of pip-tools. The default resolver will be changed to 'backtracking' in pip-tools 7.0.0. Specify --resolver=backtracking to silence this warning.
Generating dev lockfile: C:\Users\xxx\xx\x\requirements-dev.lock
WARNING: the legacy dependency resolver is deprecated and will be removed in future versions of pip-tools. The default resolver will be changed to 'backtracking' in pip-tools 7.0.0. Specify --resolver=backtracking to silence this warning.
Installing dependencies
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\xxx\.rye\pip-tools\[email protected]\Scripts\pip-sync.exe\__main__.py", line 4, in <module>
File "C:\Users\xxx\.rye\pip-tools\[email protected]\Lib\site-packages\piptools\scripts\sync.py", line 16, in <module>
from .. import sync
File "C:\Users\xxx\.rye\pip-tools\[email protected]\Lib\site-packages\piptools\sync.py", line 11, in <module>
from pip._internal.commands.freeze import DEV_PKGS
ImportError: cannot import name 'DEV_PKGS' from 'pip._internal.commands.freeze' (C:\Users\xxx\AppData\Local\Temp\.tmpu5eIsy\pip\_internal\commands\freeze.py)
error: Installation of dependencies failed
Version Info
rye version infos :
rye 0.27.0
commit: 0.27.0 (43ee4fce0 2024-02-26)
platform: windows (x86_64)
self-python: [email protected]
symlink support: true
uv enabled: false
Stacktrace
No response
I couldn't reproduce this on my windows machine with 0.28.0 (main
).
❯ rye --version
rye 0.28.0
commit: 0.27.0+8 (2111778b3 2024-02-28)
platform: windows (x86_64)
self-python: [email protected]
symlink support: false
uv enabled: false
I tried doing things like self installing it into my current environment, using a completely wiped home directory, using [email protected] and 3.11 internally, and pinning different versions for the project.
Are you able to reproduce this in a different windows environment?
The warnings indicate it's using a very old pip tools version, is that a Windows thing? Rye should recreate C:\Users\xxx.rye\pip-tools\[email protected] if you remove it, so you could try that and see what happens.
I used pip 23.2 (when running into this error) and are now using pip 24.0.
@cnpryer I am not able to reproduce it in a different windows environment.
@bluss I remove [email protected]
but rye is not recreating it, I only have the following error msg :
C:\Users\xxx\xx\x\.venv\Scripts>rye sync
Reusing already existing virtualenv
Generating production lockfile: C:\Users\xxx\xx\x\requirements.lock
error: could not write production lockfile for project
Caused by:
0: unable to run pip-compile
1: The system cannot find the file specified. (os error 2)
@QuentinDstl Hm, ok that's confusing, not sure why it would happen like that. the intention was to remove exactly the C:\Users\xxx\.rye\pip-tools\[email protected] directory, and I can't see why that wouldn't trigger a reinstall of pip-tools (it does for me, platform: linux). Note it's about the pip-tools install which is separate from pip, separate version number etc.
same issue. related https://github.com/astral-sh/rye/issues/368
isn't uv
supposed to take over by now?
same issue. related #368
isn't
uv
supposed to take over by now?
got further by reinstalling my rye. got the new resolvers.
I will try to reinstall rye
I am using MacBook Pro 2023 (Apple M2 Max) and am experiencing a similar issue.
Version of rye
rye 0.28.0
commit: 0.28.0 (2024-03-07)
platform: macos (aarch64)
self-python: [email protected]
symlink support: true
uv enabled: false
Error message
rye sync
Reusing already existing virtualenv
Generating production lockfile: /Users/keita-koga/gitrepos/my-project/requirements.lock
WARNING: the legacy dependency resolver is deprecated and will be removed in future versions of pip-tools. The default resolver will be changed to 'backtracking' in pip-tools 7.0.0. Specify --resolver=backtracking to silence this warning.
Generating dev lockfile: /Users/keita-koga/gitrepos/my-project/requirements-dev.lock
WARNING: the legacy dependency resolver is deprecated and will be removed in future versions of pip-tools. The default resolver will be changed to 'backtracking' in pip-tools 7.0.0. Specify --resolver=backtracking to silence this warning.
Installing dependencies
Traceback (most recent call last):
File "/Users/keita-koga/.rye/pip-tools/[email protected]/bin/pip-sync", line 5, in <module>
from piptools.scripts.sync import cli
File "/Users/keita-koga/.rye/pip-tools/[email protected]/lib/python3.12/site-packages/piptools/scripts/sync.py", line 16, in <module>
from .. import sync
File "/Users/keita-koga/.rye/pip-tools/[email protected]/lib/python3.12/site-packages/piptools/sync.py", line 11, in <module>
from pip._internal.commands.freeze import DEV_PKGS
ImportError: cannot import name 'DEV_PKGS' from 'pip._internal.commands.freeze' (/var/folders/f7/rc26hcc55bvdqd3xxqw7yj6m0000gp/T/.tmpVLkRIq/pip/_internal/commands/freeze.py)
error: Installation of dependencies failed
zsh: exit 1 rye sync
I had the same error right after I updated from 0.27.0 to 0.28.0, but it worked by running the following command and reinstalling.
rm -r ~/.rye
@koei-kaji
Thank you! I solved it in the way you suggested👍.
Maybe fixed by #865? It ensures new pip-tools
I had the same error right after I updated from 0.27.0 to 0.28.0, but it worked by running the following command and reinstalling.
rm -r ~/.rye
Needed remove only ~/.rye/pip-tools
.
And need not reinstall rye.