2

Fresh install of conda. I'm trying to activate an environment (any environment) and I get the following

(base) PS C:\Users\AndrewBergan> conda activate test123

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

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

What am I doing wrong?

Drew
  • 141
  • 1
  • 9

4 Answers4

4

Turns out for some reason Continuum/anaconda3/Library/bin did not get added to my path. Adding this fixed the problem.

Edit: As noted in the comment below, other modifications to your path might be needed. I was able to determine what was missing from my path by adding a couple print statements to activate.py and comparing the output from the conda bash window and powershell.

Drew
  • 141
  • 1
  • 9
  • I had the same issue and if your answer didn't work out for me, this path did: Continuum/anaconda3/bin Can you edit your answer and suggest also that path for other users? Thanks. – mbh86 Apr 09 '19 at 14:54
4

you can just update conda using following code

conda update -n base conda

Because conda 4.6.14 fixed this problem.

yuhaoooo
  • 61
  • 4
3

conda start to support Powershell in version 4.6. upgrade your conda, then run this:

conda init

you should be fine then.

Ken Cloud
  • 853
  • 7
  • 6
0

I was too struggling with this trouble for a long time but couldn't find any solution online. But I found it at last. This is occurring because Windows PowerShell is not allowed to run local PowerShell scripts. It can be enabled in developer settings.

On windows 10

Settings > Update & Security > For developers >  Enable PowerShell to run local PowerShell scripts without signing in.

see where to enable