You are not logged in.

#1 2017-04-30 15:13:31

asdfiex
Member
From: Eastern Europe
Registered: 2015-12-15
Posts: 71

[SOLVED] Python 3.6 import unable to load ImageMagick module

Got a simple script to check if the importation succeeded.

#simple_script.py
import matplotlib.pyplot as plt

Running it by ./simple_script.py the cursor turns into a cross-like one and nothing happens moreover, but if I press three left clicks I get

import: unable to load module `/usr/lib/ImageMagick-6.9.8//modules-Q16HDRI/coders/ps.la': file not found @ error/module.c/OpenModule/1290.
import: no encode delegate for this image format `PS' @ error/constitute.c/WriteImage/1184.

python -c "import sys; print (sys.path);"
['', '/home/florea/Projects/python_scripts', '/usr/lib', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/florea/.local/lib/python3.6/site-packages', '/usr/lib/python3.6/site-packages']

pacman --query --list | grep "modules-Q16HDRI/coders/ps.la"
imagemagick /usr/lib/ImageMagick-6.9.8/modules-Q16HDRI/coders/ps.la

Same behaviour with PythonMagick too installed. Any ideas?

Last edited by asdfiex (2017-05-01 17:07:13)

Offline

#2 2017-04-30 16:45:24

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: [SOLVED] Python 3.6 import unable to load ImageMagick module

asdfiex wrote:

Got a simple script to check if the importation succeeded.

#simple_script.py
import matplotlib.pyplot as plt

Running it by ./simple_script.py the cursor turns into a cross-like one and nothing happens moreover, but if I press three left clicks I get

import: unable to load module `/usr/lib/ImageMagick-6.9.8//modules-Q16HDRI/coders/ps.la': file not found @ error/module.c/OpenModule/1290.
import: no encode delegate for this image format `PS' @ error/constitute.c/WriteImage/1184.

Same behaviour with PythonMagick too installed. Any ideas?


Your simple_script.py has no hashbang. It is being interpreted as a shell script so it is running /usr/bin/import on the first line. That is why you see the crosshairs. /usr/bin/import is a command to screenshot X-server windows.

Add a hashbang, e.g.

#!/usr/bin/env python3
import matplotlib.pyplot as plt
print('import succeeded')

or run the script with

python simple_script.py

My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone

Offline

#3 2017-05-01 06:15:11

asdfiex
Member
From: Eastern Europe
Registered: 2015-12-15
Posts: 71

Re: [SOLVED] Python 3.6 import unable to load ImageMagick module

I simply took the code from tutorials as it is.
Better somebody tell them there, lot of abecedarians everywhere... 
It works! Thank you!

Offline

#4 2017-05-01 12:07:38

mrunion
Member
From: Jonesborough, TN
Registered: 2007-01-26
Posts: 1,938
Website

Re: [SOLVED] Python 3.6 import unable to load ImageMagick module

I don't think anyone needs to "tell them there", that is a valid Python script. You put it in a bash file, and your implementation is not a valid bash file. Those tutorials are teaching you about their library, not about bash scripts or any other OS-dependent things you may do.

Last edited by mrunion (2017-05-01 12:08:07)


Matt

"It is very difficult to educate the educated."

Offline

#5 2017-05-01 16:57:00

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: [SOLVED] Python 3.6 import unable to load ImageMagick module

asdfiex wrote:

I simply took the code from tutorials as it is.
Better somebody tell them there, lot of abecedarians everywhere... 
It works! Thank you!

Please edit your first post and prepend "[SOLVED]" to the subject line.


My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB