LoginSignup
0
0

`rye sync`に失敗する(Windows 11、 x86_64) Ryeの環境構築

Posted at

現時点(2024/04/25)で未解決です。同一症状で解決した方がいれば教えて下さい。

Rye

Rust製のPython用パッケージマネージャ。Documentを読んだ感じRustと同じような開発体験っぽかったのでやってみることに

環境構築

インストーラのダウンロード

公式サイトに記載されているように自分のWindowsのBitに合わせてインストーラをダウンロードする。
64bit版の方をインストール。

インストール

シェルで対話モードになるのでお好みで設定をする(バージョン指定だったり、Pythonの細かいことは知らないので割愛)

プロジェクトを作成

rye init --script my-project
cd my-project

仮想環境の作成

Ryeは基本仮想環境を作ってそこでPythonを実行するので、初回はその環境を作成する必要がある。
なのでバージョンの指定と環境作成のコマンドを実行

rye sync

これで実行できる!!......あれ?

rye syncがエラーで終了、よくわからんので詳細(--verbose)もつけて再実行

Using Python 3.10.14 interpreter at: C:\Users\raiga\.rye\py\cpython@3.10.14\python.exe
Creating virtualenv at: .venv
Activate with: .venv\Scripts\activate
Generating production lockfile: C:\Users\raiga\dev\hoge\requirements.lock
error: Failed to build editables
  Caused by: Failed to build editable: `file:///C:/Users/raiga/dev/hoge`
  Caused by: Build backend failed to determine extra requires with `build_editable()` with exit code: 1
--- stdout:

--- stderr:
Python path configuration:
  PYTHONHOME = 'C:\Users\raiga\AppData\Local\Programs\Python\Python311'
  PYTHONPATH = 'C:\Users\raiga\.rye\py\cpython@3.12.3\Lib\site-packages'
  program name = 'C:\Users\raiga\.rye\py\cpython@3.10.14\python.exe'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = 'C:\\Users\\raiga\\.rye\\py\\cpython@3.10.14\\python.exe'
  sys.base_prefix = 'C:\\Users\\raiga\\AppData\\Local\\Programs\\Python\\Python311'
  sys.base_exec_prefix = 'C:\\Users\\raiga\\AppData\\Local\\Programs\\Python\\Python311'
  sys.platlibdir = 'lib'
  sys.executable = 'C:\\Users\\raiga\\AppData\\Local\\uv\\cache\\.tmpDAS4F9\\.venv\\Scripts\\python.exe'
  sys.prefix = 'C:\\Users\\raiga\\AppData\\Local\\Programs\\Python\\Python311'
  sys.exec_prefix = 'C:\\Users\\raiga\\AppData\\Local\\Programs\\Python\\Python311'
  sys.path = [
    'C:\\Users\\raiga\\.rye\\py\\cpython@3.12.3\\Lib\\site-packages',
    'C:\\Users\\raiga\\.rye\\py\\cpython@3.10.14\\python310.zip',
    'C:\\Users\\raiga\\AppData\\Local\\Programs\\Python\\Python311\\DLLs',
    'C:\\Users\\raiga\\AppData\\Local\\Programs\\Python\\Python311\\lib',
    'C:\\Users\\raiga\\.rye\\py\\cpython@3.10.14',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00003a38 (most recent call first):
  <no Python frame>
---
error: could not write production lockfile for project

Caused by:
    Failed to run uv compile C:\Users\raiga\AppData\Local\Temp\.tmp2CICkh\requirements.txt. uv exited with status: exit code: 2

結論 → WSLでLinuxの手順をためして成功した

いろいろ試してみたり、GitHubのリポジトリのIssueとPull Requestとかで情報をあつめたものの、解決できなかった。

Pythonの動機自体課題を終わらせたいくらいのもちべなので、Windows環境にこだわらずWSLでうまくいかないか試してみたところうまくいったのでOK!!()

解決のために挑戦したこと

ForumやIssueにかかれていたことを適当に。

  • スーパーユーザでの実行はサポートされていない
    • →そもそもローカルユーザで実行している
  • 環境変数は設定した?
    • stderrのとおり設定しても落ちてる
  • Pythonのバージョンがサポートされていない?
    • 公式リポジトリのPRにもPython11移行サポートのPRがあることを確認したがMerge済みである。
  • :saikidou-ha-subetewo-kaiketsu-suru:
    • 再起動とShift押下+シャットダウンも試したが改善せず

ほかに有力な解決策があると諸事情でWSL環境使えないWindowsユーザのためになるかも?
(......そもそもWin11のサポートはしてないとかだったら意味ないけどね!!)

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0