ImportError: No module named 'PIL' #12

Closed
opened 2020-01-05 22:33:17 +01:00 by iroQuai · 7 comments
iroQuai commented 2020-01-05 22:33:17 +01:00 (Migrated from github.com)

Submitting Issues

  • Description / Changes made:
    Just tried to make this epaper calendar work, but ran into some errors.... This is what i did:
  • Got the Raspberry Pi ready according to the steps on the read.MD file
  • Ran the installer: bash -c "$(curl -sL https://raw.githubusercontent.com/mgfcf/E-Paper-Calendar/master/Installer-with-debug.sh)"
  • Waited a long time
  • After everything was finished, i tried using the software but got this message:
    -bash: python3.5: command not found
  • Installed Python3.5 by using sudo apt-get install python3.5
  • Tried again. Got the error as seen below:
  • Error output:

Traceback (most recent call last):
File "/home/pi/E-Paper-Master/Calendar/E-Paper.py", line 12, in
from Assets import path
File "/home/pi/E-Paper-Master/Calendar/Assets.py", line 3, in
from PIL import Image, ImageFont
ImportError: No module named 'PIL'

  • Version info;
    Version: 1.6
    Installer version: 1.6 (Mid March 2019)
    configuration file: /home/pi/E-Paper-Master/Calendar/settings.py
    If the time was set correctly, you installed this software on:
    Sun 5 Jan 21:59:24 CET 2020

  • Other things
    can someone help me fix this?
    I used the latest Raspbian Lite image, downloaded today. I noticed it's called Buster, not Stretch. Is this a problem?

# Submitting Issues * **Description / Changes made:** Just tried to make this epaper calendar work, but ran into some errors.... This is what i did: - Got the Raspberry Pi ready according to the steps on the read.MD file - Ran the installer: `bash -c "$(curl -sL https://raw.githubusercontent.com/mgfcf/E-Paper-Calendar/master/Installer-with-debug.sh)"` - Waited a long time - After everything was finished, i tried using the software but got this message: `-bash: python3.5: command not found` - Installed Python3.5 by using `sudo apt-get install python3.5` - Tried again. Got the error as seen below: * **Error output:** > Traceback (most recent call last): > File "/home/pi/E-Paper-Master/Calendar/E-Paper.py", line 12, in <module> > from Assets import path > File "/home/pi/E-Paper-Master/Calendar/Assets.py", line 3, in <module> > from PIL import Image, ImageFont > ImportError: No module named 'PIL' * **Version info;** Version: 1.6 Installer version: 1.6 (Mid March 2019) configuration file: /home/pi/E-Paper-Master/Calendar/settings.py If the time was set correctly, you installed this software on: Sun 5 Jan 21:59:24 CET 2020 * **Other things** can someone help me fix this? I used the latest Raspbian Lite image, downloaded today. I noticed it's called Buster, not Stretch. Is this a problem?
iroQuai commented 2020-01-05 22:41:45 +01:00 (Migrated from github.com)

I installed Python PIL (by using sudo apt-get install python-pil' but the error stays the same!

I installed Python PIL (by using `sudo apt-get install python-pil' but the error stays the same! `
mgfcf commented 2020-01-06 15:32:38 +01:00 (Migrated from github.com)

Hey @iroQuai ,
thanks for trying out the software!

The Rapsbian image should not be a problem in most cases. I assume that you started the software with the command mentioned in the installer? The command is using Python 3.5 which may not be installed or, as it is, outdated. I am going to generalize the installer after the problem is resolved.

As long as you use python 3 it should work just fine. With python --version you can see your default python version. If this is some version of python 2, try using python3 --version.

The software should than be able to run with python /home/pi/E-Paper-Master/Calendar/E-Paper.py or python3 /home/pi/E-Paper-Master/Calendar/E-Paper.py.

I assume, that the software could not find the PIL package, because the packages are not associated with the python 3.5 version installed afterwards the package were installed with pip3.

So please have a try with the more general python commands and report back.

Max

Hey @iroQuai , thanks for trying out the software! The Rapsbian image should not be a problem in most cases. I assume that you started the software with the command mentioned in the installer? The command is using Python 3.5 which may not be installed or, as it is, outdated. I am going to generalize the installer after the problem is resolved. As long as you use python 3 it should work just fine. With `python --version` you can see your default python version. If this is some version of python 2, try using `python3 --version`. The software should than be able to run with `python /home/pi/E-Paper-Master/Calendar/E-Paper.py` or `python3 /home/pi/E-Paper-Master/Calendar/E-Paper.py`. I assume, that the software could not find the PIL package, because the packages are not associated with the python 3.5 version installed afterwards the package were installed with pip3. So please have a try with the more general python commands and report back. Max
mgfcf commented 2020-01-06 15:38:04 +01:00 (Migrated from github.com)

After looking at the installer again, I see that you probably do not have installed another python 3 version. So I assume, that python3 --version just gives you something about python 3.5.

It would probably be enough, if you just rerun the installer, so that all the installed packages will be accessible through your now installed python 3.5.

Max

After looking at the installer again, I see that you probably do not have installed another python 3 version. So I assume, that `python3 --version` just gives you something about python 3.5. It would probably be enough, if you just rerun the installer, so that all the installed packages will be accessible through your now installed python 3.5. Max
iroQuai commented 2020-01-08 22:10:10 +01:00 (Migrated from github.com)

Hi, thanks for the quick response.
After submitting the issue and reading some more about the e-paper display, I've found that it is needed to install some libraries. So afterwards I followed instructions as mentioned here. Or maybe this is already part of your installer? I don't know but just tried...

Afterwards I found your suggestions. Today i've tried them:

  • Python --version gives me a 2.7,16, Python3 --version gives me 3.7.3.
  • I've used the installation script again to first uninstall, (then reboot) and then install again.
  • after filling in the settings.py i've tried to open with the suggested command. Errors stayed the same as before.
  • Trying the same command with only "python" gives me the following error:

`Traceback (most recent call last):
File "/home/pi/E-Paper-Master/Calendar/E-Paper.py", line 17, in
from MonthOvPanel import MonthOvPanel
File "/home/pi/E-Paper-Master/Calendar/MonthOvPanel.py", line 6, in
from WeatherHeaderDesign import WeatherHeaderDesign
File "/home/pi/E-Paper-Master/Calendar/WeatherHeaderDesign.py", line 34
SyntaxError: Non-ASCII character '\xc2' in file /home/pi/E-Paper-Master/Calendar/WeatherHeaderDesign.py on line 34, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

  • Trying the command with "python3" gives me a result that is most understandable to me. After waiting about 10 seconds, the result was this error:

Traceback (most recent call last):
File "/home/pi/E-Paper-Master/Calendar/E-Paper.py", line 33, in
all_locales[language.lower()].split('.')[0], datetime_encoding))
File "/usr/lib/python3.7/locale.py", line 604, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

Hi, thanks for the quick response. After submitting the issue and reading some more about the e-paper display, I've found that it is needed to install some libraries. So afterwards I followed instructions as mentioned [here](https://www.waveshare.com/wiki/Pioneer600#Libraries_Installation_for_RPi). Or maybe this is already part of your installer? I don't know but just tried... Afterwards I found your suggestions. Today i've tried them: - Python --version gives me a 2.7,16, Python3 --version gives me 3.7.3. - I've used the installation script again to first uninstall, (then reboot) and then install again. - after filling in the settings.py i've tried to open with the suggested command. Errors stayed the same as before. - Trying the same command with only "python" gives me the following error: > `Traceback (most recent call last): > File "/home/pi/E-Paper-Master/Calendar/E-Paper.py", line 17, in <module> > from MonthOvPanel import MonthOvPanel > File "/home/pi/E-Paper-Master/Calendar/MonthOvPanel.py", line 6, in <module> > from WeatherHeaderDesign import WeatherHeaderDesign > File "/home/pi/E-Paper-Master/Calendar/WeatherHeaderDesign.py", line 34 > SyntaxError: Non-ASCII character '\xc2' in file /home/pi/E-Paper-Master/Calendar/WeatherHeaderDesign.py on line 34, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details - Trying the command with "python3" gives me a result that is most understandable to me. After waiting about 10 seconds, the result was this error: > Traceback (most recent call last): > File "/home/pi/E-Paper-Master/Calendar/E-Paper.py", line 33, in <module> > all_locales[language.lower()].split('.')[0], datetime_encoding)) > File "/usr/lib/python3.7/locale.py", line 604, in setlocale > return _setlocale(category, locale) > locale.Error: unsupported locale setting
iroQuai commented 2020-01-08 22:30:04 +01:00 (Migrated from github.com)

In raspi-config i've i've set locale (in localisation options) to "en_GB".
In settings.py i've changed language from "en" to "en_GB"

This created a whole new error!

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/numpy/core/init.py", line 24, in
from . import multiarray
File "/usr/local/lib/python3.7/dist-packages/numpy/core/multiarray.py", line 14, in
from . import overrides
File "/usr/local/lib/python3.7/dist-packages/numpy/core/overrides.py", line 7, in
from numpy.core._multiarray_umath import (
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/pi/E-Paper-Master/Calendar/E-Paper.py", line 45, in
import Epd7in5bAdapter
File "/home/pi/E-Paper-Master/Calendar/Epd7in5bAdapter.py", line 5, in
import numpy as np
File "/usr/local/lib/python3.7/dist-packages/numpy/init.py", line 142, in
from . import core
File "/usr/local/lib/python3.7/dist-packages/numpy/core/init.py", line 54, in
raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.

  • Try uninstalling and reinstalling numpy.

  • If you have already done that, then:

    1. Check that you expected to use Python3.7 from "/usr/bin/python3",
      and that you have no directories in your PATH or PYTHONPATH that can
      interfere with the Python and numpy version "1.18.0" you're trying to use.
    2. If (1) looks fine, you can open a new issue at
      https://github.com/numpy/numpy/issues. Please include details on:
      • how you installed Python
      • how you installed numpy
      • your operating system
      • whether or not you have multiple versions of Python installed
      • if you built from source, your compiler versions and ideally a build log
  • If you're working with a numpy git repository, try git clean -xdf
    (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory

I'm lost again and will just wait for your instructions ;)

In raspi-config i've i've set locale (in localisation options) to "en_GB". In settings.py i've changed language from "en" to "en_GB" This created a whole new error! > Traceback (most recent call last): > File "/usr/local/lib/python3.7/dist-packages/numpy/core/__init__.py", line 24, in <module> > from . import multiarray > File "/usr/local/lib/python3.7/dist-packages/numpy/core/multiarray.py", line 14, in <module> > from . import overrides > File "/usr/local/lib/python3.7/dist-packages/numpy/core/overrides.py", line 7, in <module> > from numpy.core._multiarray_umath import ( > ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory > > During handling of the above exception, another exception occurred: > > Traceback (most recent call last): > File "/home/pi/E-Paper-Master/Calendar/E-Paper.py", line 45, in <module> > import Epd7in5bAdapter > File "/home/pi/E-Paper-Master/Calendar/Epd7in5bAdapter.py", line 5, in <module> > import numpy as np > File "/usr/local/lib/python3.7/dist-packages/numpy/__init__.py", line 142, in <module> > from . import core > File "/usr/local/lib/python3.7/dist-packages/numpy/core/__init__.py", line 54, in <module> > raise ImportError(msg) > ImportError: > > IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! > > Importing the numpy c-extensions failed. > - Try uninstalling and reinstalling numpy. > - If you have already done that, then: > 1. Check that you expected to use Python3.7 from "/usr/bin/python3", > and that you have no directories in your PATH or PYTHONPATH that can > interfere with the Python and numpy version "1.18.0" you're trying to use. > 2. If (1) looks fine, you can open a new issue at > https://github.com/numpy/numpy/issues. Please include details on: > - how you installed Python > - how you installed numpy > - your operating system > - whether or not you have multiple versions of Python installed > - if you built from source, your compiler versions and ideally a build log > > - If you're working with a numpy git repository, try `git clean -xdf` > (removes all files not under version control) and rebuild numpy. > > Note: this error has many possible causes, so please don't comment on > an existing issue about this - open a new one instead. > > Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory > I'm lost again and will just wait for your instructions ;)
mgfcf commented 2020-01-09 21:07:08 +01:00 (Migrated from github.com)

Hey!
The python3 command seems to be the correct one and you should stick with the locale en_GB, that is probably not causing the new issue.

I did some research and found two possibilities:

Based on https://stackoverflow.com/questions/53784520/numpy-import-error-python3-on-raspberry-pi and many similiar errors on GitHub, it might be helpful to do sudo apt-get install python-dev libatlas-base-dev to install some missing dependencies for numpy.

On the other hand, based on https://www.reddit.com/r/raspberry_pi/comments/86dwpz/cant_install_numpy_through_pip3/?utm_source=share&utm_medium=web2x, there might be some conflicting numpy installations at work. One installed via pip and the other with apt. As described in the reddit, pip may not have the correct architecture build for the raspberry, but apt should have. As the installer script installs numpy with pip, there might be some issues. Removing the pip one with pip3 uninstall numpy or the apt one with sudo apt-get remove python-numpy may solve the issue.
You can check if you have numpy installed with apt with apt list --installed | grep 'numpy'. You should see something similiar to python-numpy/stable ... [installed].

I suggest that you start with the first option, installing possibly missing dependencies and restart the calendar with python3. There should be no need to rerun the installer.
If that does not work, check with apt list --installed | grep 'numpy' if there is a conflicting numpy instance installed. If that is the case, I suggest, based on the information from the reddit, to uninstall the pip version with pip3 uninstall numpy as the apt version may be more reliable. Than retry the software.

For your information: pip is probably associated with the default python version, which is python2 in your case, so you want to use pip3 to explicitly use the python3 version. You can check the associated python version with pip(3) --version.

Good luck, Let me know how it goes!
Max

Hey! The python3 command seems to be the correct one and you should stick with the locale `en_GB`, that is probably not causing the new issue. I did some research and found two possibilities: Based on [https://stackoverflow.com/questions/53784520/numpy-import-error-python3-on-raspberry-pi](url) and many similiar errors on GitHub, it might be helpful to do `sudo apt-get install python-dev libatlas-base-dev` to install some missing dependencies for numpy. On the other hand, based on [https://www.reddit.com/r/raspberry_pi/comments/86dwpz/cant_install_numpy_through_pip3/?utm_source=share&utm_medium=web2x](url), there might be some conflicting numpy installations at work. One installed via pip and the other with apt. As described in the reddit, pip may not have the correct architecture build for the raspberry, but apt should have. As the installer script installs numpy with pip, there might be some issues. Removing the pip one with `pip3 uninstall numpy` or the apt one with `sudo apt-get remove python-numpy` may solve the issue. You can check if you have numpy installed with apt with `apt list --installed | grep 'numpy'`. You should see something similiar to `python-numpy/stable ... [installed]`. I suggest that you start with the first option, installing possibly missing dependencies and restart the calendar with python3. There should be no need to rerun the installer. If that does not work, check with `apt list --installed | grep 'numpy'` if there is a conflicting numpy instance installed. If that is the case, I suggest, based on the information from the reddit, to uninstall the pip version with `pip3 uninstall numpy` as the apt version may be more reliable. Than retry the software. For your information: pip is probably associated with the default python version, which is python2 in your case, so you want to use pip3 to explicitly use the python3 version. You can check the associated python version with `pip(3) --version`. Good luck, Let me know how it goes! Max
iroQuai commented 2020-01-11 21:07:56 +01:00 (Migrated from github.com)

The first option worked!! Great :)
Now i can start tweaking.... thanks for the help so far!

The first option worked!! Great :) Now i can start tweaking.... thanks for the help so far!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: m.giller/E-Paper-Calendar#12
No description provided.