I want to be able to use the PIL library on a web hosting machine. The machine has Python 2.4.3 installed, but not the PIL library. I tried downloading the PIL source and putting the PIL folder into my directory. It kind of works, except when I need to do some actual image processing, which brings up an ImportError, saying that "The _imaging C module is not installed". Googling this, it seems like I would need to throw an _imaging.so file into the PIL folder, but I couldn't find a precompiled one online.
At this point, I'm not sure if I'm even on the right track. What should I do from here? Any help is appreciated.
Thanks.
You need to compile that module. Running the setup.py install command should do it for you, provided the host has a working compiler and the required libraries. You can use virtualenv to have it installed somewhere where you have rights to put files (by default it would try to install it system-wide).
If it doesn't have a working compiler and right libraries and header files, then you need to either compile it on another computer with the same architecture and copy it, or find the packages for whatever operating system your host is running and extract the right files from them.
By the way, just asking them to install PIL could work too!
I know this isn't a programmatic answer but ... you should switch webhosts.
There is no good reason to be using Python 2.4 and dealing with old stuff when so many problems have been fixed already. I recommend WebFaction but any host running a modern OS/Python installation is fine (Ubuntu is really the easiest at this point).
Related
I am having an issue getting OpenCV to work with python. I compiled from source using CMake in order to gain access to the SIFT module. Whenever I try to use openCV however, python returns the "No module named 'cv2'" error. It works fine when I install using pip but then I have no SIFT. My build directory is set as an environment variable and my bin directory is in my system path. There were no build issues and the applications that came with the build run fine. Is there another step that I have to perform, such as installing from the compiled project using pip? How do I get my openCV library, compiled from source, to be importable by python?
The solution ended up being both simpler and sloppier than I would have liked. I just installed the regular distribution using pip install opencv-contrib-python, then went into the cv2 folder in Lib/site-packages, replaced the python extension (cv2.cp36-win32.pyd in my case. may be different for others) with the .pyd file from my CMake build (build/lib/python3/Release) and copied everything from build/bin/Release into the Lib/site-packages/cv2 folder. It doesn't look pretty or organized but python can find everything now. If anyone has a cleaner way to do this I'd love to hear it.
I'm making a program that uses PyMySql and I'd like people to be able to run my program without going through the manual installation of PyMySql, is there a way I can achieve that?
I've already tried compiling to .pyc but that doesn't seem to work, in fact when I uninstall PyMySql it doesn't work anymore.
PS: There probably are better languages to do that but it's a homework assignment for school and can't use anything but python, also sorry for my bad english
Since PyMySQL has MIT license, you can redistribute it without any legal issues and also is a pure python implementation so it doesn't matter on which operative system it runs.
Just go to your python library folder and look for the module folder and copy it to your project folder, after that you can uninstall and python should be able to import it from your project folder and you just need to send your assignment with the module included.
The python library folder varies depending on your operative system, you can look at this answer on how to find the module location.
Use cx_freeze, pyinstaller or virtualenv.
Or copy code and put in your. Read python import
This is something I've been researching for past few hours but so far nothing come out of it.
Basically I have software that use Python 2.5.5. It does not have QT module in it.
So in my attempt to install it I did this.
Downloaded executable QT PyQt4-4.10.2-gpl-Py2.7-Qt4.8.4-x64. Run Exe. It installed in python 2.7 site-packages.
Then I moved that folder to my software Python 2.5.5. Now there was no site-packages folder so I created it.
Next step was to go over this instruction http://docs.python.org/2/install/ and use Alternate installation: Windows (the prefix scheme) with my file location from inside program. But I cant run python setup.py install --prefix="\Temp\Python" (with my location of python) because python is not defined and so on. I'm pretty sure thats the wrong way to do it. So how or where do I look for information as to how to do it? The software itself dont have any documentation.
Thanks, bye.
That binary version of PyQt4 only supports python2.7, so no matter what you do, you won't get it to run with python2.5.
The last PyQt4 version with a binary for python2.5 is PyQt4.9.4, so if you want to have any chance of making this work you should try with this version.
Note however that the software you distribute like this will also only run on python2.5.
I want to install SciPy, NumPy and MatplotLib globally so that the libraries can be accessed from network computers. Basically it should be in some network drive without full installation of the libraries on each remote computer.
Now I copied the site-package directory from one working installation into the network drive, but not surprisingly I now get "DLL load failed" (multiarray) errors when trying to import scipy from remote computers. I suppose there are DLLs missing.
What would be the easiest solution to this problem? Does anyone know which DLLs I need to copy to all remote computers or can I even have these DLLs on the network drive too inside PYTHONPATH?
In the docs, see : http://docs.python.org/install/index.html
"Alternate installation: Windows (the prefix scheme)"
"Modifying Python’s Search Path"
"Custom Installation"
may help you.
There is also the PYTHONHOME var used during install.
But frankly, I'm afraid you will not succeed doing this because the packages are compiled during installation, and compilers depends on CPU, vary from one PC to another (one has the minGW, other has the intel, third one has the borland ... ) and I think python packages do not use as much place, so that it makes sense to install on each computer, more than trying to deal with ONE install for everyone.
Unless you make sure everybody has the same C and fortran compilers... but even so, it will not be easy, i'm afraid.
I've got a python program that is using a ridiculous amount of extensions, so I'm trying to set up a virtualenv for it. However, one of the libraries it uses is PIL. After installing it, I get an import error on PIL.
This problem has been identified at the link below, but the solution there does not work for me (possibly because I'm using windows? I don't know.)
The problem with installing PIL using virtualenv or buildout
I used easy_install on the repackaged package in a fresh virtualenv, with no luck. Does anybody have ideas what might be causing this, or where to look to diagnose the problem?
The issue was whether I was importing PIL.Image or simply Image. The virtualenv used Image, whereas my Python installation used PIL.image.