brother_ql icon indicating copy to clipboard operation
brother_ql copied to clipboard

ImportError in BrotherQLRaster from PIL _imaging

Open stevenlowery011 opened this issue 4 years ago • 1 comments

When installing via pip and the upgrade flag per the instructions in the readme on a brand new conda environment, a dependency is not installed and results in an ImportError when using the command line tool. The new conda environment comes with Python==3.7.3 and pillow==5.4.1 which satisfies the requirement of pillow>=3.3.0; however, when running the command line tool, an import from pillow fails to be found. After running a pip install --upgrade pillow which installs pillow==7.0.0, the command line tool works.

Can you investigate the pillow requirements again? I suspect that pillow>=3.3.0 is not sufficient anymore.

Full CLI Traceback:

Microsoft Windows [Version 10.0.17134.1304]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\H247073\Documents\Python>conda create -n dev-brotherql
Collecting package metadata: done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.6.14
  latest version: 4.8.2

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: C:\Users\H247073\anaconda3\envs\dev-brotherql



Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate dev-brotherql
#
# To deactivate an active environment, use
#
#     $ conda deactivate


C:\Users\H247073\Documents\Python>activate dev-brotherql

C:\Users\H247073\Documents\Python>conda.bat activate dev-brotherql

(dev-brotherql) C:\Users\H247073\Documents\Python>pip install --upgrade brother_ql
Collecting brother_ql
  Downloading https://files.pythonhosted.org/packages/80/ad/939d717cbc97a4b73c221f953aceeec72cce2065835d2c001bfb6afa4511/brother_ql-0.9.4-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: pillow>=3.3.0 in c:\users\h247073\anaconda3\lib\site-packages (from brother_ql) (5.4.1)
Requirement already satisfied, skipping upgrade: attrs in c:\users\h247073\anaconda3\lib\site-packages (from brother_ql) (19.1.0)
Collecting packbits (from brother_ql)
  Downloading https://files.pythonhosted.org/packages/1b/23/78a967c9b9961258da2bf0d0a63bf12293ccddf96ec77361ee7b44f543f1/packbits-0.6.tar.gz
Requirement already satisfied, skipping upgrade: future in c:\users\h247073\anaconda3\lib\site-packages (from brother_ql) (0.17.1)
Requirement already satisfied, skipping upgrade: click in c:\users\h247073\anaconda3\lib\site-packages (from brother_ql) (7.0)
Collecting pyusb (from brother_ql)
  Downloading https://files.pythonhosted.org/packages/5f/34/2095e821c01225377dda4ebdbd53d8316d6abb243c9bee43d3888fa91dd6/pyusb-1.0.2.tar.gz (54kB)
     |████████████████████████████████| 61kB 491kB/s
Building wheels for collected packages: packbits, pyusb
  Building wheel for packbits (setup.py) ... done
  Stored in directory: C:\Users\H247073\AppData\Local\pip\Cache\wheels\fa\08\ca\c39b0b8978dedaa67e8b068f608f6455e7460b2b5e800d03fa
  Building wheel for pyusb (setup.py) ... done
  Stored in directory: C:\Users\H247073\AppData\Local\pip\Cache\wheels\1f\a9\7e\d189b5030ee3a56f9b72c28281bb11d661b8ea312e28de08a5
Successfully built packbits pyusb
Installing collected packages: packbits, pyusb, brother-ql
Successfully installed brother-ql-0.9.4 packbits-0.6 pyusb-1.0.2

(dev-brotherql) C:\Users\H247073\Documents\Python>brother_ql --help
Traceback (most recent call last):
  File "c:\users\h247073\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\h247073\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\H247073\anaconda3\Scripts\brother_ql.exe\__main__.py", line 5, in <module>
  File "c:\users\h247073\anaconda3\lib\site-packages\brother_ql\__init__.py", line 4, in <module>
    from .raster import BrotherQLRaster
  File "c:\users\h247073\anaconda3\lib\site-packages\brother_ql\raster.py", line 8, in <module>
    from PIL import Image
  File "c:\users\h247073\anaconda3\lib\site-packages\PIL\Image.py", line 94, in <module>
    from . import _imaging as core
ImportError: DLL load failed: The specified module could not be found.

(dev-brotherql) C:\Users\H247073\Documents\Python>pip install --upgrade pillow
Collecting pillow
  Using cached https://files.pythonhosted.org/packages/88/6b/66f502b5ea615f69433ae1e23ec786b2cdadbe41a5cfb1e1fabb4f9c6ce9/Pillow-7.0.0-cp37-cp37m-win_amd64.whl
Installing collected packages: pillow
  Found existing installation: Pillow 5.4.1
    Uninstalling Pillow-5.4.1:
      Successfully uninstalled Pillow-5.4.1
Successfully installed pillow-7.0.0

(dev-brotherql) C:\Users\H247073\Documents\Python>brother_ql --help
deprecation warning: brother_ql.devicedependent is deprecated and will be removed in a future release
Usage: brother_ql [OPTIONS] COMMAND [ARGS]...

  Command line interface for the brother_ql Python package.

Options:
  -b, --backend [pyusb|network|linux_kernel]
  -m, --model [QL-500|QL-550|QL-560|QL-570|QL-580N|QL-650TD|QL-700|QL-710W|QL-720NW|QL-800|QL-810W|QL-820NWB|QL-1050|QL-1060N]
  -p, --printer PRINTER_IDENTIFIER
                                  The identifier for the printer. This could
                                  be a string like tcp://192.168.1.21:9100 for
                                  a networked printer or
                                  usb://0x04f9:0x2015/000M6Z401370 for a
                                  printer connected via USB.
  --debug
  --version                       Show the version and exit.
  --help                          Show this message and exit.

Commands:
  analyze   interpret a binary file containing raster instructions for the...
  discover  find connected label printers
  info      list available labels, models etc.
  print     Print a label
  send      send an instruction file to the printer

Python ImportError Traceback:

Traceback (most recent call last):
  File "c:\users\h247073\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\h247073\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\H247073\anaconda3\Scripts\brother_ql.exe\__main__.py", line 5, in <module>
  File "c:\users\h247073\anaconda3\lib\site-packages\brother_ql\__init__.py", line 4, in <module>
    from .raster import BrotherQLRaster
  File "c:\users\h247073\anaconda3\lib\site-packages\brother_ql\raster.py", line 8, in <module>
    from PIL import Image
  File "c:\users\h247073\anaconda3\lib\site-packages\PIL\Image.py", line 94, in <module>
    from . import _imaging as core
ImportError: DLL load failed: The specified module could not be found.

System Information: Conda version: 4.6.14

Python version: 3.7.3

Pip version: 19.1.1

brother_ql version: 0.9.4

pillow version which caused error: 5.4.1

pillow version after upgrade: 7.0.0

stevenlowery011 avatar Mar 10 '20 13:03 stevenlowery011

@stevenlowery011 Any success here? I am getting the same error.

Abhi0725 avatar Nov 11 '20 12:11 Abhi0725