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] Python 3.6.8 environment has not been activated #8487

Closed
ext2ed opened this issue Apr 3, 2019 · 21 comments
Closed

[Windows] Python 3.6.8 environment has not been activated #8487

ext2ed opened this issue Apr 3, 2019 · 21 comments
Labels
locked [bot] locked due to inactivity

Comments

@ext2ed
Copy link

ext2ed commented Apr 3, 2019

Current Behavior

I am using conda's default base environment. The version I downloaded is 2018.12 and the default version is Python 3.7.1, so I want to change it to Python 3.6.8. But when I changed to 3.6.8, the warning environment was not activated, and when I changed to 3.6.7, there was no warning.

Steps to Reproduce

Python 3.6.8 |Anaconda, Inc.| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)] 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.

>>>

Expected Behavior

And I have activated my base environment or reboot my PC.But When I used Python version 3.6.7, the warning disappeared. On the previous computer, about a few months ago, Python 3.6.8 installed did not have this warning too.So I don't know how to do it.Plz help me.

Environment Information

`conda info`


PS C:\Users\Admin> conda info



     active environment : None

       user config file : C:\Users\Admin\.condarc

 populated config files : C:\Users\Admin\.condarc

          conda version : 4.6.9

    conda-build version : 3.17.8

         python version : 3.6.8.final.0

       base environment : C:\Users\Admin\Anaconda3  (writable)

           channel URLs : https://repo.anaconda.com/pkgs/main/win-64

                          https://repo.anaconda.com/pkgs/main/noarch

                          https://repo.anaconda.com/pkgs/free/win-64

                          https://repo.anaconda.com/pkgs/free/noarch

                          https://repo.anaconda.com/pkgs/r/win-64

                          https://repo.anaconda.com/pkgs/r/noarch

                          https://repo.anaconda.com/pkgs/msys2/win-64

                          https://repo.anaconda.com/pkgs/msys2/noarch

          package cache : C:\Users\Admin\Anaconda3\pkgs

                          C:\Users\Admin\.conda\pkgs

                          C:\Users\Admin\AppData\Local\conda\conda\pkgs

       envs directories : C:\Users\Admin\Anaconda3\envs

                          C:\Users\Admin\.conda\envs

                          C:\Users\Admin\AppData\Local\conda\conda\envs

               platform : win-64

             user-agent : conda/4.6.9 requests/2.21.0 CPython/3.6.8 Windows/10 Windows/10.0.17763

          administrator : False

             netrc file : None

           offline mode : False

`conda config --show-sources`

PS C:\Users\Admin> conda config --show-sources

==> C:\Users\Admin\.condarc <==

ssl_verify: True

channels:

  - defaults

`conda list --show-channel-urls`

PS C:\Users\Admin> conda list --show-channel-urls

usage: conda-script.py [-h] [-V] command ...

conda-script.py: error: unrecognized arguments: --show-channel-urls

Thanks.

@mingwandroid
Copy link
Contributor

I am using conda's default base environment

How did you activate it?

when I changed to 3.6.7, there was no warning.

The warning is newer than python 3.6.7

@ext2ed
Copy link
Author

ext2ed commented Apr 3, 2019

I am using conda's default base environment

How did you activate it?

when I changed to 3.6.7, there was no warning.

The warning is newer than python 3.6.7

But a few months ago, Python 3.6.8, a Windows installation of mine, did not have this warning.And I have run "conda activate base" in cmd and powershell and Anaconda Prompt. It seems like not work.

@mingwandroid
Copy link
Contributor

mingwandroid commented Apr 3, 2019 via email

@ext2ed
Copy link
Author

ext2ed commented Apr 4, 2019

It does now. You need to activate the base env like any other.

On Wed, Apr 3, 2019, 9:56 AM Ah ! @.***> wrote: I am using conda's default base environment How did you activate it? when I changed to 3.6.7, there was no warning. The warning is newer than python 3.6.7 But a few months ago, Python 3.6.8, a Windows installation of mine, did not have this warning.And I have run "conda activate base" in cmd and powershell and Anaconda Prompt. It seems like not work. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#8487 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AA_pdJbwwi_Gvr2ZGV9l2xc2WmgxB32_ks5vdF67gaJpZM4cZxrC .

Thank you for your reply. It seems that the python version released in 2019 has this warning.

@andy-gh
Copy link

andy-gh commented May 19, 2019

I think this warning leads to confusion.

I always assumed that if I launch Python interpreter without activating any environment, it would use the base env by default. Just launch a fresh command prompt, type conda info --envs, and the base env will show with an asterisk, meaning it's the current one (and, I assume, is thus activated).

