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

Erroneous Environments Showing up in Conda Nb tab with error #66

Open
joethequant opened this issue Dec 28, 2017 · 30 comments
Open

Erroneous Environments Showing up in Conda Nb tab with error #66

joethequant opened this issue Dec 28, 2017 · 30 comments

Comments

@joethequant
Copy link

joethequant commented Dec 28, 2017

Not sure how to fix this, or how it got corrupted.

Error Message:
EnvironmentLocationNotFound: Not a conda environment

Pics Below:
image

image

@joethequant
Copy link
Author

Seems this could be related to conda instal plotly which upgraded conda and anaconda. Does anyone think that is related?

@joethequant
Copy link
Author

Okay this looks like there is actually a bigger issue with the new anaconda version. Conda_NB is not compatible with newest versions of Anaconda and Conda.

@voidworker
Copy link

The reason is the change of conda info --json output. Fresh installation of version 4.3.33 gives envs=[], version >=4.4 gives envs=[root_env_dir] (always non empty).
Fix:
Replace for env in info['envs']] with for env in info['envs'] if env != info['root_prefix']] in nb_conda/envmanager.py.
You may do it in anaconda_dir/pkgs/nb_conda-2.2.1-py36h8118bb2_0/lib/python3.6/site-packages/nb_conda/envmanager.py on your machine, if you don't want to wait for update.
At least it removes annoying error message and kernels list entry in "Conda" tab.

Variety of kernels in the "New" button is still here, though.

@wonderlives
Copy link

The above method solved the problem.
Just remember to change your path anaconda_dir/pkgs/nb_conda-2.2.1-py36h8118bb2_0/lib/python3.6/site-packages/nb_conda/envmanager.py to your local setting.

But keep the for env in info['envs'] if env != info['root_prefix']]

@jyepesr1
Copy link

jyepesr1 commented Apr 3, 2018

The method worked for me too, but the path should be anaconda_dir/lib/python3.6/site-packages/nb_conda/envmanager.py

@lucainnocenti
Copy link

Had the same problem, and fixed it modifying the envmanager.py file in the directory pointed out by jyepesr1.

Should a pull request be done to fix this?

@ZenRay
Copy link

ZenRay commented May 30, 2018

Yes, just modify the envmanager.py file, which can fix the problem.

@tjd2002
Copy link

tjd2002 commented May 30, 2018

I added @voidworker's fix to pull request #75, which also fixes some other issues with conda>=4.4

@jrd10
Copy link

jrd10 commented Jun 24, 2018

Hi,
I have the same issue with the same error message.
I have conda 4-5-4 and Jupyter 5.5.0

My environment in Anaconda Navigator works well shows the right one as in Conda terminal.

But in Jupyter, tab Conda, I have got the same issue as above.

  1. I modify the envmanager.py as mentionned above (with voidworker and jyepesr1 path) and now... the envronment list in Jupyter is empty :( ! with this message:

An error occurred while listing Conda environments. Not Found

  1. I reinstalled Anaconda, always the issue!

Please, note I think this problem come from the "Clone" fonction in Anaconda Navigator. I wanted to clone the Root environment in order to copy it as a new fixed environment :(
I think it is a bad idea!

(The next time, I will create a new environment and I will install Anaconda and the packages I need :).

------------ The complete error message: -----------------
[I 18:13:06.057 NotebookApp] [nb_conda_kernels] enabled, 6 kernels found
[I 18:13:07.182 NotebookApp] JupyterLab beta preview extension loaded from C:\Anaconda3\lib\site-packages\jupyterlab
[I 18:13:07.182 NotebookApp] JupyterLab application directory is C:\Anaconda3\share\jupyter\lab
[W 18:13:07.633 NotebookApp] Error loading server extension nb_conda
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 1481, in init_server_extensions
mod = importlib.import_module(modulename)
File "C:\Anaconda3\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in call_with_frames_removed
File "C:\Anaconda3\lib\site-packages\nb_conda_init
.py", line 3, in
from .handlers import load_jupyter_server_extension
File "C:\Anaconda3\lib\site-packages\nb_conda\handlers.py", line 25, in
from .envmanager import EnvManager, package_map
File "C:\Anaconda3\lib\site-packages\nb_conda\envmanager.py", line 85
for env in info['envs'] if env != info['root_prefix']]]
^
SyntaxError: invalid syntax
[I 18:13:07.791 NotebookApp] Serving notebooks from local directory: C:\Users\RLE
[I 18:13:07.792 NotebookApp] 0 active kernels
[I 18:13:07.792 NotebookApp] The Jupyter Notebook is running at:
[I 18:13:07.792 NotebookApp] http://localhost:8888/?token=51c96d41a92da45efd892bba3c2b29fb06679f123587f704
[I 18:13:07.792 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 18:13:07.795 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=51c96d41a92da45efd892bba3c2b29fb06679f123587f704&token=51c96d41a92da45efd892bba3c2b29fb06679f123587f704
[I 18:13:07.859 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[W 18:13:11.938 NotebookApp] 404 GET /conda/environments?=1529856788669 (::1) 23.00ms referer=http://localhost:8888/tree
[W 18:13:11.946 NotebookApp] 404 GET /conda/packages/available?
=1529856788670 (::1) 4.00ms referer=http://localhost:8888/tree


Please note too that Jupyter works perfectly (except conda tab).

image

Thank you for your time.

José.

@jrd10
Copy link

jrd10 commented Jun 24, 2018

Please note I installed

  • nb_conda (2.2.1)
  • and nb_conda_kernels (2.1.0)
    from conda-forge...

I wonder if it has been a good idea

José

@xpros
Copy link

xpros commented Jul 20, 2018

We are working on upgrading our JupyterHub instance to use version 0.9.1 and Conda version 4.5.8.

If, after a fresh Conda install, we attempt to use the root/base environment we see the error in https://github.com/Anaconda-Platform/nb_conda/issues/66, but we have worked around that by creating a new Conda environment specifically for JupyterHub.

As an example:
conda create -n jupyterhub python=3 jupyterhub=0.9.1

@tjd2002
Copy link

tjd2002 commented Jul 20, 2018

I've got a PR here (#75) that includes @voidworker's fix for this, as well as some other Conda 4.4 issues, but there doesn't seem to be much movement on it. @fjcapdevila are you still a maintainer?

@jrelland it looks like you just made a typo when manually applying the fix: In the line marked as containing a 'Syntax error' there's an extra square bracket at the end of the line.

@sngjuk
Copy link

sngjuk commented Oct 1, 2018

voidworker's fix solved problem, and don't forget to restart jupyter notbook.

@Wafaashabrawishi
Copy link

The method worked for me too, but the path should be anaconda_dir/lib/python3.6/site-packages/nb_conda/envmanager.py

where can i do that ?

@lduhem
Copy link

lduhem commented May 14, 2019

Any plans to get this fixed once for all?

@shailensobhee
Copy link

More than a year an a half in..can we get this bug fixed?

@avipeddi
Copy link

Yes, just modify the envmanager.py file, which can fix the problem.

how to do all of this??
Can u elaborate it?

@leoyinhaiqing
Copy link

I fix the envmanager.py, but it seems appears one new bug’ EnvironmentLocationNotFound’. Not a good thing to me...

@DerekChia
Copy link

I'm getting this error after applying the for env in info['envs'] if env != info['root_prefix']] fix.

Screenshot 2019-10-30 00 06 41

@voidworker
Copy link

Another super-duper tip: consider switching to to https://github.com/fcollonval/jupyter_conda
:)

@EuniceOyeniyi
Copy link

The method worked for me too, but the path should be anaconda_dir/lib/python3.6/site-packages/nb_conda/envmanager.py

where can i do that ?

please have you been able to do this

@marcellovirzi
Copy link

The method worked.
Funny - this bug still exist as of today.

@zertrin
Copy link

zertrin commented Apr 23, 2020

@marcellovirzi nothing really funny about it, this extension is completely abandoned by the anaconda team. No commit since July 2017...

@marcellovirzi
Copy link

@marcellovirzi nothing really funny about it, this extension is completely abandoned by the anaconda team. No commit since July 2017...

Yeah, I was ironic...

@sentinel09
Copy link

Resolved this issue by replacing for env in info['envs']] with for env in info['envs'] if env != info['root_prefix']] in /opt/conda/lib/python3.8/site-packages/nb_conda/envmanager.py.
Replacing these string in /opt/conda/pkgs/nb_conda-2.2.1-py38h32f6830_4/lib/python3.8/site-packages/nb_conda/envmanager.py did not help me.

After this I have only one default environment root and no annoying message.

@wolfofsiliconvalley
Copy link

Can someone please explain the solution as simple as possible. I'm almost pulling my hair out trying to figure out where 'for env in info[ 'envs' ] ] is and how to replace it with 'for env in info[ 'envs' ] if env != info[ 'root_prefix' ] ] in /opt/conda/lib/python3.8/site-packages/nb_conda/envmanager.py. Someone help please.

@wolfofsiliconvalley
Copy link

Solved! Thanks

@schultzm
Copy link

schultzm commented Feb 4, 2021

None of this worked for me as my issue was slightly different, but I found the removed environment that was being returned in the error was stored in the environment variable $CONDA_PREFIX. After exporting a new $CONDA_PREFIX (or relaunching terminal), the error went away.

@richlysakowski
Copy link

@schultzm Are you working in Linux OS? I searched for that environment variable on Windows 10 and cannot find it.

@richlysakowski
Copy link

nb_conda is unsupported ?

The directory referenced in another to manually fix it does not exist on Windows 10.

anaconda_dir/lib/python3.6/site-packages/nb_conda/envmanager.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests