Conda list shows a package but cannot import it

前端 未结 7 1734
野趣味
野趣味 2021-01-01 16:22

Here an issue i\'m having on a conda Virtual env. I\'m using ubuntu 64b guest on windows 7 host with Virtual Box.

So when i\'m doing :

source activat         


        
相关标签:
7条回答
  • 2021-01-01 16:56

    Seems to be deps related issue see here github , So maybe You should ensure that Anaconda is up-to-date so that you are working with all the latest package releases. To do this, you should first update the conda utility run : conda update conda , When prompted to do so, type y to proceed with the update. After that update anaconda also run : conda update anaconda Again when prompted to do so, type y to proceed , after updates finished open new terminal and verify : conda --version and : python --version

    • now try reinstalling visdom :conda install -n universe visdom --force-reinstall or just update all packages : conda install -n universe --update-all .

    0 讨论(0)
  • 2021-01-01 16:57

    Check the files installed for the package as per List installed files of a package? and compare the list with your sys.path.

    For visdom specifically, looking at the contents of the available Linux tarball, I see that it contains paths like lib/python3.6/site-packages -- i.e. it's for Python 3.6 while your Python is 3.5.

    0 讨论(0)
  • 2021-01-01 17:00

    A couple possibilities occur to me:

    1. A Potential Path Problem

    Your python command might refer to a different python than the python which is in your active conda environment folder. Check this by running in terminal which conda and which python. If you get something like the below, you're good here.

    /anaconda3/bin/conda
    /anaconda3/envs/<yourEnvName>/bin/python
    

    If you are getting different paths, it is possible your path is messed up. open up your .bashrc file and double check lines associated with python and conda.

    Alternatively, reinstall conda.

    2. A Very Vexing Version Variation

    You might have a version/dependency incompatibility issue. This seems unlikely to me as visdom is compatible with python 2.7 onward (I think) and you clearly are using python 3.5.2. Nonetheless, this might happen if you are using multiple package managers. Nowadays it is less common, but it does happen occasionally. Try checking this by running pip show visdom and/or conda search --reverse-dependency visdom or the equivalent for your package manager.

    If this is indeed a problem, then I suggest first updating your packages and if that does not work then uninstalling visdom with the original package manager and trying to install with a different package manager.


    If all of the above fails, start exploring your problem from a new environment. Can you replicate it in the new environment? (I can't). Can you replicate it on another machine? etc...

    Keep the internets updated with your problem as we might be able to help some others out!

    0 讨论(0)
  • 2021-01-01 17:04

    Realize this is a very old question but the same thing just happened to me after doing a conda update conda on my base environment on OSX and the package was numpy. Showed in conda list but could not be imported. What I did, which fixed it:

    conda activate base
    conda remove numpy
    conda install numpy
    

    This fixed things.

    0 讨论(0)
  • 2021-01-01 17:09

    I meet the same problem, and tried all the given solutions to solve this problem, they didn't work for me.
    Finally I just add the package installed directory to sys.path:

    import sys  
    sys.path.apend('/Users/eng/anaconda3/envs/paddle/lib/python2.7/site-packages')
    

    it workded.

    0 讨论(0)
  • 2021-01-01 17:16

    It might be an issue with file system permissions. This could happen if you have installed the package while under root. Try to run

    sudo chmod -R a+rX /home/deeplearning/anaconda3/envs/
    

    Drop the sudo if you are root in your VM terminal.

    0 讨论(0)
提交回复
热议问题