Python Forum
No Module of this name found
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
No Module of this name found
#1
I entered the code for a spirograph printing program which was in the book "python playground" by Mahesh Venkitachalam only to find that it would not run.
The error:
Error:
Traceback (most recent call last): File "C:\Users\New\Andys Docs\Python\Scripts\spiro.py", line 5, in <module> import numpy as np ImportError: No module named 'numpy'
and, after commenting that line and rerunning, got:
Error:
Traceback (most recent call last): File "C:\Users\New\Andys Docs\Python\Scripts\spiro.py", line 9, in <module> from PIL import image ImportError: No module named 'PIL'
The modules not being available surprised me somewhat as I thought that 'numpy' at least was downloaded with Python as standard.
I am using Python 3.5.0 under Microsoft Windows 10. I have not tried anything else because, quite frankly, if the modules are not on my machine, then I don't know what to do next. Can someone please tell me how to resolve these problems?
Reply
#2
The modules need to be installed before you can import and use them.
Running commands
pip install numpy
and
pip install pillow
in terminal should do. Make sure you have activated a virtual environment first, in case you are using one.
Reply
#3
Many thanks. Numpy installed fine but I got loadsa and loads of (to me) gobbledygook when I tried to install Pilllow, which I have included in full below:

PS C:\Users\New> pip install Pillow
Collecting Pillow
Downloading https://files.pythonhosted.org/packages/...3.0.tar.gz (15.6MB)
100% |################################| 15.6MB 12kB/s
Installing collected packages: Pillow
Running setup.py install for Pillow
Complete output from command c:\users\new\appdata\local\programs\python\python35-32\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\New\\AppData\\Local\\Temp\\pip-build-d7w36qn2\\Pillow\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\New\AppData\Local\Temp\pip-q2hpssbt-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-3.5
creating build\lib.win32-3.5\PIL
copying src\PIL\BdfFontFile.py -> build\lib.win32-3.5\PIL
copying src\PIL\BlpImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\BmpImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\BufrStubImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\ContainerIO.py -> build\lib.win32-3.5\PIL
copying src\PIL\CurImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\DcxImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\DdsImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\EpsImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\ExifTags.py -> build\lib.win32-3.5\PIL
copying src\PIL\features.py -> build\lib.win32-3.5\PIL
copying src\PIL\FitsStubImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\FliImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\FontFile.py -> build\lib.win32-3.5\PIL
copying src\PIL\FpxImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\FtexImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\GbrImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\GdImageFile.py -> build\lib.win32-3.5\PIL
copying src\PIL\GifImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\GimpGradientFile.py -> build\lib.win32-3.5\PIL
copying src\PIL\GimpPaletteFile.py -> build\lib.win32-3.5\PIL
copying src\PIL\GribStubImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\Hdf5StubImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\IcnsImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\IcoImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\Image.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageChops.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageCms.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageColor.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageDraw.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageDraw2.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageEnhance.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageFile.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageFilter.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageFont.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageGrab.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageMath.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageMode.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageMorph.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageOps.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImagePalette.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImagePath.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageQt.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageSequence.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageShow.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageStat.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageTk.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageTransform.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImageWin.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\ImtImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\IptcImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\Jpeg2KImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\JpegImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\JpegPresets.py -> build\lib.win32-3.5\PIL
copying src\PIL\McIdasImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\MicImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\MpegImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\MpoImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\MspImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\OleFileIO.py -> build\lib.win32-3.5\PIL
copying src\PIL\PaletteFile.py -> build\lib.win32-3.5\PIL
copying src\PIL\PalmImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\PcdImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\PcfFontFile.py -> build\lib.win32-3.5\PIL
copying src\PIL\PcxImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\PdfImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\PdfParser.py -> build\lib.win32-3.5\PIL
copying src\PIL\PixarImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\PngImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\PpmImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\PsdImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\PSDraw.py -> build\lib.win32-3.5\PIL
copying src\PIL\PyAccess.py -> build\lib.win32-3.5\PIL
copying src\PIL\SgiImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\SpiderImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\SunImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\TarIO.py -> build\lib.win32-3.5\PIL
copying src\PIL\TgaImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\TiffImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\TiffTags.py -> build\lib.win32-3.5\PIL
copying src\PIL\WalImageFile.py -> build\lib.win32-3.5\PIL
copying src\PIL\WebPImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\WmfImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\XbmImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\XpmImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\XVThumbImagePlugin.py -> build\lib.win32-3.5\PIL
copying src\PIL\_binary.py -> build\lib.win32-3.5\PIL
copying src\PIL\_tkinter_finder.py -> build\lib.win32-3.5\PIL
copying src\PIL\_util.py -> build\lib.win32-3.5\PIL
copying src\PIL\_version.py -> build\lib.win32-3.5\PIL
copying src\PIL\__init__.py -> build\lib.win32-3.5\PIL
running egg_info
writing dependency_links to src\Pillow.egg-info\dependency_links.txt
writing src\Pillow.egg-info\PKG-INFO
writing top-level names to src\Pillow.egg-info\top_level.txt
c:\users\new\appdata\local\programs\python\python35-32\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
warning: manifest_maker: standard file '-c' not found

reading manifest file 'src\Pillow.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.c'
warning: no files found matching '*.h'
warning: no files found matching '*.sh'
no previously-included directories found matching 'docs\_static'
warning: no previously-included files found matching '.appveyor.yml'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.codecov.yml'
warning: no previously-included files found matching '.editorconfig'
warning: no previously-included files found matching '.landscape.yaml'
warning: no previously-included files found matching '.travis'
warning: no previously-included files found matching '.travis\*'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files matching '.git*' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
writing manifest file 'src\Pillow.egg-info\SOURCES.txt'
running build_ext


The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.

Please see the install instructions at:
https://pillow.readthedocs.io/en/latest/...ation.html

Traceback (most recent call last):
File "C:\Users\New\AppData\Local\Temp\pip-build-d7w36qn2\Pillow\setup.py", line 802, in <module>
zip_safe=not (debug_build() or PLATFORM_MINGW), )
File "c:\users\new\appdata\local\programs\python\python35-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\new\appdata\local\programs\python\python35-32\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\users\new\appdata\local\programs\python\python35-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\new\appdata\local\programs\python\python35-32\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\new\appdata\local\programs\python\python35-32\lib\distutils\command\install.py", line 539, in run
self.run_command('build')
File "c:\users\new\appdata\local\programs\python\python35-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\new\appdata\local\programs\python\python35-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\new\appdata\local\programs\python\python35-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\new\appdata\local\programs\python\python35-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\new\appdata\local\programs\python\python35-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\new\appdata\local\programs\python\python35-32\lib\distutils\command\build_ext.py", line 338, in run
self.build_extensions()
File "C:\Users\New\AppData\Local\Temp\pip-build-d7w36qn2\Pillow\setup.py", line 589, in build_extensions
raise RequiredDependencyException(f)
__main__.RequiredDependencyException: zlib

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\New\AppData\Local\Temp\pip-build-d7w36qn2\Pillow\setup.py", line 814, in <module>
raise RequiredDependencyException(msg)
__main__.RequiredDependencyException:

The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.

Please see the install instructions at:
https://pillow.readthedocs.io/en/latest/...ation.html



----------------------------------------
Command "c:\users\new\appdata\local\programs\python\python35-32\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\New\\AppData\\Local\\Temp\\pip-build-d7w36qn2\\Pillow\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\New\AppData\Local\Temp\pip-q2hpssbt-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\New\AppData\Local\Temp\pip-build-d7w36qn2\Pillow
You are using pip version 7.1.2, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

This seems to imply that something called 'zlib' cannot be found. This does not mean anything to me. I have read the installation notes and I'm afraid I could not make any sense of those either. Can you help further?
By the way, I thought PIP was a linux package manager. I didn't know that it could be used with Windows.
Reply
#4
(Oct-31-2018, 04:59 PM)wookie Wrote: By the way, I thought PIP was a linux package manager. I didn't know that it could be used with Windows.
pip is Python installer for all OS.
You should upgrade,this is easier and better the troubleshoot that error on 3.5.
Python 3.6/3.7 and pip installation under Windows.
Test install pillow,Python 3.7 and pip 18.1.
C:\>pip -V
pip 18.1 from c:\python37\lib\site-packages\pip (python 3.7)

C:\>pip install pillow
Collecting pillow
  Downloading https://files.pythonhosted.org/packages/aa/49/e9de895c7baab95f9b3ab6c8df272edcabba3c92046b008cfa4650fe6eea/Pillow-5.3.0-cp37-cp37m-win32.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 2.3MB/s
Installing collected packages: pillow
Successfully installed pillow-5.3.0

C:\>
Reply
#5
Thanks Snippsat. I updated pip as per the instructions at the end of the pillow installation - which seemed fine. I then reinstalled pillow (with a small 'p' as per your post). Both modules are now installed correctly on my computer.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Module not found error minifizikus 1 4,042 Sep-14-2018, 08:25 AM
Last Post: Axel_Erfurt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020