1
1
I installed Anaconda 3 in "C:\Anaconda3" and manually added the paths "C:\Anaconda3\Scripts", "C:\Anaconda3" in the PATH variable. I installed VS Code through the Anaconda Navigator which also installed the Anaconda Extension Pack for VS Code. I created a simple .py file and wanted to run it. I am getting the following error:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\conda\cli\main.py", line 138, in main
return activator_main()
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 940, in main
print(activator.execute(), end='')
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 173, in execute
return getattr(self, self.command)()
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 150, in activate
builder_result = self.build_activate(self.env_name_or_prefix)
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 275, in build_activate
return self._build_activate_stack(env_name_or_prefix, False)
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 297, in _build_activate_stack
return self.build_reactivate()
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 442, in build_reactivate
new_path = self.pathsep_join(self._replace_prefix_in_path(conda_prefix, conda_prefix))
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 550, in _replace_prefix_in_path
assert last_idx is not None
AssertionError
`$ C:\Anaconda3\Scripts\conda-script.py shell.powershell activate base`
environment variables:
CIO_TEST=<not set>
CONDA_BAT=C:\Anaconda3\condabin\conda.bat
CONDA_DEFAULT_ENV=base
CONDA_EXE=C:\Anaconda3\Scripts\conda.exe
CONDA_PREFIX=C:\Anaconda3
CONDA_PROMPT_MODIFIER=(base)
CONDA_ROOT=C:\Anaconda3
CONDA_SHLVL=1
HOMEPATH=\Users\Jithakrishna Prakash
PATH=C:\Anaconda3;C:\Anaconda3\Library\mingw-w64\bin;C:\Anaconda3\Library\usr\bin;C:\Anaconda3\Library\bin;C:\Anaconda3\Scripts;C:\Anaconda3\bin;C:\Anaconda3\condabin;C:\Anaconda3;C:\Anaconda3\Library\mingw-w64\bin;C:\Anaconda3\Library\usr\bin;C:\Anaconda3\Library\bin;C:\Anaconda3\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\MinGW\bin;C:\WINDOWS\System32\OpenSSH\;E:\Programs\Calibre2\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\OpenBabel-2.4.1;C:\Users\Jithakrishna Prakash\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Microsoft VS Code\bin;C:\Anaconda3;C:\Anaconda3\Scripts;;C:\Users\Jithakrishna Prakash\AppData\Local\Programs\Microsoft VS Code\bin
PSMODULEPATH=C:\Users\Jithakrishna Prakash\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>
active environment : base
active env location : C:\Anaconda3
shell level : 1
user config file : C:\Users\Jithakrishna Prakash\.condarc
populated config files : C:\Users\Jithakrishna Prakash\.condarc
conda version : 4.6.11
conda-build version : 3.17.8
python version : 3.7.3.final.0
base environment : C:\Anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/win-64
https://repo.anaconda.com/pkgs/free/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:\Anaconda3\pkgs
C:\Users\Jithakrishna Prakash\.conda\pkgs
C:\Users\Jithakrishna Prakash\AppData\Local\conda\conda\pkgs
envs directories : C:\Anaconda3\envs
C:\Users\Jithakrishna Prakash\.conda\envs
C:\Users\Jithakrishna Prakash\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.6.11 requests/2.21.0 CPython/3.7.3 Windows/10 Windows/10.0.17763
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?
C:/Anaconda3/Scripts/activate
No report sent. To permanently opt-out, use
$ conda config --set report_errors false
Invoke-Expression : At line:1 char:2
+ [y/N]:
+ ~
Missing ] at end of attribute or type literal.
At line:1 char:4
+ [y/N]:
+ ~
You must provide a value expression following the '/' operator.
At line:1 char:4
+ [y/N]:
+ ~~~
Unexpected token 'N]:' in expression or statement.
At C:\Anaconda3\shell\condabin\Conda.psm1:70 char:9
+ Invoke-Expression -Command $activateCommand;
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (:) [Invoke-Expression], ParseException
+ FullyQualifiedErrorId : EndSquareBracketExpectedAtEndOfAttribute,Microsoft.PowerShell.Commands.InvokeExpressionCommand
Loading personal and system profiles took 1515ms.
(base) PS E:\VSCodeWorkspace> conda activate base
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\conda\cli\main.py", line 138, in main
return activator_main()
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 940, in main
print(activator.execute(), end='')
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 173, in execute
return getattr(self, self.command)()
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 150, in activate
builder_result = self.build_activate(self.env_name_or_prefix)
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 275, in build_activate
return self._build_activate_stack(env_name_or_prefix, False)
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 297, in _build_activate_stack
return self.build_reactivate()
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 442, in build_reactivate
new_path = self.pathsep_join(self._replace_prefix_in_path(conda_prefix, conda_prefix))
File "C:\Anaconda3\lib\site-packages\conda\activate.py", line 550, in _replace_prefix_in_path
assert last_idx is not None
AssertionError
`$ C:\Anaconda3\Scripts\conda-script.py shell.powershell activate base`
environment variables:
CIO_TEST=<not set>
CONDA_BAT=C:\Anaconda3\condabin\conda.bat
CONDA_DEFAULT_ENV=base
CONDA_EXE=C:\Anaconda3\Scripts\conda.exe
CONDA_PREFIX=C:\Anaconda3
CONDA_PROMPT_MODIFIER=(base)
CONDA_ROOT=C:\Anaconda3
CONDA_SHLVL=1
HOMEPATH=\Users\Jithakrishna Prakash
PATH=C:\Anaconda3;C:\Anaconda3\Library\mingw-w64\bin;C:\Anaconda3\Library\usr\bin;C:\Anaconda3\Library\bin;C:\Anaconda3\Scripts;C:\Anaconda3\bin;C:\Anaconda3\condabin;C:\Anaconda3;C:\Anaconda3\Library\mingw-w64\bin;C:\Anaconda3\Library\usr\bin;C:\Anaconda3\Library\bin;C:\Anaconda3\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\MinGW\bin;C:\WINDOWS\System32\OpenSSH\;E:\Programs\Calibre2\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\OpenBabel-2.4.1;C:\Users\Jithakrishna Prakash\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Microsoft VS Code\bin;C:\Anaconda3;C:\Anaconda3\Scripts;;C:\Users\Jithakrishna Prakash\AppData\Local\Programs\Microsoft VS Code\bin
PSMODULEPATH=C:\Users\Jithakrishna Prakash\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>
active environment : base
active env location : C:\Anaconda3
shell level : 1
user config file : C:\Users\Jithakrishna Prakash\.condarc
populated config files : C:\Users\Jithakrishna Prakash\.condarc
conda version : 4.6.11
conda-build version : 3.17.8
python version : 3.7.3.final.0
base environment : C:\Anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/win-64
https://repo.anaconda.com/pkgs/free/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:\Anaconda3\pkgs
C:\Users\Jithakrishna Prakash\.conda\pkgs
C:\Users\Jithakrishna Prakash\AppData\Local\conda\conda\pkgs
envs directories : C:\Anaconda3\envs
C:\Users\Jithakrishna Prakash\.conda\envs
C:\Users\Jithakrishna Prakash\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.6.11 requests/2.21.0 CPython/3.7.3 Windows/10 Windows/10.0.17763
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?
How do I fix this?
EDIT (22/5/2019): Added a different error report to show that I get the same error even if I freshly load VS Code and run a new .py file. At this point I have installed two extensions - Python Extension (Microsoft) and the Code Runner Extension (Jun Han). I have also added the lines:
"code-runner.executorMap":
{
"python": "\"C:\\Anaconda3\\python.exe\""
}
and
"code-runner.runInTerminal": true
in settings.json
EDIT (23/5/2019): https://stackoverflow.com/a/56023532/9724217 This is the answer. Solved. The current Anaconda3 package comes with conda version 4.6.11. You need to manually update it to 4.6.14. The issue then gets solved. VS Code can be opened normally or via the Anaconda Navigator. It's fine both ways.
Why are you attempting to activating the
(base)
environment when you already appear to be in the(base)
environment? – Anaksunaman – 2019-05-21T14:03:01.700@Anaksunaman I am getting the exact same error when I freshly open VS Code and press "Run Code" for the .py file. I have the Python extension and the Code Runner extension. I should perhaps give a clearer error report. – Jithakrishna Prakash – 2019-05-22T04:29:28.243
I dont think you want to add Anaconda to your path. Its says that on when you first install it right? I would just install it from navigator and not mess with your paths at all. VS code install directly from the navigators homepage – MNM – 2019-05-23T05:45:01.897