Skip to content Skip to sidebar Skip to footer

Conda List Shows A Package But Cannot Import It

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 activate MyVirtEnv conda list |grep visdo

Solution 1:

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!

Solution 2:

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 .

Solution 3:

I unfortunately don't have a "Do exactly this to fix your problem" solution but I would suggest the following steps. Many seem obvious but I find when sorting these sorts of problems out you have to be certain of each step before moving on.

  1. Does the host system, in this case your Ubuntu VM, have multiple versions of python installed? Are you sure you are using the version you think you're using? Did you check your path variable? You need to be sure you're using your conda installation.
  2. Does the host system have different versions of conda installed?
  3. It looks like in the activated environment you checked the package is listed in conda. But is it in the package directory for your virtual environment? One way to check this is to use the find command and specify the base path for your virtual environment.
  4. Try forcing the reinstallation of the package.
  5. Try using pip instead of conda. If your environment is setup properly pip should install packages to the conda path.

more desperate steps

  1. Make a new virtual environment. Add packages one by one. Examine what each package is changing.
  2. Reinstall conda.
  3. Create a new instance of your vm.
  4. Make a vm instance from a different image.
  5. Make your own image.

This is just one way to troubleshoot the problem. When possible try to avoid steps 6-10 because they're rather involved. That said sometimes it's a problem with the vm and not with you.

Solution 4:

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.

Solution 5:

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.

Post a Comment for "Conda List Shows A Package But Cannot Import It"