pytorch - 💡(How to fix) Fix `python -m pip install --no-build-isolation -v -e .` fails to begin because of `SyntaxError` [4 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#179197Fetched 2026-04-08 02:32:54
View on GitHub
Comments
4
Participants
2
Timeline
15
Reactions
0
Timeline (top)
labeled ×5commented ×4mentioned ×2subscribed ×2

Error Message

(.venv) yalihupokn@zoqu-endiman:~/Repositories/PT/pytorch$ python -m pip install --no-build-isolation -v -e . Using pip 25.1.1 from /home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip (python 3.14) Obtaining file:///home/yalihupokn/Repositories/PT/pytorch Running command Checking if build backend supports build_editable Checking if build backend supports build_editable ... done Running command Preparing editable metadata (pyproject.toml) Traceback (most recent call last): File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module> main() ~~~~^^ File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) ~~~~^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 209, in prepare_metadata_for_build_editable return hook(metadata_directory, config_settings) File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/setuptools/build_meta.py", line 478, in prepare_metadata_for_build_editable return self.prepare_metadata_for_build_wheel( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ metadata_directory, config_settings ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/setuptools/build_meta.py", line 374, in prepare_metadata_for_build_wheel self.run_setup() ~~~~~~~~~~~~~~^^ File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/setuptools/build_meta.py", line 317, in run_setup exec(code, locals()) ~~~~^^^^^^^^^^^^^^^^ File "<string>", line 246 SyntaxError: from future imports must occur at the beginning of the file error: subprocess-exited-with-error

× Preparing editable metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. full command: /home/yalihupokn/Repositories/PT/pytorch/.venv/bin/python /home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_editable /tmp/tmpoo1k9mgc cwd: /home/yalihupokn/Repositories/PT/pytorch Preparing editable metadata (pyproject.toml) ... error

[notice] A new release of pip is available: 25.1.1 -> 26.0.1 [notice] To update, run: pip install --upgrade pip error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

Fix Action

Fix / Workaround

CPU: Architecture: aarch64 CPU op-mode(s): 64-bit Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Vendor ID: Apple Model name: Blizzard-M2 Model: 0 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 Stepping: 0x1 Frequency boost: disabled CPU(s) scaling MHz: 25% CPU max MHz: 2424.0000 CPU min MHz: 600.0000 BogoMIPS: 48.00 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint i8mm bf16 bti ecv Model name: Avalanche-M2 Model: 0 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 Stepping: 0x1 CPU(s) scaling MHz: 45% CPU max MHz: 3204.0000 CPU min MHz: 660.0000 BogoMIPS: 48.00 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint i8mm bf16 bti ecv L1d cache: 768 KiB (8 instances) L1i cache: 1.3 MiB (8 instances) L2 cache: 20 MiB (2 instances) NUMA node(s): 1 NUMA node0 CPU(s): 0-7 Vulnerability Gather data sampling: Not affected Vulnerability Ghostwrite: Not affected Vulnerability Indirect target selection: Not affected Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Old microcode: Not affected Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; __user pointer sanitization Vulnerability Spectre v2: Mitigation; CSV2, but not BHB Vulnerability Srbds: Not affected Vulnerability Tsa: Not affected Vulnerability Tsx async abort: Not affected Vulnerability Vmscape: Not affected

Code Example

git clone https://github.com/pytorch/pytorch/
cd pytorch

python -m venv .venv
source .venv/bin/activate

export CMAKE_PREFIX_PATH="${VIRTUAL_ENV}:${CMAKE_PREFIX_PATH}"

pip install --group dev

python -m pip install --no-build-isolation -v -e .

---

(.venv) yalihupokn@zoqu-endiman:~/Repositories/PT/pytorch$ python -m pip install --no-build-isolation -v -e .
Using pip 25.1.1 from /home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip (python 3.14)
Obtaining file:///home/yalihupokn/Repositories/PT/pytorch
  Running command Checking if build backend supports build_editable
  Checking if build backend supports build_editable ... done
  Running command Preparing editable metadata (pyproject.toml)
  Traceback (most recent call last):
    File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
      main()
      ~~~~^^
    File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
      json_out["return_val"] = hook(**hook_input["kwargs"])
                               ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 209, in prepare_metadata_for_build_editable
      return hook(metadata_directory, config_settings)
    File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/setuptools/build_meta.py", line 478, in prepare_metadata_for_build_editable
      return self.prepare_metadata_for_build_wheel(
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
          metadata_directory, config_settings
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      )
      ^
    File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/setuptools/build_meta.py", line 374, in prepare_metadata_for_build_wheel
      self.run_setup()
      ~~~~~~~~~~~~~~^^
    File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/setuptools/build_meta.py", line 317, in run_setup
      exec(code, locals())
      ~~~~^^^^^^^^^^^^^^^^
    File "<string>", line 246
  SyntaxError: from __future__ imports must occur at the beginning of the file
  error: subprocess-exited-with-error
  
  × Preparing editable metadata (pyproject.toml) did not run successfully.
   exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /home/yalihupokn/Repositories/PT/pytorch/.venv/bin/python /home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_editable /tmp/tmpoo1k9mgc
  cwd: /home/yalihupokn/Repositories/PT/pytorch
  Preparing editable metadata (pyproject.toml) ... error

[notice] A new release of pip is available: 25.1.1 -> 26.0.1
[notice] To update, run: pip install --upgrade pip
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

---

(.venv) yalihupokn@zoqu-endiman:~/Repositories/PT/pytorch$ curl -sL https://raw.githubusercontent.com/pytorch/pytorch/main/torch/utils/collect_env.py | python
Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Fedora Linux Asahi Remix 43 (KDE Plasma Desktop Edition) (aarch64)
GCC version: (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7)
Clang version: 21.1.8 (Fedora 21.1.8-4.fc43)
CMake version: version 4.3.1
Libc version: glibc-2.42

Python version: 3.14.3 (main, Mar 26 2026, 00:00:00) [GCC 15.2.1 20260123 (Red Hat 15.2.1-7)] (64-bit runtime)
Python platform: Linux-6.18.15-400.asahi.fc43.aarch64+16k-aarch64-with-glibc2.42
Is CUDA available: N/A
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
Is XPU available: N/A
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A
Caching allocator config: N/A

CPU:
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  8
On-line CPU(s) list:                     0-7
Vendor ID:                               Apple
Model name:                              Blizzard-M2
Model:                                   0
Thread(s) per core:                      1
Core(s) per socket:                      4
Socket(s):                               1
Stepping:                                0x1
Frequency boost:                         disabled
CPU(s) scaling MHz:                      25%
CPU max MHz:                             2424.0000
CPU min MHz:                             600.0000
BogoMIPS:                                48.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint i8mm bf16 bti ecv
Model name:                              Avalanche-M2
Model:                                   0
Thread(s) per core:                      1
Core(s) per socket:                      4
Socket(s):                               1
Stepping:                                0x1
CPU(s) scaling MHz:                      45%
CPU max MHz:                             3204.0000
CPU min MHz:                             660.0000
BogoMIPS:                                48.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint i8mm bf16 bti ecv
L1d cache:                               768 KiB (8 instances)
L1i cache:                               1.3 MiB (8 instances)
L2 cache:                                20 MiB (2 instances)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-7
Vulnerability Gather data sampling:      Not affected
Vulnerability Ghostwrite:                Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Old microcode:             Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, but not BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Versions of relevant libraries:
[pip3] numpy==2.4.4
[pip3] optree==0.19.0
[conda] Could not collect
(.venv) yalihupokn@zoqu-endiman:~/Repositories/PT/pytorch$
RAW_BUFFERClick to expand / collapse

🐛 Describe the bug

git clone https://github.com/pytorch/pytorch/
cd pytorch

python -m venv .venv
source .venv/bin/activate

export CMAKE_PREFIX_PATH="${VIRTUAL_ENV}:${CMAKE_PREFIX_PATH}"

pip install --group dev

python -m pip install --no-build-isolation -v -e .
<details> <summary> CLI error </summary>
(.venv) yalihupokn@zoqu-endiman:~/Repositories/PT/pytorch$ python -m pip install --no-build-isolation -v -e .
Using pip 25.1.1 from /home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip (python 3.14)
Obtaining file:///home/yalihupokn/Repositories/PT/pytorch
  Running command Checking if build backend supports build_editable
  Checking if build backend supports build_editable ... done
  Running command Preparing editable metadata (pyproject.toml)
  Traceback (most recent call last):
    File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
      main()
      ~~~~^^
    File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
      json_out["return_val"] = hook(**hook_input["kwargs"])
                               ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 209, in prepare_metadata_for_build_editable
      return hook(metadata_directory, config_settings)
    File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/setuptools/build_meta.py", line 478, in prepare_metadata_for_build_editable
      return self.prepare_metadata_for_build_wheel(
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
          metadata_directory, config_settings
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      )
      ^
    File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/setuptools/build_meta.py", line 374, in prepare_metadata_for_build_wheel
      self.run_setup()
      ~~~~~~~~~~~~~~^^
    File "/home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/setuptools/build_meta.py", line 317, in run_setup
      exec(code, locals())
      ~~~~^^^^^^^^^^^^^^^^
    File "<string>", line 246
  SyntaxError: from __future__ imports must occur at the beginning of the file
  error: subprocess-exited-with-error
  
  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /home/yalihupokn/Repositories/PT/pytorch/.venv/bin/python /home/yalihupokn/Repositories/PT/pytorch/.venv/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_editable /tmp/tmpoo1k9mgc
  cwd: /home/yalihupokn/Repositories/PT/pytorch
  Preparing editable metadata (pyproject.toml) ... error

[notice] A new release of pip is available: 25.1.1 -> 26.0.1
[notice] To update, run: pip install --upgrade pip
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
</details>

Versions

(.venv) yalihupokn@zoqu-endiman:~/Repositories/PT/pytorch$ curl -sL https://raw.githubusercontent.com/pytorch/pytorch/main/torch/utils/collect_env.py | python
Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Fedora Linux Asahi Remix 43 (KDE Plasma Desktop Edition) (aarch64)
GCC version: (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7)
Clang version: 21.1.8 (Fedora 21.1.8-4.fc43)
CMake version: version 4.3.1
Libc version: glibc-2.42

Python version: 3.14.3 (main, Mar 26 2026, 00:00:00) [GCC 15.2.1 20260123 (Red Hat 15.2.1-7)] (64-bit runtime)
Python platform: Linux-6.18.15-400.asahi.fc43.aarch64+16k-aarch64-with-glibc2.42
Is CUDA available: N/A
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
Is XPU available: N/A
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A
Caching allocator config: N/A

CPU:
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  8
On-line CPU(s) list:                     0-7
Vendor ID:                               Apple
Model name:                              Blizzard-M2
Model:                                   0
Thread(s) per core:                      1
Core(s) per socket:                      4
Socket(s):                               1
Stepping:                                0x1
Frequency boost:                         disabled
CPU(s) scaling MHz:                      25%
CPU max MHz:                             2424.0000
CPU min MHz:                             600.0000
BogoMIPS:                                48.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint i8mm bf16 bti ecv
Model name:                              Avalanche-M2
Model:                                   0
Thread(s) per core:                      1
Core(s) per socket:                      4
Socket(s):                               1
Stepping:                                0x1
CPU(s) scaling MHz:                      45%
CPU max MHz:                             3204.0000
CPU min MHz:                             660.0000
BogoMIPS:                                48.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint i8mm bf16 bti ecv
L1d cache:                               768 KiB (8 instances)
L1i cache:                               1.3 MiB (8 instances)
L2 cache:                                20 MiB (2 instances)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-7
Vulnerability Gather data sampling:      Not affected
Vulnerability Ghostwrite:                Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Old microcode:             Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, but not BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Versions of relevant libraries:
[pip3] numpy==2.4.4
[pip3] optree==0.19.0
[conda] Could not collect
(.venv) yalihupokn@zoqu-endiman:~/Repositories/PT/pytorch$

cc @malfet @seemethere

extent analysis

TL;DR

The issue is likely due to a syntax error in one of the Python files, specifically a from __future__ import not being at the beginning of the file, and can be fixed by identifying and correcting this error.

Guidance

  • Check the Python files in the PyTorch repository for any from __future__ imports that are not at the beginning of the file.
  • Verify that the Python version being used (3.14.3) is compatible with the PyTorch repository.
  • Run the command python -m pip install --no-build-isolation -v -e . with the --verbose flag to get more detailed output and identify the specific file causing the error.
  • Consider updating pip to the latest version (26.0.1) as suggested in the error message.

Example

No specific code snippet can be provided without knowing the exact file causing the error, but the correction would involve moving the from __future__ import to the top of the file, like so:

from __future__ import absolute_import
# rest of the code

Notes

The error message suggests that the issue is not with pip, but with the package itself, so updating pip may not resolve the issue. The Python version and PyTorch repository compatibility should be verified.

Recommendation

Apply workaround: Identify and correct the from __future__ import error in the PyTorch repository. This is the most likely cause of the issue and should be addressed first before considering other potential solutions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING