1

On Ubuntu 16.04 I have a virtualenv (15.0.2). I did install matplotlib 1.5.3 and I get this error:

import _tkinter # If this fails your Python may not be configured for Tk
ImportError: libBLT.2.4.so.8.6: cannot open shared object file: No such file or directory

Thanks

2
  • I have notice this question earlier, but it doesn't mention virtualenv. Commented Oct 22, 2016 at 11:46
  • 2
    I have solved this issue thanks to this stackoverflow.com/questions/29433824/… typing commands "pip uninstall matplotlib" and "pip install matplotlib==1.4.3" on my virtualenv. Commented Oct 22, 2016 at 14:23

1 Answer 1

2

I'm presuming you are using python3.

First of all, type help('modules') in your python shell. This should return all modules that are currently installed. If tkinter is not listed there, try the following:

import sysconfig
print(sysconfig.get_paths())

This will print out all the paths in which python is looking modules. Move your tkinter module to one of the folders listed above (it should usually be site-packages but that might depend on your python set-up.

If that still doesn't solve the issue, try

sudo apt-get install python python-tk idle python-pmw python-imaging

If you are using ubuntu, python libraries should include tkinter. Hence the code above is re-installing python.

Hope I could help, Narusan

Sign up to request clarification or add additional context in comments.

5 Comments

Sorry, missing data, I am using python 2.7.9. I did try to install matplotlib in standard python installation (/usr/bin/..) and it works perfectly, so I suppose I have all the libraries. The problem comes out when I run the code with my virtualenv interpreter. In this case, there's something wrong with tk, which is not installable on virtualenv using commands:
cd .../path/to/env , source/bin/activate , pip install tk
Seems that the command "sudo apt-get install python python-tk idle python-pmw python-imaging" did solve my issue. Sorry I cannot +1 your answer. Thanks a lot!!!!
Sorry, it didn't solve. I still have this problem. It does work on my standard python but it doesn't on virtualenv..
Glad that you could solve it. Wish you the best of luck with it!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.