If this is true - if the base environment is activated by default, then I don't understand why this warning is showing up.

But if the base env is not activated by default, then conda info --envs should be amended not to show the asterisk for the base env, unless it is explicitly activated.

@mingwandroid
Copy link
Contributor

It's not activated, conda should refuse to operate really. PRs welcome..

@mingwandroid
Copy link
Contributor

If you do not like the warning set the env var permanently.

@andy-gh
Copy link

andy-gh commented May 19, 2019

If you do not like the warning set the env var permanently.

Which env var should I set permanently to remove the warning?

@mingwandroid
Copy link
Contributor

Ah sorry, CONDA_DLL_SEARCH_MODIFICATION_ENABLE .. Let me know if this works, I'm not so sure all of a sudden and away from a computer.

@mingwandroid
Copy link
Contributor

But be aware you'll not be properly activated and we'll be avoiding being informed of that. Conda working is a bug, other things will not.

@andy-gh
Copy link

andy-gh commented May 19, 2019

CONDA_DLL_SEARCH_MODIFICATION_ENABLE seems to have no effect on the warning, but I got your point:

  1. Having "base" environment as default does not mean it is activated: the activation scripts for the packages do not run unless conda activate is explicitly called.
  2. Running python scripts without priorly activating an environment is possible but issues may arise due to (1).

Basically this means that if I want to run my python code properly, I should ideally have a startup script, which would call conda activate first, then run the python script, then call conda deactivate. This is the clean way to do things.

@msarahan
Copy link
Contributor

or try
conda run -p <path to env> python script.py
or
conda run -n <name of env> python script.py

these effectively write the wrapper script for you.

@sudheerExperiments
Copy link

Current Behavior

I am using conda's default base environment. The version I downloaded is 2018.12 and the default version is Python 3.7.1, so I want to change it to Python 3.6.8. But when I changed to 3.6.8, the warning environment was not activated, and when I changed to 3.6.7, there was no warning.

Steps to Reproduce

Python 3.6.8 |Anaconda, Inc.| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)] 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.

>>>

Expected Behavior

And I have activated my base environment or reboot my PC.But When I used Python version 3.6.7, the warning disappeared. On the previous computer, about a few months ago, Python 3.6.8 installed did not have this warning too.So I don't know how to do it.Plz help me.

Environment Information

`conda info`


PS C:\Users\Admin> conda info



     active environment : None

       user config file : C:\Users\Admin\.condarc

 populated config files : C:\Users\Admin\.condarc

          conda version : 4.6.9

    conda-build version : 3.17.8

         python version : 3.6.8.final.0

       base environment : C:\Users\Admin\Anaconda3  (writable)

           channel URLs : https://repo.anaconda.com/pkgs/main/win-64

                          https://repo.anaconda.com/pkgs/main/noarch

                          https://repo.anaconda.com/pkgs/free/win-64

                          https://repo.anaconda.com/pkgs/free/noarch

                          https://repo.anaconda.com/pkgs/r/win-64

                          https://repo.anaconda.com/pkgs/r/noarch

                          https://repo.anaconda.com/pkgs/msys2/win-64

                          https://repo.anaconda.com/pkgs/msys2/noarch

          package cache : C:\Users\Admin\Anaconda3\pkgs

                          C:\Users\Admin\.conda\pkgs

                          C:\Users\Admin\AppData\Local\conda\conda\pkgs

       envs directories : C:\Users\Admin\Anaconda3\envs

                          C:\Users\Admin\.conda\envs

                          C:\Users\Admin\AppData\Local\conda\conda\envs

               platform : win-64

             user-agent : conda/4.6.9 requests/2.21.0 CPython/3.6.8 Windows/10 Windows/10.0.17763

          administrator : False

             netrc file : None

           offline mode : False

`conda config --show-sources`

PS C:\Users\Admin> conda config --show-sources

==> C:\Users\Admin\.condarc <==

ssl_verify: True

channels:

  - defaults

`conda list --show-channel-urls`
Thanks.

I had the same issue. The only method that worked for me is to reinstall Anaconda and update it to the latest version. You can try this if you have nothing to lose.

Best Regards,
Sudheer.

@neoformit
Copy link

neoformit commented Jul 9, 2019

I just reinstalled the lastest Anaconda3 and I am still having this problem.

The only way that I can run Python is to launch it from Anaconda Prompt (i.e. cmd with the base environment activated). If I run a python script or interpretter any other way, the environment is not properly configured and fails on a DLL load error if I try to load numpy or sqlite3:

