Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Environment has not been activated #8412

Closed
hagamuna opened this issue Mar 14, 2019 · 16 comments
Closed

[Windows] Environment has not been activated #8412

hagamuna opened this issue Mar 14, 2019 · 16 comments
Labels
locked [bot] locked due to inactivity

Comments

@hagamuna
Copy link

Hi,

I wanted my base python version to always be updated to the latest version on my Windows machine
However in doing so, conda commands will now always return:
"The system cannot find the path specified"

Simple reproduction

  1. install miniconda
    (not Anaconda, this adds a ton of overhead)

Side note: The local user and system %path% variables have more 1048 (or 2048) characters.
(And yes, this path is already reduced by using environment variables)
So conda won't work properly unless we use the 'add to path' checkbox while installing.

  1. Restart PC (to ensure path variables work properly)

  2. Open a cmd.exe with Administrator

  3. Update conda using:
    conda update conda
    Note: This does not seem to update everything, since python version remains 3.7.1, instead of latest 3.7.2

  4. Update all packages, to ensure python and all it's packages are updated in the base environment
    conda update --all

  5. Start python;
    python

Result:

Python 3.7.2 (default, Feb 21 2019, 17:35:59) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32

Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load.  To activate this environment
please see https://conda.io/activation

Type "help", "copyright", "credits" or "license" for more information.

At least the version seems to be correct :)
Anyway you can already see what is wrong, apparently it expects the environment to be activated.

Lets do that:
activate base
Result
The system cannot find the path specified.

Same goes for deactivation
conda deactivate
Result
The system cannot find the path specified.

@jpgill86
Copy link
Contributor

I'm speculating, but this might be indirectly related to #8404 (comment), specifically the first problem described. You could try the hack described here to see if it fixes your problem.

@msarahan
Copy link
Contributor

This is going to be pretty hard to debug with the information you've provided. What does where conda show on your cmd.exe?

@hagamuna
Copy link
Author

hagamuna commented Mar 15, 2019

where conda

D:\Miniconda3\Library\bin\conda.bat
D:\Miniconda3\Scripts\conda.exe

I looked further into it and it seems that
D:\Miniconda3\Library\bin\conda.bat
internally calls D:\Miniconda3\condabin\conda.bat

I called that second script by hand, which gives the
The system cannot find the path specified.
So it's actually the second script that contains the problem.

I also looked into #8404 (comment), they specify that CONDA_BAT variable might be empty.
In my case is, e.g:

echo %CONDA_BAT%
<returns nothing>

conda activate base
echo %CONDA_BAT%
<returns nothing>

Looking further into D:\Miniconda3\condabin\conda.bat
I added echo statements and it's line 5 and 6 that cause
The system cannot find the path specified.

I think it's this part:
"%~dp0_conda_activate" %*

@hagamuna
Copy link
Author

hagamuna commented Mar 15, 2019

Update solved the second problem, e.g
The system cannot find the path specified.

The solution, run this command in administator cmd prompt.
conda init
Then close the prompt and open a new one.

It seems CONDA_BAT environment variable now works:

conda activate base
echo %CONDA_BAT%
D:\Miniconda3\condabin\conda.bat

@hagamuna hagamuna changed the title [Windows] Environment has not been activated & The system cannot find the path specified [Windows] Environment has not been activated Mar 15, 2019
@hagamuna
Copy link
Author

when i run python in admin cmd prompt, I still get.

Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load.  To activate this environment
please see https://conda.io/activation

Note: the warning goes away after activating an environment. (which can be base.)

conda activate base
python
Python 3.7.2 (default, Feb 21 2019, 17:35:59) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

@mingwandroid
Copy link
Contributor

when i run python in admin cmd prompt, I still get.

Activation has nothing to do with admin.

@msarahan
Copy link
Contributor

admin is also called "elevation" and yes, this is very different from the "activation" that the warning message is telling you to do.

Even without any CONDA_BAT being set, running

<path to miniconda>\Scripts\activate base

works for me. I'm not sure what's causing the system to not be able to find something. It might be spaces or something like that in your install path. With the information you've provided, we can't say anything more. Please always fill out the info requested by the issue template.

@edreamleo
Copy link

@msarahan Thanks for this!

My experience today (September 12, 2019):

  • Downloaded Anaconda3-2019.07-Windows-x86_64.exe
  • Installed Anaconda3 in c:\Anaconda3, with raised permissions, without setting the path in the installer. Not surprisingly, python is not found.
  • Added c:\Anaconda3 and c:\Andaconda3\scripts to the path.
    Now typing python from a console gives the warning above.
    Worse, almost all conda operations crashed. Alas, I didn't make a copy of the crash report.
  • Following your suggestion, ran c:\Anaconda3\scripts\activate base.
    Now everything appears to work

I don't see anything about this topic in the trouble shooting section.

@mingwandroid
Copy link
Contributor

I think we should try to make our documentation about the correct command line usage of Anaconda Distribution to a more prominent location.

@PraveenGouchandra
Copy link

c:\Anaconda3\scripts>activate base This command worked for me too.

@rrigdon rrigdon self-assigned this Sep 23, 2019
@Adesoji1
Copy link

C:\Users\soj4y>python
Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32

Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation

Type "help", "copyright", "credits" or "license" for more information.

How do I activate the environment?

@mingwandroid
Copy link
Contributor

By running conda activate or using the Anaconda Prompt.

@mardhiah34
Copy link

@msarahan Thanks for this!

My experience today (September 12, 2019):

  • Downloaded Anaconda3-2019.07-Windows-x86_64.exe
  • Installed Anaconda3 in c:\Anaconda3, with raised permissions, without setting the path in the installer. Not surprisingly, python is not found.
  • Added c:\Anaconda3 and c:\Andaconda3\scripts to the path.
    Now typing python from a console gives the warning above.
    Worse, almost all conda operations crashed. Alas, I didn't make a copy of the crash report.
  • Following your suggestion, ran c:\Anaconda3\scripts\activate base.
    Now everything appears to work

I don't see anything about this topic in the trouble shooting section.

hi can you give the proper documentation for this,because im new here. i already followed this step. but when ran the c:\Anaconda\scripts\activate base. The python still appear the same message as above. Please need your consultation.

@mardhiah34
Copy link

admin is also called "elevation" and yes, this is very different from the "activation" that the warning message is telling you to do.

Even without any CONDA_BAT being set, running

<path to miniconda>\Scripts\activate base

works for me. I'm not sure what's causing the system to not be able to find something. It might be spaces or something like that in your install path. With the information you've provided, we can't say anything more. Please always fill out the info requested by the issue template.

need your help

@ephantusGachomba
Copy link

  • Anaconda3\scripts\activate base

thanks for this.worked perfectly

@github-actions
Copy link

Hi there, thank you for your contribution to Conda!

This issue has been automatically locked since it has not had recent activity after it was closed.

Please open a new issue if needed.

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Aug 23, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity
Projects
None yet
Development

No branches or pull requests

10 participants