Search code examples
terminalanacondaimporterror

Anaconda Modules Inaccessible


Disclaimer: something went wrong with my Anaconda environment at one point and my best guess was simply to uninstall/reinstall Anaconda, but now I have been getting the following errors.

I have reinstalled Anaconda successfully, and can verify the presence of various modules. However, when I try to call any given module in Terminal (e.g., jupyter notebook) I get a variation of the following error:

Traceback (most recent call last):
  File "/Users/MYNAME/anaconda3/bin/jupyter", line 7, in <module>
    from jupyter_core.command import main
ImportError: No module named jupyter_core.command

I do not have sufficient experience with command line programming to decipher other posts on this topic... I'm assuming there's a problem with the executable paths or something? If it helps, here is the output of conda info for me:

     active environment : None
            shell level : 0
       user config file : /Users/MYNAME/.condarc
 populated config files : /Users/MYNAME/.condarc
          conda version : 4.6.8
    conda-build version : 3.17.6
         python version : 3.7.1.final.0
       base environment : /anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/osx-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /anaconda3/pkgs
                          /Users/MYNAME/.conda/pkgs
       envs directories : /anaconda3/envs
                          /Users/MYNAME/.conda/envs
               platform : osx-64
             user-agent : conda/4.6.8 requests/2.21.0 CPython/3.7.1 
Darwin/18.5.0 OSX/10.14.4
                UID:GID : MYUID
             netrc file : None
           offline mode : False

Solution

  • Just reinstall jupyter notebook under that specific conda virtual environment. Like:
    balabala$ conda activate tensorflow_gpuenv
    balabala$ pip install jupyter
    (I am using ubuntu.)