I have Python 2.6 running on Fedora 13. I installed PIL 1.1.7, and I get the successful installed message in the Python prompt. I am able to import PIL.PhotoImage,but when I try to run the following, I get an error.
mgobj = PhotoImage(file=imgpath)
Stacktrace:
Traceback (most recent call last):
File "viewer-tk.py", line 25, in <module>
imgobj = PhotoImage(file=imgpath) # now JPEGs work!
File "/home/Toshiba/vinpython/venv/lib/python2.6/site-packages/PIL/ImageTk.py", line 116, in __init__
self.paste(image)
File "/home/Toshiba/vinpython/venv/lib/python2.6/site-packages/PIL/ImageTk.py", line 181, in paste
import _imagingtk
ImportError: No module named _imagingtk
In the module ImageTk.py , I see _imagingtk being imported,but i am not sure how do it get that module.Help is greatly appreciated!!!
You need to install Tkinter python module as stated at this trac. But since it's an integral part of python distributions. Since you are using fedora take a look at this page where you can install Tkinter when it doesn't come along, even being for Fedora 3 I think it might help.
Related
First time Python user, so apologies if I am misunderstanding something basic like how libraries are accessed (I am an R user).
Using a colleague's code (which works on his end) and trying to load the the following:
from reportlab.lib import colors
results in the following error:
Traceback (most recent call last):
File "Box\Py\Python3\Py3_StaticMain.py", line 32, in <module>
from reportlab.lib import colors
File "C:\Program Files\Python310\lib\site-packages\reportlab\lib\colors.py", line 44, in <module>
from reportlab.lib.utils import asNative, isStr, rl_safe_eval
File "C:\Program Files\Python310\lib\site-packages\reportlab\lib\utils.py", line 389, in <module>
haveImages = Image is not None
NameError: name 'Image' is not defined
Pillow and reportlab are installed. After searching online I found similar error reports and the solution was to add this line prior to the previous library call (again, my colleague does need this on his end):
from PIL import Image
However, this did not fix the problem, the error persists. Also of note both these lines get greyed out by PyCharm which apparently means that these libraries are already loaded so these lines are unnecessary? It is counter intuitive that an unnecessary command would cause an error. The other libraries imported are os.path, sys, datetime, and tkinter. Also, even if I just put these two lines in a new py file I get the same behavior: greyed out and error.
Not a very satisfying answer but after uninstalling and reinstalling both Python and the IDE everything worked.
Currently I am using Python 3.7, and Ubuntu 18.04. I downloaded wxPython from pip, but when I tried to import wx in my terminal, I get this error:
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/aleejandrof/anaconda3/lib/python3.7/site-packages/wx/__init__.py", line 17, in <module>
later on, when I tried other ways like and "._core import" I received an error like this:
ImportError: /home/aleejandrof/anaconda3/bin/../lib/libpangoft2-1.0.so.0: undefined symbol: pango_font_description_set_variations
After reading some posts here, I tried deleting the wx.py and wx.pyc files, which didn't work. The same happened when I read that downloading the main excecutable file would make the import occur with no errors, but it popped the same errors.
AttributeError: module 'wx' has no attribute '__version__'
I am trying to run a GUI pipeline, which works with wxPython. I'm thankful in advance, if any of you has suggestions.
When I made an environment of ubuntu18.04 using docker, ran into the same problem.
I had multiple libpangoft2-1.0.so.0 files.
It seemed the problem was /opt/conda/lib/libpangoft2-1.0.so.0 was looked up.
To change the name of the file solved the problem.
find / -name libpangoft2-1.0.so.0
/opt/conda/lib/libpangoft2-1.0.so.0
/opt/conda/pkgs/pango-1.42.4-h049681c_0/lib/libpangoft2-1.0.so.0
/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0
mv /opt/conda/lib/libpangoft2-1.0.so.0 /opt/conda/lib/libpangoft2-1.0.so.0-void
You may want to try:
conda install -c asmeurer pango
I downloaded this library: https://github.com/bufferapp/buffer-python
Ran the setup.py install, and then tried to run some code using the newly installed library.
What happens though is I get this error:
Traceback (most recent call last):
File "twitter-quote-bot.py", line 14, in <module>
from buffpy.managers.profiles import Profiles
ImportError: No module named managers.profiles
The only way I've found to fix it is to move my program (twitter-quote-bot) into the downloaded folder from Buffer and run it there.
Did I do something wrong in the installation? It seems like I should be able to do these imports globally.
Thanks in advance!
I'm trying to run the hello world tutorial for the Google app engine in Go language. The GAE SDK for go is based on python 2.5, which I installed. I then had to install openssl, but now when I try to run my sample application on the SDK, I get the following error:
ImportError: No module named _md5
I even tried a simple import md5 & import hashlib from the python interpreter interface, and i still get the same error
>>> import hashlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.5/hashlib.py", line 133, in <module>
md5 = __get_builtin_constructor('md5')
File "/usr/local/lib/python2.5/hashlib.py", line 60, in __get_builtin_constructor
import _md5
ImportError: No module named _md5
Does anybody know a workaround for this? Thank you!
I have a feeling that this problem is really about python installation than anything else
Your problem has nothing to do with GAE, or the SDK. I have faced this before. If you tried to install your custom version of python (on Ubuntu), then you land up with such issues. You should uninstall the custom python using checkinstall. More details can be found about there here: Uninstall python built from source?.
Just use the default python and you'll be fine!
First of all, I did successfully compile and install VTK, as it can be seen from the following message
Installed /tmp/yifli/lib/python2.6/site-packages/VTK-5.8.0-py2.6.egg
However , when I try to import vtk, I got the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/yifli/lib/python2.6/site-packages/VTK-5.8.0-py2.6.egg/vtk/__init__.py", line 124, in <module>
__helper.refine_import_err('qvtk', 'vtkQtPython', exc)
File "/tmp/yifli/lib/python2.6/site-packages/VTK-5.8.0-py2.6.egg/vtk/__helper.py", line 32, in refine_import_err
raise LinkError, str(exc)
vtk.__helper.LinkError: /tmp/yifli/lib/vtk-5.8/libQVTK.so.5.8: undefined symbol: _ZN19QAbstractProxyModel11setItemDataERK11QModelIndexRK4QMapIi8QVariantE
And all the tests failed when I run 'ctest -R Python' in the building directory.
Any help is highly appreciated.
This looks like you built with Qt support, QVTK is the Qt widget(s) to support VTK render window. You have an issue with an undefined symbol from Qt (QAbstractProxyModel), likely due to compiling with a newer Qt than that available when you import the VTK python module. Running,
ldd /tmp/yifli/lib/vtk-5.8/libQVTK.so.5.8
would show you which Qt library it is trying to link to.