4

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.

Ben Love
  • 468
  • 9
  • 15
  • Can you execute `python` from `cmd.exe`? (without cd'ing in Anaconda folder) – gaborous Jan 16 '16 at 04:56
  • Yes I can. Oh, and maybe this is relevant too, I installed as admin. – Ben Love Jan 16 '16 at 05:10
  • So this isn't an issue with your PATH, but rather with either your usage of activate or your definition of your venv. What's interesting, is the error message `The syntax of the command is incorrect`, suggesting that the command is indeed recognized, but cannot be completed. Maybe you need to use `python=biopython` as the last argument? [Here are the commands I used to successfully activate Python 3.5 with the same setup as you](https://github.com/tqdm/tqdm/pull/87#issuecomment-170384362). – gaborous Jan 16 '16 at 05:19
  • Adding various additional arguments doesn't seem to work either. I've removed the environment and created it again, this time specifying python=2.7 and tried adding that to the end when I activate. Still no. – Ben Love Jan 16 '16 at 06:05
  • That's a very weird issue you have here. Maybe you should try to reinstall Anaconda not as an admin this time around. But I'm really not sure this can fix your issue... – gaborous Jan 16 '16 at 06:44
  • Alternatively, you can try to manually set temporarily the PATH variable in a bat script [as described here](http://stackoverflow.com/a/21707160/1121352), this should have the same effect as doing `activate snowflakes`. – gaborous Jan 16 '16 at 16:26
  • I think I'm going to try to uninstall and re-install Anaconda. I'll try as user, but I couldn't get it to install that way before. I even had to go into the distro archives to find a less recent edition that would work. It kept telling me it failed to create Anaconda menus. But then I found one, not too old and updated it with `conda update conda` and `conda update anaconda`. – Ben Love Jan 16 '16 at 20:32
  • I think you should report your issue to the Anaconda devs directly, it seems there's a bug in the latest update, and you're possibly not the only one. – gaborous Jan 18 '16 at 17:14

2 Answers2

1

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.

Charlie Haley
  • 4,152
  • 4
  • 22
  • 36
1

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.

Ben Love
  • 468
  • 9
  • 15