0

環境

Windows 10 Home 1803
PowerShell 5.1.17134.590
Chocolatey v0.10.11
conda 4.6.11

質問詳細

ChocolateyでインストールしたMiniconda3をPowershellで使いたいのですが、仮想環境の切り替えでエラーが出て困っています。
conda init powershellは実行しました。

仮想環境一覧

(base) PS C:\Windows\system32> conda info -e
WARNING: The conda.compat module is deprecated and will be removed in a future release.
# conda environments:
#
base                  *  C:\tools\miniconda3
dj                       C:\tools\miniconda3\envs\dj
dj-test                  C:\tools\miniconda3\envs\dj-test
django-tutrial           C:\tools\miniconda3\envs\django-tutrial
pt-test                  C:\tools\miniconda3\envs\pt-test
pytorch-gpu              C:\tools\miniconda3\envs\pytorch-gpu

(base) PS C:\Windows\system32>

エラー内容

(base) PS C:\Windows\system32> conda activate dj

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

    Traceback (most recent call last):
      File "C:\tools\miniconda3\lib\site-packages\conda\cli\main.py", line 138, in main
        return activator_main()
      File "C:\tools\miniconda3\lib\site-packages\conda\activate.py", line 940, in main
        print(activator.execute(), end='')
      File "C:\tools\miniconda3\lib\site-packages\conda\activate.py", line 173, in execute
        return getattr(self, self.command)()
      File "C:\tools\miniconda3\lib\site-packages\conda\activate.py", line 150, in activate
        builder_result = self.build_activate(self.env_name_or_prefix)
      File "C:\tools\miniconda3\lib\site-packages\conda\activate.py", line 275, in build_activate
        return self._build_activate_stack(env_name_or_prefix, False)
      File "C:\tools\miniconda3\lib\site-packages\conda\activate.py", line 332, in _build_activate_stack
        self._replace_prefix_in_path(old_conda_prefix, prefix))
      File "C:\tools\miniconda3\lib\site-packages\conda\activate.py", line 550, in _replace_prefix_in_path
        assert last_idx is not None
    AssertionError

`$ C:\tools\miniconda3\Scripts\conda-script.py shell.powershell activate dj`

  environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=C:\tools\miniconda3\Scripts\conda.exe
             CONDA_PREFIX=C:\tools\miniconda3
    CONDA_PROMPT_MODIFIER=(base)
               CONDA_ROOT=C:\tools\miniconda3
              CONDA_SHLVL=1
                CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
                 HOMEPATH=\Users\take
                NODE_PATH=C:\Program Files (x86)\Nodist\bin\node_modules;C:\Program Files
                          (x86)\Nodist\bin\node_modules;%NODE_PATH%
          NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt\
                     PATH=C:\tools\miniconda3;C:\tools\miniconda3\Library\mingw-w64\bin;C:\tools
                          \miniconda3\Library\usr\bin;C:\tools\miniconda3\Library\bin;C:\tools\m
                          iniconda3\Scripts;C:\tools\miniconda3\bin;C:\tools\miniconda3\condabin
                          ;C:\Program Files\NVIDIA GPU Computing
                          Toolkit\CUDA\v10.0\bin;C:\Program Files\NVIDIA GPU Computing
                          Toolkit\CUDA\v10.0\libnvvp;C:\Program Files (x86)\Common
                          Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\Intel(R)
                          Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R)
                          Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\W
                          indows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Wi
                          ndows\System32\OpenSSH\;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)\NVIDIA
                          Corporation\PhysX\Common;C:\ProgramData\chocolatey\bin;C:\Program
                          Files\Microsoft VS Code\bin;C:\Program Files\Git\cmd;C:\tools\minicond
                          a3\;C:\tools\miniconda3\Scripts;C:\tools\php73;C:\Program Files (x86)\
                          Nodist\bin;C:\Users\take\AppData\Local\Microsoft\WindowsApps;C:\Users\
                          take\AppData\Local\GitHubDesktop\bin;C:\ProgramData\chocolatey\lib\min
                          gw\tools\install\mingw64\bin;C:\tools\miniconda3\lib\site-
                          packages\pywin32_system32;C:\tools\miniconda3\lib\site-
                          packages\pywin32_system32
             PSMODULEPATH=C:\Users\take\Documents\WindowsPowerShell\Modules;C:\Program Files\Win
                          dowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modu
                          les
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : base
    active env location : C:\tools\miniconda3
            shell level : 1
       user config file : C:\Users\%username%\.condarc
 populated config files : C:\Users\%username%\.condarc
          conda version : 4.6.11
    conda-build version : not installed
         python version : 3.7.3.final.0
       base environment : C:\tools\miniconda3  (writable)
           channel URLs : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
                          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:\tools\miniconda3\pkgs
                          C:\Users\%username%\.conda\pkgs
                          C:\Users\%username%\AppData\Local\conda\conda\pkgs
       envs directories : C:\tools\miniconda3\envs
                          C:\Users\%username%\.conda\envs
                          C:\Users\%username%\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.17134
          administrator : True
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

Invoke-Expression : 引数が空の文字列であるため、パラメーター 'Command' にバインドできません。
発生場所 C:\tools\miniconda3\shell\condabin\Conda.psm1:70 文字:36
+         Invoke-Expression -Command $activateCommand;
+                                    ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Invoke-Expression]、ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.InvokeExpressionCommand

(base) PS C:\Windows\system32>

1 件の回答 1

1

以下のコマンドで conda をバージョンアップすることで解決しました。

conda update conda -n base -c default

この質問に回答するには、ログインする必要があります。

求めていた回答ではありませんか? のタグが付いた他の質問を参照する。