ContinuumIO / anaconda-issues

Anaconda issue tracking
646 stars 220 forks source link

anaconda powershell prompt:FileNotFoundError-----conda-hook.ps1' #11933

Open qinchunfan opened 4 years ago

qinchunfan commented 4 years ago

When I try to start Anaconda Powershell Prompt it happend with an error

Actual Behavior

so how to deal this issue? conda version:4.8.2

Operating System: win10
conda info
``` PASTE OUTPUT HERE: ``` <# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "site-packages\conda\cli\main.py", line 138, in main File "site-packages\conda\activate.py", line 1093, in main File "site-packages\conda\activate.py", line 182, in execute File "site-packages\conda\activate.py", line 170, in hook FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\HP\\AppData\\Local\\Temp\\_MEI10962\\conda\\shell\\condabin\\conda-hook.ps1' `$ C:\Users\HP\anaconda3\_conda.exe shell.powershell hook` environment variables: CIO_TEST= CONDA_ROOT=C:\Users\HP\AppData\Local\Temp\_MEI10962 HOMEPATH=\Users\HP PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\Sys tem32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\HP \AppData\Local\Microsoft\WindowsApps;D:\software\alter13.0\modelsim_as e\win32aloem;D:\software\Microsoft VS Code\bin;C:\Users\HP\anaconda3\Scripts; PSMODULEPATH=C:\Users\HP\Documents\WindowsPowerShell\Modules;C:\Program Files\Windo wsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Module s PTSMINSTALLPATH=c:\Program Files\HP\HP ProtectTools Security Manager\Bin\ REQUESTS_CA_BUNDLE= SSL_CERT_FILE=C:\Users\HP\AppData\Local\Temp\_MEI10962\certifi\cacert.pem active environment : None user config file : C:\Users\HP\.condarc populated config files : conda version : 4.8.2 conda-build version : not installed python version : 3.7.6.final.0 virtual packages : base environment : C:\Users\HP\AppData\Local\Temp\_MEI10962 (read only) channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Users\HP\AppData\Local\Temp\_MEI10962\pkgs C:\Users\HP\.conda\pkgs C:\Users\HP\AppData\Local\conda\conda\pkgs envs directories : C:\Users\HP\.conda\envs C:\Users\HP\AppData\Local\Temp\_MEI10962\envs C:\Users\HP\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/4.8.2 requests/2.22.0 CPython/3.7.6 Windows/10 Windows/10.0.19041 administrator : False netrc file : None offline mode : False An unexpected error has occurred. Conda has prepared the above report. If submitted, this report will be used by core maintainers to improve future releases of conda. Would you like conda to send this report to the core maintainers?>
maphew commented 2 years ago

Same here. I'm using Miniconda3 installed via https://Scoop.sh.

Powershell console 1 (as Administrator):

scoop install miniconda3
conda install -n root -c pscondaenvs pscondaenvs

Start powershell console 2:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "site-packages\conda\cli\main.py", line 143, in main
      File "site-packages\conda\activate.py", line 1210, in main
      File "site-packages\conda\activate.py", line 178, in execute
      File "site-packages\conda\activate.py", line 166, in hook
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\matt\\AppData\\Local\\Temp\\_MEI279242\\conda\\shell\\condabin\\conda-hook.ps1'

...snip...

Suspicious that's it's looking for a file in env:$TEMP. The only conda-hook.ps1 files I see on my system are:

C:\Users\matt\scoop\apps\miniconda3\4.10.3\pkgs\conda-4.10.3-py39haa95532_0\shell\condabin\conda-hook.ps1
C:\Users\matt\scoop\apps\miniconda3\4.10.3\pkgs\conda-4.10.3-py39haa95532_0\Lib\site-packages\conda\shell\condabin\conda-hook.ps1
maphew commented 2 years ago

Resolved for my machine. Turns out I have two conda installs on my machine. The second comes with ArcGIS Pro and that was being used even though it wasn't in PATH. To fix I located all insances of Profile.ps1 and Microsoft.Powershell_profile.ps1 and commented out the section adding ArcGIS Pro's conda. Now powershell prompts open without error, and only Miniconda3's conda is used.

Reference: https://devblogs.microsoft.com/scripting/understanding-the-six-powershell-profiles/

bigbig103 commented 2 years ago

@maphew Hello, my problem is the same as what you described. I installed arcgis pro, cloned a python 3.7.10, and VScode used the cloned python 3.7.10 path. The same error was reported. How did you solve it? Can you write down your specific solutions?