Ben Love
Ben Love

Reputation: 468

Anaconda activate environment "The syntax of the command is incorrect"

Probably something simple (I hope) but activate environment_name is giving me the message "The syntax of the command is incorrect."

I'm using Windows 7, conda 3.19.0, python 2.7.11, and I get that message with both cmd.exe and the Anaconda Command Prompt.

It may be relevant that it has never worked for me before as I just installed Anaconda - as admin - (and the environment I'm referencing is their tutorial example).

Even after I remove the environment and re-create it I still get the same thing:

C:\Anaconda>conda create -n snowflakes biopython
Fetching package metadata: ....
Solving package specifications: ............
Package plan for installation in environment C:\Anaconda\envs\snowflakes:

The following NEW packages will be INSTALLED:

    biopython:    1.66-np110py27_0
    msvc_runtime: 1.0.1-vc9_0      [vc9]
    numpy:        1.10.1-py27_0
    pip:          7.1.2-py27_0
    python:       2.7.11-0
    setuptools:   19.2-py27_0
    wheel:        0.26.0-py27_1

Proceed ([y]/n)? y

Linking packages ...
[      COMPLETE      ]|##################################################| 100%
#
# To activate this environment, use:
# > activate snowflakes
#

C:\Anaconda>activate snowflakes
The syntax of the command is incorrect.

C:\Anaconda>conda info -e
# conda environments:
#
bunnies                  C:\Anaconda\envs\bunnies
snowflakes               C:\Anaconda\envs\snowflakes
root                  *  C:\Anaconda


C:\Anaconda>

I have updated both Anaconda and conda to no avail. I don't know if it's a root directory installation issue or a PATH issue or what. I have perused the activate script and cannot see anything obvious there. Using the full path name does not help either, as in

C:\Anaconda>activate C:\Anaconda\envs\snowflakes

Any help is much appreciated.

Update 1/17/2016: Uninstalled Anaconda. Installed older version, Anaconda-2.3.0-Windows-x86_64.zip from zipped windows installers archive.

I could activate/deactivate environments after install. But then I updated again with conda update conda and also conda update anaconda. Now I am getting the same "incorrect syntax" message as before. I am resigned to using as is until I absolutely need more env functionality.

Upvotes: 4

Views: 4877

Answers (2)

Ben Love
Ben Love

Reputation: 468

I know I edited the PATH before but it worked this time (after I updated from Windows7 to Windows10):

I added

C:\Users\Myusername\Anaconda

to the beginning of the full environment variable PATH value, separated by a semicolon and it seems to have worked. It was there before, the only difference is now Windows10, and I put the Anaconda line at the beginning.

And it's working beautifully.

Upvotes: 1

Charlie Haley
Charlie Haley

Reputation: 4310

I just spent a while struggling to find the cause of this error. The problem on my machine was the PATH environmental variable.

Open up the Edit Environment Variables for your account program on windows, and edit the PATH variable. Remove any quotation marks or potentially invalid path characters. It should look like C:\path\to\programs;C:\path\to\more\programs;...

And if you're the admin, it's possible you will have to do the same thing for the system PATH environment variable.

Upvotes: 1

Related Questions