Kivy cannot find PIL module in Mac - python-2.7

OSX 10.10.2, Python 2.7.9, Kivy 1.9
I used sudo pip install Pillow to install Pillow when i get the not found error. I can find PIL in python help('modules') but not in kivy help('modules')
I tried Kivy user group but got no reply yet. Thank you in advance!

Kivy 1.9 package uses it's own Virtual Environment. You have to make sure to install modules into that. Simply do::
kivy -m pip install pillow

Probably kivy is looking for the Pillow package in the wrong place.
You should check where your library is installed and use that path.
The path should be something like "/Library/Python/2.7/site-packages/", look if you have the PIL package in that position.
Then set the PYTHONPATH variable or use
import sys
sys.path.append('path_to_the_PILLOW_package')
and look if "import PIL" raises an ImportError.

Related

install imageio Python 2.7.14

I am trying to install the imageio module using pip:
pip install imageio
as this is what https://media.readthedocs.org/pdf/imageio/latest/imageio.pdf recommends.
However, I am getting an error every time saying that install is invalid syntax. I am wondering what is the valid syntax to import this module through PIP, or if possible a download link for imageio that will just allow me to use the command
import imageio
that is common syntax for importing new modules into python
Try to locate pip.exe at path c:\python27\Scripts\ path
open terminal at that path and the execute pip install imageio it should work now.
how to install package can help you understand how we install python packages.

My pip isn't installing my packages correctly

It's messing all my installation up all of a sudden.
I've installed it using pip BeautifulSoup4 for example
It keeps installing- when I use python and import it; it doesn't import it properly.
However; somehow my requests works. I think I messed up my PATH variable.
>>> import sys
>>> print '\n'.join(sys.path)
/usr/local/Library/Python/2.7/site-packages
/usr/local/lib/python2.7/site-packages
/Library/python2.7/site-packages
/Library/python2.7/site-packages/usr/local/lib/python2.7/site-packages
/usr/lib/python2.7/site-packages/Library/python2.7/site-packages
/usr/lib/python2.7/site-packages/Users/biplovdahal/Library/Python/2.7/lib/python/site-packages
/Users/biplovdahal/Library/Python/2.7/lib/python/site-packages
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/Library/Python/2.7/site-packages
^ How would I set my pip to listen to a specific site-package and keep installing my future modules in that one site-packages. I don't want it mixed up anymore. I'd like to also get rid of all the permission problem as possible so I can safely install my package and use it.
You can call pip by prefixing python path like this
/usr/local/bin/python pip install <package name>
The above command wiill place site-packages in /usr/local/lib/python2.7/site-packages/ folder . if you want to change it to install to someother library , you change the python path in the pip command

No module named 'matplotlib.pyplot'; 'matplotlib' is not a package

Have found a similar issue, however haven't found proper solution.
Here's a code:
import matplotlib.pyplot as plt
plt.plot([1,2,3],[4,2,5])
plt.show()
Run, got the message:
ImportError: No module named 'matplotlib.pyplot'; 'matplotlib' is not a package
I run Linux Mint 18 with preinstalled python-2.7 and python-3.5 (I use python3), before that I was installing modules with a simple sudo apt-get install method and that worked great.
Before running this the code above, I've installed matplotlib in a usual way sudo apt-get install python-matplotlib. As it haven't worked out, started to look for solution.
Python location
which python3 /usr/bin/python3
Current Matplotlib installed
sudo find /usr | grep matplotlib /usr/lib/python3/dist-packages/matplotlib
My tries:
1) I've removed matplotlib with autoremove, and tried to make it sudo apt-get install python3-matplotlib instead. Didn't worked out.
2) Used: pip3 install matplotlib or sudo pip3 install matplotlib. Received errors like:
command python setup.py egg_info failed with error code 1 in /tmp/pip-build- ....
3) Then I found another solution:
sudo apt-get install virtualenv
virtualenv -p /usr/bin/python3 py3env
source py3env/bin/activate
pip install matplotlib
Same outcome.
Haven't tried to use import sys sys.path.append('/usr/lib/pymodules/python2.7/')(proposed in link above), but as I am not sure what exactly this command does (quite a newbie to python and programming itself) - haven't risked.
If you are using pycharm and have matplotlib.py in your current working directory than you get this error. Just delete or rename the matplotlib.py file and it will work.
don't name any file as matplotlib.py within your working directory
In your working directory, check if there is any file matplotlib.py
Delete that file and import matplotib again. That should work.
simply install:
python -m pip install -U pip
python -m pip install -U matplotlib
I had the same problem reasons in my case were
python 3.8.2 with matplotlib that I downloaded was for 3.7. Make sure they are the same.
python 64 bits version with matplotlib 32bits. Make sure they are the same
Use python -m pip install package_which_you_need to install packages for Windows
Make sure to add to PATH the environment variables I forgot to do in my case
pip version was old use
Use python -m pip install --upgrade pip to upgrade pip to the latest for Windows
I saved the file name as matplotlib.py. Try to avoid that
Finally I typed matplotlib.pyplot as matplotlib.plyplot remember to check for typos first. The error message looks similar even though I corrected all the steps above.
ModuleNotFoundError: No module named 'matplotlib.pyplot'
ModuleNotFoundError: No module named 'matplotlib.plyplot'

Django: determine actually used pip packages

I got a Django project that was started without virtualenv. Now migrating to virtualenv and my requirements.txt created before is huge and not installable in the virtualenv (many errors as shown below). How can i generate a minimal list of required packages? Or is there some reference anywhere?
Could not find any downloads that satisfy the requirement PIL==1.1.7 (from -r requirements.txt (line 8))
Some externally hosted files were ignored (use --allow-external PIL to allow).
Cleaning up...
No distributions at all found for PIL==1.1.7 (from -r requirements.txt (line 8))
it's not only PIL that throws errors, if I comment it another package shows and i can't know what's really used for my application to work.
Thanks in advance!
You can run pip freeze (related to system python used before virtualenv), this give you list of installed packages;
Then filter that list using following:
1) INSTALLED_APPS in settings
2) also check all from and import statement (search through the project)
I've had the same problem and there are issues getting PIL to install using PIP as there's no PIL 1.7 in the default Python repos.
The easiest fix is this to add these options to the pip:
--allow-external PIL --allow-unverified PIL
For example:
pip install -r requirements.txt --allow-external PIL --allow-unverified PIL
The problem with this it is a potential security issue and you don't want to do this on a production server! :)
Your options are to use Pillow which is a fork of PIL:
https://pypi.python.org/pypi/Pillow
Comments from the Pillow author, and you should verify that it works with you code.
Or try PIL 1.1.6 which is the Python Repos:
https://pypi.python.org/pypi/PIL
Or create your own repo and include the PIL 1.1.7 sources.
Or, if your on a Linux system install PIL using your distro's package management tool and remove PIL from your requirements file, and then rebuild your virutalenv.
You can this on Debian based distros like this:
sudo apt-get install python-imaging
Red Hat distros like this:
sudo yum install python-imaging

How may i install the Python Imaging Library to django environment?

I am currently finding it hard to install PIL on precise pangolin.
I have followed this tutorial (http://www.sandersnewmedia.com/why/2012/04/16/installing-pil-virtualenv-ubuntu-1204-precise-pangolin/)
When I do:
pip install PIL
I get the error:
Could not find any downloads that satisfy the requirement PIL
No distributions at all found for PIL
Looked around google but to no avail.
Try this:
pip install PIL --allow-external PIL --allow-unverified PIL
You can use Pillow
--> pip install Pillow