Search code examples
chocolatey

Chocolatey: Why did it not find my pre-installed Python on my laptop?


I have the entire anaconda suite and python in my computer. However, when I am downloading node.js and chocolatey, the following error code came out and started installing python. Can anyone tell me why?

The error code is:

Creating Chocolatey folders if they do not already exist.

WARNING: You can safely ignore errors related to missing log files when
  upgrading from a version of Chocolatey less than 0.9.9.
  'Batch file could not be found' is also safe to ignore.
  'The system cannot find the file specified' - also safe.
chocolatey.nupkg file not installed in lib.
 Attempting to locate it from bootstrapper.
PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
WARNING: Not setting tab completion: Profile file does not exist at
'C:\Users\futur\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
 first prior to using choco.
Ensuring Chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder
Chocolatey v0.12.1
Upgrading the following packages:
python;visualstudio2019-workload-vctools
By upgrading, you accept licenses for the packages.
python is not installed. Installing...
Progress: Downloading python3 3.10.3... 100%
Progress: Downloading python3 3.10.3... 100%
Progress: Downloading vcredist2015 14.0.24215.20170201... 100%
Progress: Downloading vcredist2015 14.0.24215.20170201... 100%
Progress: Downloading vcredist140 14.31.31103... 100%

Thanks so much.


Solution

  • You need Chocolatey Pro for the package to detect that the software was previously installed via other means.


    With the free version, if you know the software is already installed and you want future updates to be managed by Chocolatey, use the -n / --skip-powershell parameter to choco install to tell Chocolatey not to run the package's embedded chocolateyInstall.ps1 script. This will essentially download the package and skip the actual installation, while allowing future versions to be installed as you would expect on upgrade.

    Note that --skip-powershell:

    • Does not prevent auto-uninstall from happening during choco uninstall (use --skip-autouninstall alongside --skip-powershell for this)
    • You should install packages which you want to skip the installation script in a separate command from other packages you do want to install normally, as the specified parameters get passed to every specified package install.
    • This is not a common scenario, but some packages may have issues post-import with upgrading, particularly if the package does not proxy the installation of an EXE, MSI, or MSU installer. Some package scripts may also do some setup or install in a different place than your prior installed version. In these cases you may need to first uninstall the software before installing with Chocolatey, rather than skipping the install script.
      • This may signal a poorly-created package, but there are some scenarios where the package maintainer has no other choice. I've created some packages that must manually manage shims, which requires the install script to run.