nb_conda
nb_conda copied to clipboard
Erroneous Environments Showing up in Conda Nb tab with error
Not sure how to fix this, or how it got corrupted.
Error Message: EnvironmentLocationNotFound: Not a conda environment
Pics Below:
Seems this could be related to conda instal plotly which upgraded conda and anaconda. Does anyone think that is related?
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.
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.
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']]
The method worked for me too, but the path should be anaconda_dir/lib/python3.6/site-packages/nb_conda/envmanager.py
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?
Yes, just modify the envmanager.py
file, which can fix the problem.
I added @voidworker's fix to pull request #75, which also fixes some other issues with conda>=4.4
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.
- 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
- 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).
Thank you for your time.
José.
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é
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
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.
voidworker's fix solved problem, and don't forget to restart jupyter notbook.
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 ?
Any plans to get this fixed once for all?
More than a year an a half in..can we get this bug fixed?
Yes, just modify the
envmanager.py
file, which can fix the problem.
how to do all of this?? Can u elaborate it?
I fix the envmanager.py, but it seems appears one new bug’ EnvironmentLocationNotFound’. Not a good thing to me...
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](https://user-images.githubusercontent.com/1457728/67786115-4a088480-faa9-11e9-835e-183a4fc53003.png)
Another super-duper tip: consider switching to to https://github.com/fcollonval/jupyter_conda :)
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
The method worked. Funny - this bug still exist as of today.
@marcellovirzi nothing really funny about it, this extension is completely abandoned by the anaconda team. No commit since July 2017...
@marcellovirzi nothing really funny about it, this extension is completely abandoned by the anaconda team. No commit since July 2017...
Yeah, I was ironic...
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.
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.
Solved! Thanks
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.
@schultzm Are you working in Linux OS? I searched for that environment variable on Windows 10 and cannot find it.
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