ContinuumIO / anaconda-issues

Anaconda issue tracking
648 stars 224 forks source link

Anaconda fails to activate environment on Windows OS #2533

Closed gauravssnl closed 6 years ago

gauravssnl commented 7 years ago

Hello,everyone.I have installed Anaconda both on Ubuntu & Windows OS,Anconda runs fine on Ubuntu.While installing Anaconda on Windows OS,i added path of Anaconda to Environment variable(that option was provided by installer) .Now,when i activate any environment ,say py27 environment(which runs Python 2.7.13) ,and then I try to use python command on CMD/PowrShell Terminal or in any IDE/Text Editor,it does not run python of py27 environment.But,it runs python of root directory of Anconda,that is Python 3.6.1.I know it is a path issue.If I remove Anaconda path from my Environment variable,then i can not use python command on CMD/Powershell/Sublime,no matter which python environment is activated in Anconda . As far as i know,anaconda fails to add path of newly activated environment py27 to Environment variable & it should also remove path of other environment of Anaconda from there ,otherwise,it leads to conflict while using "python " command. I activate "py27" environment by using this command : activate py27 but,after that,i do not see that the path of this environment "py27" in my Envronment variables.
Check my screenshots below . bug

gauravssnl commented 7 years ago

@kalefranz @goanpeca I got no reply from your side.what do you all say ??

ccordoba12 commented 7 years ago

I think the problem here is that the conda activation scripts don't work in Powershell. What happens if you run them in CMD?

gauravssnl commented 7 years ago

i get the same problem. @ccordoba12

ccordoba12 commented 7 years ago

Then you have an installation problem because activation should definitely work in CMD.

Please try uninstalling/reinstalling Anaconda to see if that helps. Sorry for not being more helpful, but I don't know what's the root of your problem.

gauravssnl commented 7 years ago

seriously??i have reinstalled,i get the same problem @ccordoba12

goanpeca commented 7 years ago

@gauravssnl are you opening the anaconda prompt or just a regular prompt?

gauravssnl commented 7 years ago

i am using command prmpt/Power Shell @goanpeca

goanpeca commented 7 years ago

@gauravssnl you need to use the Anaconda Prompt, it should have been installed with Anaconda

ccordoba12 commented 7 years ago

Right, there should be a menu entry for it.

gauravssnl commented 7 years ago

@goanpeca @ccordoba12 but,I want to use Anaconda/conda in PowrShell/CMD

ccordoba12 commented 7 years ago

Anaconda prompt simply opens a CMD with the right PATH for Anaconda. So please try it and let us know if it works for you.

As I said above, I don't think activate works in Powershell.

gauravssnl commented 7 years ago

I have found the solution for using Anaconda/conda in PowerShell/CMD. we can use it by using this command : cmd "/K" C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3 Anaconda In PowerShell @ccordoba12 @goanpeca

jpeterson92 commented 7 years ago

Your solution fixed running environments in Powershell for me, @gauravssnl ! Thanks very much.

@ccordoba12 , @goanpeca : Do you know why Powershell needs to have the activation script manually run?

I believe my PATH is configured correctly because I can activate evironments in the standard command prompt just fine (without using the Anaconda command version or calling script at the beginning). The same code doesn't work in Powershell however. I've included an example below. Thank you for your attention and help!

image

ccordoba12 commented 7 years ago

I don't why that's the case. Pinging @msarahan and @mingwandroid to see if they know what's happening in this case.

mingwandroid commented 7 years ago

@jpeterson92, activation involves more than simply setting PATH and we currently do not support running activate directly from PowerShell (it is on our list of things to fix). You need to use the Anaconda Prompt or, if you want to use PowerShell, run activate.bat as @gauravssnl recommends.

wlievens commented 7 years ago

Is this activate.bat file to be downloaded from somewhere else? I didn't come with my anaconda3 install.

gauravssnl commented 7 years ago

activate.bat path may be C:\ProgramData\Anaconda3\Scripts\activate.bat Path of activate.bat depends upon the path where you have installed Anaconda.Try to search it if you need to find path of activation.bat .Check my previous comment if you want to use Anaconda in PowerShell. @wlievens

wlievens commented 7 years ago

@gauravssnl activate.bat was nowhere to be found in the Anaconda3 folder or any of its subdirectories, including the Scripts folder

Will reinstall now, maybe something went wrong.

gauravssnl commented 7 years ago

Did you check the path which i mentioned ???I have already explained you where to find and that depends on the path where you have installed Anaconda @wlievens

wlievens commented 7 years ago

It was not in that directory, probably because it was a single-user install, so it was in my Windows home/Anaconda3, and I looked there.

Reinstalling now, with for all users option, and I simply picked C:\Anaconda3.

wlievens commented 7 years ago

Reinstalled, and the issue persists. I've attached a screenshot because you don't seem to believe me :-)

This is C:\Anaconda3\Scripts sorted by name, so activate.bat should be near the top. The command window is what happens when I open "Anaconda Prompt" through the Start menu. Windows 7, the language is Dutch in case you're curious.

image

gauravssnl commented 7 years ago

For using Anaconda in CMD , you need not use activate.bat file, just use 'conda' command (you must have Anaconda Path added to your Environment Variable ).For using Anaconda in PowerShell, you need to use activate.bat file which should be in C:\ProgramData\Anaconda3\Scripts\ @wlievens

wlievens commented 7 years ago

I did that too, manually adding the path to my env vars first, but the conda command was not recognized.

I uninstalled now, going try 4.4.0

wlievens commented 7 years ago

Not much better that one

image

aggx commented 7 years ago

I had the same thing just happen as well. activate.bat just disappeared out of the Anaconda3/Scripts folder. I was running Jupyter at the time it just spontaneously quit and from that point on I was not able to run anything within Anaconda. I can't launch the Navi either.

aggx commented 7 years ago

Well, couldn't really wait for a response, so I completely uninstalled and reinstalled Anaconda and recreated my previous environments. Keeping yml backups from now on. Learned my lesson :( Really sucks I couldn't just troubleshoot with minor tweaks to fix. Just about everything was in it's place except the missing activate.bat file. Very odd.

aggx commented 7 years ago

Well I'm back in the same hole again! This time it is clear that it was caused by a crash in Jupyter. Nothing distinctive in Jupyter in cmd prompt window other than it was clear python had quit altogether. When I went back to try to launch the anaconda prompt, I get this- '"C:\Users\agg\Anaconda3\Scripts..\python.exe"' is not recognized as an internal or external command, operable program or batch file. '"C:\Users\agg\Anaconda3\Scripts\..\Scripts\conda.exe"' is not recognized as an internal or external command, operable program or batch file.

aggx commented 7 years ago

At the time I was just trying to import tensorflow at the very start of the script when Jupyter crashed.

mingwandroid commented 7 years ago

@aggx, if you can get this to reproduce reliably it would be interesting to run procmon.exe from Microsoft and search in the logs for whatever it is that's deleting these files. Do you have a virus scanner running? Could you check logs there to see if it's quarantining our software?

aggx commented 7 years ago

It may very well be the anti-virus software. I went to the unistall/install process for anaconda again and got it up and running. I turned off my anti-virus this evening and haven't been able to trigger a failure from Jupyter. I launched Jupyter Notebook from within my tensorflow environment as before and could not get it to import - tried several times as this is what eventually triggered the failure. But no failure - go figure! I also found out in another post that I needed Jupyter loaded into my environment to have it import tensorflow - not sure why, but it works. Tensorflow now imports! I'll post again, if anaconda should get corrupted when I get the nerve to turn anti-virus on. I'll have procmon running when I do to see what I can capture. Right now I have some work to get done.

kev0960 commented 7 years ago

I am having a same issue. activate.bat is missing from the Script folder. In fact, I cannot even run the conda command because there is no such file anywhere in Anaconda installation. Note that python works just as fine.

wlievens commented 7 years ago

I am very happy I am not the only one.

kev0960 commented 7 years ago

I found out that If I turn off the antivirus during installation, everything works perfectly. My antivirus was Kaspersky Free and it seemed to hinder the proper installtaion of Anaconda.

macmac11 commented 7 years ago

I'm encountering the exact same issue, installing Anaconda (3.6.3) on a windows 10 machine. Activate.bat is not reconignized and on checking the \Scripts directory after a fresh uninstall/re-install its not there in the 1st place (two other batch files are, f2py & .qt-post-link). My level of admin permissions won't allow me to disable the anti virus for the install - any suggestions how to resolve this?

aggx commented 7 years ago

One option I would offer up - if your anti-virus supports this without admin rights hopefully - is to place the root anaconda directory on an exclusion list of the anti-virus program. Seems to be working so far while I shop for another AV! I had also found out that my anti-virus had in addition to purging my activate.bat - also quarantined the python executables (python.exe and pythonw.exe) but only those within anaconda - causing a potential problem on re-installing anaconda. It didn't seem to care about my older installs of 2.7 and 3.5 elsewhere that I use from time to time. Go figure!

NafeesAhmedAbbasi commented 7 years ago

I've same problem, I uninstalled many time and installed but nothing changed. same error again and again.does anyone get rid of this bullshit

AdityaSoni19031997 commented 7 years ago

I've same problem, I uninstalled many time and installed but nothing changed. same error again and again.does anyone get rid of this bullshit me too

gauravssnl commented 7 years ago

For using Anaconda in CMD , you need not use activate.bat file, just use 'conda' command (you must have Anaconda Path added to your Environment Variable ).For using Anaconda in PowerShell, you need to use activate.bat file which should be in C:\ProgramData\Anaconda3\Scripts Have you tried to check the path which I have mentioned here ??? @NafeesAhmedAbbasi @AdityaSoni19031997

AdityaSoni19031997 commented 7 years ago

Actually I was using the Anaconda Prompt itself.. But the point is the file activate.bat has evaded from the directory...

AdityaSoni19031997 commented 7 years ago

It happened while I was trying to install Pytorch on windows using the peterjc123 tar file..

gauravssnl commented 7 years ago

Did you check this path for finding activate.bat : C:\ProgramData\Anaconda3\Scripts ??? @AdityaSoni19031997

AdityaSoni19031997 commented 7 years ago

Yes I did... The file isn't there..

On 07-Nov-2017 5:45 pm, "GAURAV" notifications@github.com wrote:

Did you check this path for finding activate.bat : C:\ProgramData\Anaconda3\Scripts ??? @AdityaSoni19031997 https://github.com/adityasoni19031997

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ContinuumIO/anaconda-issues/issues/2533#issuecomment-342465028, or mute the thread https://github.com/notifications/unsubscribe-auth/AVr0pipwYALdrN0I6xYpvcSPNjK1nCq_ks5s0EnygaJpZM4ODQxd .

AdityaSoni19031997 commented 7 years ago

https://github.com/evhub/coconut/issues/358 By mistake I created the issue here.. I found that it's a common problem with Anaconda on the web.. but there is no fix to it..

On 07-Nov-2017 17:46, "aditya soni" soniaditya922@gmail.com wrote:

Yes I did... The file isn't there..

On 07-Nov-2017 5:45 pm, "GAURAV" notifications@github.com wrote:

Did you check this path for finding activate.bat : C:\ProgramData\Anaconda3\Scripts ??? @AdityaSoni19031997 https://github.com/adityasoni19031997

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ContinuumIO/anaconda-issues/issues/2533#issuecomment-342465028, or mute the thread https://github.com/notifications/unsubscribe-auth/AVr0pipwYALdrN0I6xYpvcSPNjK1nCq_ks5s0EnygaJpZM4ODQxd .

AdityaSoni19031997 commented 7 years ago

Can the file be shared among one another?

AdityaSoni19031997 commented 7 years ago

https://github.com/ContinuumIO/anaconda-issues/issues/2533#issuecomment-334742891

Exactly the same thing was shown to me also on the Anaconda Prompt...

gauravssnl commented 7 years ago

Right now,I am using Ubuntu OS .I will show you where activate.bat path is in Windows OS when I will start Windows OS.

gauravssnl commented 7 years ago

Have a look at this screenshot, activate.bat is located in C:\ProgramData\Anaconda3\Scripts .you need to cnage your drive letter if you have installed Anaconda on other drive like D or E. @AdityaSoni19031997 @wlievens @aggx @kev0960 @NafeesAhmedAbbasi screenshot from 2017-11-07 17-56-38

AdityaSoni19031997 commented 7 years ago

If I say that the file isn't there in that particular directory and I haven't deleted it(why will I?)..

On 07-Nov-2017 6:00 pm, "GAURAV" notifications@github.com wrote:

Have a look at this screenshot, activate.bat is located in C:\ProgramData\Anaconda3\Scripts .you need to cnage your drive letter if you have installed Anaconda on other drive like D or E. [image: screenshot from 2017-11-07 17-56-38] https://user-images.githubusercontent.com/13808299/32493784-24540324-c3e5-11e7-9529-850905630ec2.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ContinuumIO/anaconda-issues/issues/2533#issuecomment-342468111, or mute the thread https://github.com/notifications/unsubscribe-auth/AVr0puCZNuEPXNIm7rI4HBo6iwTyC-fFks5s0E1WgaJpZM4ODQxd .

AdityaSoni19031997 commented 7 years ago

https://github.com/conda/conda/issues/5529

Here also same issue but the update command didn't help..

On 07-Nov-2017 6:04 pm, "aditya soni" soniaditya922@gmail.com wrote:

If I say that the file isn't there in that particular directory and I haven't deleted it(why will I?)..

On 07-Nov-2017 6:00 pm, "GAURAV" notifications@github.com wrote:

Have a look at this screenshot, activate.bat is located in C:\ProgramData\Anaconda3\Scripts .you need to cnage your drive letter if you have installed Anaconda on other drive like D or E. [image: screenshot from 2017-11-07 17-56-38] https://user-images.githubusercontent.com/13808299/32493784-24540324-c3e5-11e7-9529-850905630ec2.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ContinuumIO/anaconda-issues/issues/2533#issuecomment-342468111, or mute the thread https://github.com/notifications/unsubscribe-auth/AVr0puCZNuEPXNIm7rI4HBo6iwTyC-fFks5s0E1WgaJpZM4ODQxd .

gauravssnl commented 7 years ago

I wanted to say that Anaconda setup should work same on all Windows System.That's all I wanted to say and you should try to find activate.bat yourself .Otherwise,search about it on Google @AdityaSoni19031997