anaconda-graveyard / nb_anacondacloud

Interact with Anaconda Cloud
BSD 2-Clause "Simplified" License
5 stars 9 forks source link

Error loading nb_anacondacloud in conda environment #34

Closed mick-d closed 7 years ago

mick-d commented 7 years ago

I am simply running jupyter in a conda environment but get this error from nb_anacondacloud. It seems to be because conda cannot be installed in any other environment than the root environment (hence not possible to import the module conda in an environment).

(sci35 environment activated) jupyter notebook

[I 16:13:27.611 NotebookApp] [nb_conda_kernels] enabled, 5 kernels found
[I 16:13:27.623 NotebookApp] Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret
[I 16:13:27.891 NotebookApp] ✓ nbpresent HTML export ENABLED
[W 16:13:27.891 NotebookApp] ✗ nbpresent PDF export DISABLED: No module named 'nbbrowserpdf'
[I 16:13:27.912 NotebookApp] [nb_conda] enabled
[W 16:13:28.843 NotebookApp] Error loading server extension nb_anacondacloud
    Traceback (most recent call last):
      File "/my_python_envs/sci35/lib/python3.5/site-packages/binstar_client/utils/conda.py", line 22, in get_conda_root
        import conda.config
    ImportError: No module named 'conda'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/my_python_envs/sci35/lib/python3.5/site-packages/notebook/notebookapp.py", line 1046, in init_server_extensions
        mod = importlib.import_module(modulename)
      File "/my_python_envs/sci35/lib/python3.5/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 986, in _gcd_import
      File "<frozen importlib._bootstrap>", line 969, in _find_and_load
      File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 665, in exec_module
      File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
      File "/home/michael/python_envs/sci35/lib/python3.5/site-packages/nb_anacondacloud/__init__.py", line 3, in <module>
        from .handlers import load_jupyter_server_extension
      File "/my_python_envs/sci35/lib/python3.5/site-packages/nb_anacondacloud/handlers.py", line 10, in <module>
        from binstar_client import errors
      File "my_python_envs/sci35/lib/python3.5/site-packages/binstar_client/__init__.py", line 14, in <module>
        from .utils import compute_hash, jencode, pv
      File "/my_python_envs/sci35/lib/python3.5/site-packages/binstar_client/utils/__init__.py", line 15, in <module>
        from .config import (get_server_api, get_binstar, dirs,
      File "/my_python_envs/sci35/lib/python3.5/site-packages/binstar_client/utils/config.py", line 22, in <module>
        from binstar_client.utils.conda import CONDA_PREFIX, CONDA_ROOT
      File "/my_python_envs/sci35/lib/python3.5/site-packages/binstar_client/utils/conda.py", line 41, in <module>
        CONDA_ROOT = get_conda_root()
      File "/my_python_envs/sci35/lib/python3.5/site-packages/binstar_client/utils/conda.py", line 34, in get_conda_root
        conda_info = json.loads(subprocess.check_output([CONDA_EXE, 'info', '--json']))
      File "/my_python_envs/sci35/lib/python3.5/json/__init__.py", line 312, in loads
        s.__class__.__name__))
    TypeError: the JSON object must be str, not 'bytes'
[I 16:13:28.908 NotebookApp] Serving notebooks from local directory: /my/local/dir
[I 16:13:28.909 NotebookApp] 0 active kernels 
[I 16:13:28.909 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 16:13:28.909 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
damianavila commented 7 years ago

Can you report back the anaconda-client version? Thanks!

mick-d commented 7 years ago

1.5.3

Thanks!

damianavila commented 7 years ago

I think there is a compatibility issue with that version, can you try 1.5.1 and report back?

mick-d commented 7 years ago

Yes, downgrading to 1.5.1 solved the issue. Thanks a lot!

So as for now I assume one should keep the downgraded version to use with conda?

damianavila commented 7 years ago

So as for now I assume one should keep the downgraded version to use with conda?

I think so... until the compatibility issue is solved here...

damianavila commented 7 years ago

Tested master with anaconda-client 1.6.2 and it is working OK. Closing now.