DLL load failed: The specified module could not be found.

Given that I have a fresh installation there must have been a pretty serious bug introduced in a recent update, as this was never a problem for me. Now it renders Anaconda pretty useless as an environment manager. Until it's fixed I'll probably switch to using virtualenv.

Just to be clear, there are no spaces in the Anaconda install path:
C:\Users\Public\Anaconda

It is strange that other users don't seem to be experiencing this issue though.

@msarahan
Copy link
Contributor

msarahan commented Jul 9, 2019

Did you read the other posts from @mingwandroid and I? You can set an env var to make it work. This isn't going to be fixed because it isn't a bug. We give you several ways to make it work:

  • Anaconda prompt or other manual activation
  • conda run
  • CONDA_DLL_SEARCH_MODIFICATION_ENABLE environment variable

We describe why activation is necessary in https://conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#numpy-mkl-library-load-failed

@msarahan msarahan closed this as completed Jul 9, 2019
@andy-gh
Copy link

andy-gh commented Jul 9, 2019

You are risking to alienate many users with such emotional responses. I think there is a clear requirement expressed by many users so far: the default conda env should be available and pre-activated any time the OS command prompt is launched. Many users (including myself) don't even use multiple environments and they simply rely on conda as a convenient packages manager.

I am personally thinking of getting rid of conda and reverting to plain old python + pip.

@msarahan
Copy link
Contributor

msarahan commented Jul 9, 2019

I'm sorry you found a harsh tone there. It was not intended. We have spent hundreds of hours fighting DLL loading issues on Windows. The options I present above are the options that we have found to work the best. Activation is important for the base environment, too. With conda 4.6, we introduced a command, conda init, that sets up cmd.exe to have the pre-activation behavior that you mention. There's discussion at #8211 about users who want conda available, but not activated by default.

That auto-activation applies to cmd.exe, powershell, and other shells, but does not affect IDEs. IDEs have been adding support for activation.

FWIW, my understanding is that Microsoft's direction is to only load libraries from the immediate folder of an application. This will clear up the DLL confusion, but at great cost in efficiency.

We won't support calling python.exe directly without activation, because we know that is very likely to cause problems and support issues for us. We try to guide people away from paths that we know have problems. We are always looking for a better path (something like RPATH on linux/mac), but we're not there yet. Thus, my 3 recommendations above, plus conda init, are the best we have right now.

@neoformit
Copy link

@msarahan I have added the CONDA_DLL_SEARCH_MODIFICATION_ENABLE environment variable as you suggested, that seems to have fixed the DLL loading issue, great!
I ran conda init in anaconda prompt and I can now open a usable python terminal directly and import all my packages. I can also use the conda command from a regular cmd terminal as you described (although I am happy to use Anaconda promt for any command-line stuff).

So your solutions seem to work great, thank you for explaining the problem. I understand that many users want to activate their environments manually every time, but as andy-gh said, many people just want to run in the base environment 99% of the time. Perhaps you could try and make these solutions more apparent in the docs? I previously read through this page and found no mentions of the issue or these solutions: https://conda.io/activation

@carrote
Copy link

carrote commented Sep 17, 2019

IDEs have been adding support for activation

It seems cannot work in Eclipse+pyDev
image
After adding the CONDA_DLL_SEARCH_MODIFICATION_ENABLE environment variable, every thing is ok!

@retsyo
Copy link

retsyo commented Feb 10, 2020

@andy-gh, I agree with you. till anconda python 3.6.6, conda works
but then everything goes bad.

I use scite to edit and run python code on windows 7 64 bits

  1. I try to update no matter conda.exe or python.exe in my working python 3.6.6 via conda update xx
  2. I try to installed Anaconda3-2019.10-Windows-x86_64.exe

but no matter for fresh ( I mean I move my python 3.6.x to a U-disk) installed python from Anaconda3-2019.10-Windows-x86_64.exe or python 3.6.10 updated from 3.6.6, when I import scipy, it shows some dll can not be found.
for python 3.6.x, to fix the problem, I have to download and decompress numpy/scipy from https://www.lfd.uci.edu/~gohlke/pythonlibs/ by myself to my python 3.6.x,

for Anaconda3-2019.10-Windows-x86_64, I have to uninstalled it, because I do not know whether there are more pacakges I have to install by hand.

I miss the day that conda is an real easy-to-use tool. I have to stick to python 3.6.6( and 3.6.10 with the warning every time) and think to stop suggesting anaconda python for my classroom.

@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 24, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 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

8 participants