Need help installing PIL to use Django ImageField - python

I am a novice at these things. I have been all over the internet looking for a way to get around this error :
unable to execute gcc-4.2: No such file or directory
error: command 'gcc-4.2' failed with exit status 1
When trying to install the Python Image Library, I get this error each time I run :
python setup.py install
I have tried a number of solutions given on this site and others across the web and no luck.
I have tried installing PIL with Macports which seemed to work but when I ran syncdb on my Django models it told me to install PIL.
Kind of lost at the moment. Is there anyone who has a tested, fool-proof way to get around this problem?

In my experience PIL is a nightmare to build and install unless you are using pip. Try creating a virtualenv and then installing PIL inside it with:
pip install PIL
I have PIL running fine on Snow Leopard with Python 2.7 out of MacPorts with this technique.
If you have trouble getting virtualenv up and running, I suggest virtualenv-burrito, which will set everything up for you automatically.

Related

Error occurred when installing package ‘Cartopy’

I have installed all libraries we need on this project except ‘’ Cartopy library ‘’ in Pycharm. After some research I thought it might be due to the python version so I tried dowloading the Cartopy Library in about 5 different Python versions and again the Cartopy Library is not installed.
After some more research, I thought of changing the version of Pycharm. I dowload version of 2020 and 2021 of Pycharm. Unfortunately i still got the same error :
“Error occurred when installing package ‘Cartopy”.
enter image description here
I have encountered a similar issue with another package and the problem wasn't in the IDE but the OS which in my case was mac. I had to install an ubuntu in parallel and migrate the whole project there and it ran perfectly.
I suggest you use conda instead of pip and if the issue didn't go away check the compatibility with your OS and if this is the issue you can simply install a virtual machine.

After install and uninstall a package, python3 crashes with error "Segmentation fault (core dumped)"

The steps leading to the problem is as follows:
I installed a package using pip. The package is here and its install doc is here. The command I used is
pip install --upgrade tensorflow-graphics-gpu
Because I don't have super user privilege, the package was installed in my user space. pip prompted me for that.
I uninstalled the package using
pip uninstall tensorflow-graphics-gpu
I started python3 and type
import tensorflow as tf
This statement worked fine before. But this time, python quits with an error:
Segmentation fault (core dumped)
This is a screenshot: enter image description here.
The environment is as follows:
A remote Linux. Core version 5.8.0. I am not not a super user.
Python 3.8.6
CUDA 11.1
CPU: Core i9-10900K
nVidia RTX GPU
The same error crashes python if I tried to import PyTorch. The sys admin is very disagreeable so I can get no help from him, not to mention upgrading drivers or reinstalling python. I tried to clear cashes in my user space that I know of, but I didn't have luck. I searched internet for a solution but of no avail.
Can someone please tell me how to fix this issue? Thanks a lot.
I tried to clear cashes in my user space that I know of, but I didn't have luck.
It seems pretty clear that something in your $HOME directory is still being used, and is causing the system python to crash.
To discover what that something is, you can look at which files are being opened using this command:
strace -e file python -c 'import tensorflow'
Once you know which files are being opened, remove/reinstall corresponding packages, and you should be back in business.

is not a supported wheel on this platform error [duplicate]

I've got python 3.9.1 running on a windows 10 machine. I have pygame 2.0.1 installed on my machine via pip
(python -m pip install https://github.com/pygame/pygame/releases/download/2.0.1/pygame-2.0.1-cp39-cp39-win_amd64.whl)
however on calling pygame.image.load("file.png") I get the error:
pygame.error: Failed loading libwebp-7.dll: The specified module could not be found.
I've tried installing through pip install pygame
and running the tests in pygame.tests but they run fine.
I managed to fix this error by using the whl file at
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
rather than from the github releases.
I'm not sure why this worked, but I hope anyone else having this issue is helped by this.
I ran into the same issue, but I discovered that it was due to the image being too low resolution for the size of window being drawn, swapping the image for a higher resolution version fixed the problem.

How can I fix my problems with PIL and Pillow in Visual Studio?

I'm using Visual Studio (not VS code) to write Python code. From Solution Explorer and then Python Environments I installed these packages: Pillow, Pillow-PIL, Pil-Lite, PillowImage. I also installed pip the same way. The problem is that when I write this code:
from PIL import Image:
myImage = Image.open("your_image_here");
myImage.show();
I get the message that PIL is unresolved, although that I have all of these packages.
I typed PIL in the solution explorer and there was a field: Run command: pip install PIL. I tried to install it, but I don't get it as a package. After that I uninstalled all other packages and tried to install this one again- the same thing.
I'm trying to run this elementary code since 3 days and there are no results. I tried installing it with CMD, but I'm only getting errors that pip is not recognized, although I used many different paths.
I will be very grateful, if you could help me about this issue.

unable to find vcvarsall,bat error while installing simplecv on windows 10?

During the installation phase, I get this, "Unable to find vcvarsall.bat" error. The installation process did complete, though. However, I was unable to see the shell on my desktop (I am using windows) and neither was I able to open it manually. I scoured the internet for the error but was unable to find any solution for this case.
The installation process is through a superpack that downloads Python 2.7
SimpleCV is not receiving much love in the past few years, and most of it's code don't got upgrade like the libraries it depends on.
The problem you got is the Superpack trying to compile an older version of OpenCV.
When running the Superpack, you should have seen and redtext error, and if you try to run a code it should show you something like this:
File "C:\Python27\lib\site-packages\SimpleCV\base.py", line 59, in <module>
raise ImportError("Cannot load OpenCV library which is required by SimpleCV")
ImportError: Cannot load OpenCV library which is required by SimpleCV
There are a few paths you can try from there:
1. You can try to install Microsoft Visual C++ Compiler for Python 2.7
Uninstall everything SuperPack installed in your PC or it may not work
It may fixes some other uses when using pip.
Now you have to install SimpleCV again.
2. Try to install OpenCV(2.3) on your own:
You can use pip for it, just remember to chose 32bits to keep compatibility with (Super Pack)
Just run on CMD
pip install OpenCV or python -m pip install OpenCV
3. Give up on SuperPack and install everything on your own.
You can try this guide
https://github.com/sightmachine/SimpleCV#windows-7vista
Or use pip for all dependencies
numpy (Numpy+MKL make sure to install this one first)
scipy
PIL
ipython
svgwrite
pygame==1.9.1release
OpenCV
You can find a useful list of wheels here
http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
Sources:
https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/
http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
https://github.com/sightmachine/SimpleCV#windows-7vista

Categories