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

[Bug]: Python 3.12.4 issues errors while installing #5934

Open
3 tasks done
babysnakes opened this issue Jun 22, 2024 · 7 comments
Open
3 tasks done

[Bug]: Python 3.12.4 issues errors while installing #5934

babysnakes opened this issue Jun 22, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@babysnakes
Copy link

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues/PRs to ensure it has not already been reported or fixed.
  • I have verified that I am using the latest version of Scoop and corresponding bucket.

Package Name

python

Expected/Current Behaviour

Expected to be installed without errors. When installing I got the following output:

 pwsh  scoop install python
Installing 'python' (3.12.4) [64bit] from 'main' bucket
Loading python-3.12.4-amd64.exe from cache
Checking hash of python-3.12.4-amd64.exe ... ok.
Running pre_install script...
Running installer script...
Linking ~\scoop\apps\python\current => ~\scoop\apps\python\3.12.4
Creating shim for 'python3'.
Creating shim for 'idle'.
Creating shim for 'idle3'.
Adding ~\scoop\apps\python\current\Scripts to your path.
Adding ~\scoop\apps\python\current to your path.
Persisting Scripts
Persisting Lib\site-packages
Running post_install script...
  WARNING: Failed to write executable - trying to use .deleteme logic
ERROR: Could not install packages due to an OSError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\haim\\scoop\\apps\\python\\current\\Scripts\\pip.exe' -> 'C:\\Users\\haim\\scoop\\apps\\python\\current\\Scripts\\pip.exe.deleteme'

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\haim\scoop\apps\python\current\Lib\ensurepip\__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
             ^^^^^^^^^^^^^^^^^
  File "C:\Users\haim\scoop\apps\python\current\Lib\ensurepip\__init__.py", line 284, in _main
    return _bootstrap(
           ^^^^^^^^^^^
  File "C:\Users\haim\scoop\apps\python\current\Lib\ensurepip\__init__.py", line 200, in _bootstrap
    return _run_pip([*args, *_PACKAGE_NAMES], additional_paths)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\haim\scoop\apps\python\current\Lib\ensurepip\__init__.py", line 101, in _run_pip
    return subprocess.run(cmd, check=True).returncode
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\haim\scoop\apps\python\current\Lib\subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['C:\\Users\\haim\\scoop\\apps\\python\\current\\python.exe', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'C:\\\\Users\\\\haim\\\\AppData\\\\Local\\\\Temp\\\\tmpiet6ipmb\\\\pip-24.0-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'C:\\\\Users\\\\haim\\\\AppData\\\\Local\\\\Temp\\\\tmpiet6ipmb\', \'--upgrade\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.

'python' (3.12.4) was installed successfully!
Notes
-----
Allow applications and third-party installers to find python by running:
"C:\Users\haim\scoop\apps\python\current\install-pep-514.reg"

While I do have python executable in path I'm not sure what's not working 🙁 (I'm not really a python developer - just used it once for something simple).

Steps to Reproduce

PS> scoop install python

Possible Solution

no idea 🙂

Scoop and Buckets Version

pwsh  scoop --version
Current Scoop version:
d337bb1f (HEAD -> master, tag: v0.4.2, origin/master, origin/HEAD) chore(release): Bump to version 0.4.2 (#5964)

'main' bucket:
9e3297c22 (HEAD -> master, origin/master, origin/HEAD) pulumi: Update to version 3.121.0

'extras' bucket:
7562736b7 (HEAD -> master, origin/master, origin/HEAD) netron: Update to version 7.7.4

'sysinternals' bucket:
56aa57d (HEAD -> main, origin/main, origin/HEAD) sysinternals-suite: Update to version 2024.06.20

'java' bucket:
2382f57e (HEAD -> master, origin/master, origin/HEAD) intellij-jbr17: Update to version 17.0.11-b1312.2

'kdash-bucket' bucket:
b5202b6 (HEAD -> main, origin/main, origin/HEAD) Update package for KDash release v0.6.0

Scoop Config

pwsh  scoop config

last_update         scoop_branch scoop_repo                              use_lessmsi
-----------         ------------ ----------                              -----------
22/06/2024 10:20:32 master       https://github.com/ScoopInstaller/Scoop       False

PowerShell Version

pwsh  $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.3
PSEdition                      Core
GitCommitId                    7.4.3
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Additional Softwares

No response

@babysnakes babysnakes added the bug Something isn't working label Jun 22, 2024
@brian6932
Copy link
Contributor

brian6932 commented Aug 8, 2024

I had the same problem installing [email protected], the following worked/fixed it for me:

Remove-Item -Recurse -Force "$(scoop prefix python)/Lib/site-packages/pip*"
py -m ensurepip --upgrade --no-warn-script-location
scoop update python -f

@juliomaranhao
Copy link

juliomaranhao commented Aug 8, 2024

Yes, it's annoying.
The post_install command python -E -s -m ensurepip -U --default-pip some times fails.

I deleted all pip files/folders from python persist folder:
/Lib/site-packages/pip*
/Scripts/pip*

Then scoop install python works.

This hint might be written in the notes.

UPDATE: please ignore above text. It does not fix the root cause. See comment from @mark05e bellow (true fix).

@babysnakes
Copy link
Author

Thank you both. The deletion of Lib\site-packages\pip* did the trick. The update today to 3.12.5 went smooth 🥳.

@L1ttleFlyyy
Copy link

Hitting the same issue with python 3.13.0 today. Deleting Lib\site-packages\pip* did the trick

@mark05e
Copy link

mark05e commented Oct 10, 2024

Alternate solution
From #5090 (comment)

Create an empty file called placeholder.txt in %USERPROFILE%\scoop\apps\python\current\scripts\. (Name and contents don't matter, it only matters that the directory contains something other than pip's own scripts.)


Create empty text file using CMD
type NUL > %USERPROFILE%\scoop\apps\python\current\scripts\placeholder.txt

or Create empty text file using Powershell
New-Item -Path $Env:USERPROFILE\scoop\apps\python\current\scripts\ -Name placeholder.txt -ItemType File -Force


After that, running the post install command does not return any errors.
python -E -s -m ensurepip -U --default-pip

@juliomaranhao
Copy link

Alternate solution From #5090 (comment)

YES!! This is THE fix.

cesarcoatl added a commit to coatl-dev/scoop-coatl-dev that referenced this issue Jan 28, 2025
this fixes a problem where pip fails to upgrade

Refs: ScoopInstaller/Main#5934
cesarcoatl added a commit to coatl-dev/scoop-coatl-dev that referenced this issue Jan 28, 2025
this fixes a problem where pip fails to upgrade

Refs: ScoopInstaller/Main#5934
@Zacharia2
Copy link
Contributor

me too!!!

Installing 'python' (3.13.1) [64bit] from 'main' bucket
python-3.13.1-amd64.exe (27.4 MB) [===========================================================================] 100%
Checking hash of python-3.13.1-amd64.exe ... ok.
Running pre_install script...Get-Content : 找不到路径D:\Software\Scoop\buckets\scoop-cn\scripts\python\install-pep-514.reg,因为该路径不存在。
所在位置 行:11 字符: 16
+     $content = Get-Content "$bucketsdir\scoop-cn\scripts\python\$_"
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\Software\Sco...all-pep-514.reg:String) [Get-Content], ItemNotFoundEx
   ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

不能对 Null 值表达式调用方法。
所在位置 行:12 字符: 5
+     $content = $content.Replace('$py_root', $py_root)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

不能对 Null 值表达式调用方法。
所在位置 行:13 字符: 5
+     $content = $content.Replace('$py_version', $py_version)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

不能对 Null 值表达式调用方法。
所在位置 行:14 字符: 5
+     $content = $content.Replace('$py_fullversion', $version)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

不能对 Null 值表达式调用方法。
所在位置 行:15 字符: 5
+     $content = $content.Replace('$py_cleanVersion', $version -replace ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

不能对 Null 值表达式调用方法。
所在位置 行:16 字符: 5
+     $content = $content.Replace('$py_archLabel', $py_archLabel)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

不能对 Null 值表达式调用方法。
所在位置 行:17 字符: 5
+     $content = $content.Replace('$py_arch', "$bit")
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Get-Content : 找不到路径D:\Software\Scoop\buckets\scoop-cn\scripts\python\uninstall-pep-514.reg,因为该路径不存在。
所在位置 行:11 字符: 16
+     $content = Get-Content "$bucketsdir\scoop-cn\scripts\python\$_"
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\Software\Sco...all-pep-514.reg:String) [Get-Content], ItemNotFoundEx
   ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

不能对 Null 值表达式调用方法。
所在位置 行:12 字符: 5
+     $content = $content.Replace('$py_root', $py_root)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

不能对 Null 值表达式调用方法。
所在位置 行:13 字符: 5
+     $content = $content.Replace('$py_version', $py_version)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

不能对 Null 值表达式调用方法。
所在位置 行:14 字符: 5
+     $content = $content.Replace('$py_fullversion', $version)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

不能对 Null 值表达式调用方法。
所在位置 行:15 字符: 5
+     $content = $content.Replace('$py_cleanVersion', $version -replace ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

不能对 Null 值表达式调用方法。
所在位置 行:16 字符: 5
+     $content = $content.Replace('$py_archLabel', $py_archLabel)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

不能对 Null 值表达式调用方法。
所在位置 行:17 字符: 5
+     $content = $content.Replace('$py_arch', "$bit")
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

done.
Running installer script...done.
Linking D:\Software\Scoop\apps\python\current => D:\Software\Scoop\apps\python\3.13.1
Creating shim for 'python3'.
Creating shim for 'idle'.
Creating shim for 'idle3'.
Adding D:\Software\Scoop\apps\python\current\Scripts to your path.
Adding D:\Software\Scoop\apps\python\current to your path.
Persisting Scripts
Persisting Lib\site-packages
Running post_install script...  WARNING: Failed to write executable - trying to use .deleteme logic
ERROR: Could not install packages due to an OSError: [WinError 3] 系统找不到指定的路径。: 'D:\\Software\\Scoop\\apps\\python\\current\\Scripts\\pip.exe' -> 'D:\\Software\\Scoop\\apps\\python\\current\\Scripts\\pip.exe.deleteme'

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "D:\Software\Scoop\apps\python\current\Lib\ensurepip\__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
             ~~~~~~~~~~~~~~~^^
  File "D:\Software\Scoop\apps\python\current\Lib\ensurepip\__init__.py", line 257, in _main
    return _bootstrap(
        root=args.root,
    ...<4 lines>...
        default_pip=args.default_pip,
    )
  File "D:\Software\Scoop\apps\python\current\Lib\ensurepip\__init__.py", line 172, in _bootstrap
    return _run_pip([*args, "pip"], [os.fsdecode(tmp_wheel_path)])
  File "D:\Software\Scoop\apps\python\current\Lib\ensurepip\__init__.py", line 87, in _run_pip
    return subprocess.run(cmd, check=True).returncode
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "D:\Software\Scoop\apps\python\current\Lib\subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['D:\\Software\\Scoop\\apps\\python\\current\\python.exe', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'C:\\\\Users\\\\Snowy\\\\AppData\\\\Local\\\\Temp\\\\tmpxi7mn18q\\\\pip-24.3.1-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'C:\\\\Users\\\\Snowy\\\\AppData\\\\Local\\\\Temp\\\\tmpxi7mn18q\', \'--upgrade\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.

done.
'python' (3.13.1) was installed successfully!
Notes
-----
Allow applications and third-party installers to find python by running:
"D:\Software\Scoop\apps\python\current\install-pep-514.reg"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants