trying to import mlab from the enthought mayavi module - getting " RuntimeError: No pyface.toolkits plugin could be loaded for qt4" - enthought

The program starts with:-
from mayavi import mlab
from tvtk.tools import visual
and ends up with this message
>/Users/me/Library/Enthought/Canopy/edm/envs/User/lib/python3.5/si>te->packages/pyface/base_toolkit.py in import_toolkit(toolkit_name, >entry_point)
> 225 msg = msg.format(entry_point, toolkit_name)
> 226 logger.info(msg)
>--> 227 raise RuntimeError(msg)
>RuntimeError: No pyface.toolkits plugin could be loaded for qt4

For licensing reasons, Canopy for Python 3.x does not ship with PyQt. Please install PyQt from the Canopy Package Manager, then try again. For more information, search the Enthought Knowledge base for pyqt python 3, which will give you a link to this article: "Python 3 in Canopy 2 - 'No module named PyQt4' error".

Related

Trying to install SDL Perl on Windows 10, problems with "make" (and "dmake" and "gmake")

I am using Windows 10 and Strawberry Perl. I found this nice tutorial on building a 3D engine in Perl. Which requires SDL. For a couple of days I've been trying to install it, but it doesn't work. First I tried via CPAN, no success. No I am trying manually, but I am getting error messages when using "make". If I type "perl -V:make" it says I should use "dmake". If I do so, there's a dmake warning, telling me to use gmake instead. If I do that, there's the following message:
"to undefined at C:/Perl64/site/lib/ExtUtils/Install.pm line 1199. gmake: *** [Makefile:942: pm_to_blib] Error 2"
Any suggestions how to fix this? Or is there an easy (easier) way to install SDL?
It seems like the Perl SDL module uses SDL version 1.2.14, whereas the documentation says
The best course of action is to move to SDL 2.0 or later as quickly as
possible
So, I would recommend looking at the Python bindings PySDL2 instead. The following worked for me on Windows 10:
Downloaded Python 3.8 from here:
https://www.python.org/ftp/python/3.8.2/python-3.8.2-amd64.exe
Then added the following to the User enviroment variables for "Path" (NOTE: at the beginning, not at the end):
%USERPROFILE%\AppData\Local\Programs\Python\Python38
%USERPROFILE%\AppData\Local\Programs\Python\Python38\Scripts
Then, from the command prompt install pysdl2:
>pip install pysdl2
Collecting pysdl2
Downloading https://files.pythonhosted.org/packages/60/ba/ddb48261848874eeb3d54963edbf3c74fff86499746aeb23151f123953bb/PySDL2-0.9.7-py3-none-any.whl (541kB)
|████████████████████████████████| 542kB 2.2MB/s
Installing collected packages: pysdl2
Successfully installed pysdl2-0.9.7
>pip install pysdl2-dll
Collecting pysdl2-dll
Downloading https://files.pythonhosted.org/packages/01/37/f9aa5472fb85ce94507c69110916133ad29b650d2bf277de2cce37d7ad7d/pysdl2_dll-2.0.12-py2.py3-none-win_amd64.whl (2.5MB)
|████████████████████████████████| 2.5MB 3.2MB/s
Installing collected packages: pysdl2-dll
Successfully installed pysdl2-dll-2.0.12
Then, add a new User environment variable PYTHONPATH with value:
%USERPROFILE%\AppData\Local\Programs\Python\Python38\Lib\site-packages
Close the command prompt, and reopen a new one to update the environment variables. Then I created a test Python script:
import sys
import sdl2.ext
resource_dir=r'C:\Users\hakon\AppData\Local\Programs\Python\Python38\Lib\site-packages\sdl2\examples'
RESOURCES = sdl2.ext.Resources(resource_dir, "resources")
sdl2.ext.init()
window = sdl2.ext.Window("Hello World!", size=(640, 480))
window.show()
factory = sdl2.ext.SpriteFactory(sdl2.ext.SOFTWARE)
sprite = factory.from_image(RESOURCES.get_path("hello.bmp"))
spriterenderer = factory.create_sprite_render_system(window)
spriterenderer.render(sprite)
processor = sdl2.ext.TestEventProcessor()
processor.run(window)
sdl2.ext.quit()
and finally run it from the command prompt:
> python test.py

pySerial installed, but still getting ImportError

I am new to Python, so I have likely done something obviously wrong, though despite my best efforts I cannot figure out what.
I am running windows 7 64bit.
I only have Python 3.5 (32 bit) installed.
I updated pip to the latest version succesfully and used it to install pySerial. I am working in eclipse oxygen with PyDev installed. My run configuration does show the appropriate path (as far as I can tell):
run configuration in eclipse/PyDev
I have confirmed pySerial is installed by doing the following in python interpreter:
>>>help()
>>>modules
serial shows up in the list of modules.
also:
>>> import serial; print(serial.__file__)
C:\Python35\lib\site-packages\serial\__init__.py
Additionally, trying to use serial in the terminal works fine, as below:
>>> import serial
>>> s=serial.Serial("COM4")
>>> s
Serial<id=0x383b750, open=True>(port='COM4', baudrate=9600, bytesize=8, parity='N', stop
bits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)
However, when I try to run the following code as a file:
import serial
print ("Test Script")
I get the following error:
Traceback (most recent call last):
File "C:\Users\H260643\Desktop\Projects\EclipseWorkspace\CMP_Thous_Hr\Base.py", line 1, in <module>
import serial
ImportError: No module named 'serial'
For what it's worth, the eclispe editor window has also flagged that line saying it is an "unresolved import: serial"
Right after posting this I realized that the install path for python/pySerial did not match what was in my eclispe/PyDev run configuration. I corrected my run configuration and all is well.

Vpython not working after update

I'm using ubuntu 16.04 and python files that were using vpython that were working fine before now crash showing
from visual import *
ImportError: No module named visual.
I installed anaconda, still nothing. I launched jupyter notebook on the terminal, it opens on a new window in google chrome. I created a test.py file containing just
import vpython
and it prompts:
Traceback (most recent call last):
File "teste vpython.py", line 1, in <module>
import vpython
File "/home/user/anaconda2/lib/python2.7/site-
packages/vpython/__init__.py", line 10, in <module>
from .vpython import *
File "/home/user/anaconda2/lib/python2.7/site-
packages/vpython/vpython.py", line 507, in <module>
get_ipython().kernel.comm_manager.register_target('glow', GlowWidget)
AttributeError: 'NoneType' object has no attribute 'kernel'
I would appreciate if somebody could help me. I know there are similar tags, but I did as every answer I checked as suggested with no results.
Thank you.
I have Ubuntu 16.04 with Anaconda and Python 3.6. Just now I created another environment that contains Python 2.7. In that environment I did "pip install vpython --upgrade" and verified with "pip show vpython" that the version is indeed 7.0.3. I then executed "jupyter notebook" and demo programs ran fine.
I am puzzled by your comment that you created a test.py file, and by the line that says "File "teste vpython.py", line 1, in ". I would expect a file with the .ipynb extension, so something doesn't seem right.
I'll advertise that a better place to pose VPython questions is in the VPython forum at
https://groups.google.com/forum/?fromgroups&hl=en#!forum/vpython-users

Error when executing Canopy's Pythonwin.exe (wincon32 module not found)

I'm sorry if my title doesn't make sense but that's the problem I'm having.
When executing a script at the command line, (or by double-clicking on it) using C:\pythonwin.exe SomeApp.pyw, I get a popup error box saying
ImportError: No module named wincon32. (Full error message at the bottom)
Just executing pythonwin.exe by itself with or without a script also has the same effect.
Google is amazingly bereft of any knowledge of wincon32. Trying to install wincon32 module with pip install wincon32 just says "Could not find a version that satisfies the requirement wincon32 (from version: ) No matching distribution found for wincon32"
pythonwin.exe is in the system's PATH.
Thanks for any help. Below is the full contents of the popup error box.
Title - Python Traceback
Traceback (most recent call last):
File "string", Line 1 in module
File "C:\Users\Me\Canopy(Python)\User\Lib\site-packages\pythonwin\pywin
\framework\startup.py", line 49, in _import_(moduleName)
File "C:\Users\Me\Canopy(Python)\User\Lib\site-packages\pythonwin\pywin
\framework\intpyapp.py", line 3, in import wincon32
ImportError: No module named wincon32
(I'm using Windows 10 x64)
Where did c:\Pythonwin.exe come from? It's not part of any Canopy installation that I've ever heard of. If you're trying to run Canopy Python, see https://support.enthought.com/entries/23646538-Make-Canopy-User-Python-be-your-default-Python

Import error: libjpeg.so.7: cannot open shared object file: No such file or directory

I install the academic Enthought Cannopy on Redhat. When I type in
import _imaging
It print out the error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: libjpeg.so.7: cannot open shared object file: No such file or directory
But on the Enthough website, it was said that the libjpeg has been included.
The Canopy's version is 1.1.0. The output of env in terminal is:
MANPATH=/opt/torque/man:/usr/NX/bin:/usr/kerberos/bin:/usr/java/latest/bin:/share/apps/anaconda/bin:/usr/local/bin:/bin:/usr/bin:/opt/bio/ncbi/bin:/opt/bio/mpiblast/bin/:/opt/bio/hmmer/bin:/opt/bio/EMBOSS/bin:/opt/bio/clustalw/bin:/opt/bio/tcoffee/bin:/opt/bio/phylip/exe:/opt/bio/mrbayes:/opt/bio/fasta:/opt/bio/glimmer/bin://opt/bio/glimmer/scripts:/opt/bio/gromacs/bin:/opt/bio/gmap/bin:/opt/bio/tigr/bin:/opt/bio/autodocksuite/bin:/opt/ganglia/bin:/opt/ganglia/sbin:/opt/openmpi/bin/:/opt/maui/bin:/opt/torque/bin:/opt/torque/sbin
BIOROLL=/opt/bio
TERM=xterm-256color
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=141.211.38.9 36340 22
PHENIX_INSTALLER_DATE=300920111225
ROCKSROOT=/opt/rocks/share/devel
PHENIX_MVERSION=redhat-e5.4
PHENIX=/share/apps/phenix-1.7.2-869
SSH_TTY=/dev/pts/8
ANT_HOME=/opt/rocks
USER=xqding
PHENIX_MTYPE=intel-linux-2.6-x86_64
LS_COLORS=
ROCKS_ROOT=/opt/rocks
VIRTUAL_ENV=/home/xq/Enthought/Canopy_64bit/User
MAIL=/var/spool/mail/xq
PATH=/home/xqding/Enthought/Canopy_64bit/User/bin:/home/xq/Enthought/Canopy_64bit/User/bin:/home/xq/apps/bin:/share/apps/phenix-1.7.2-869/build/intel-linux-2.6-x86_64/bin:/library/yzhang/bin/HMMER:/usr/bin:/bin:/sbin:/usr/sbin:/mnt/sysimage/bin:/mnt/sysimage/usr/bin:/mnt/sysimage/usr/sbin:/mnt/sysimage/sbin:/mnt/sysimage/usr/X11R6/bin:/tmp/updates/rocks/bin:/tmp/updates/usr/sbin:/tmp/updates/sbin:/tmp/updates/usr/bin:/opt/rocks/bin:/opt/rocks/sbin:/opt/sun-ct/bin:/home/xq/apps/cd-hit-v4.6.1-2012-08-27:/home/xq/apps/samtools-0.1.19:/library/blast/bin:/home/xq/apps/cd-hit-v4.6-2012-04-25:/home/xq/apps/dssp-2.2.1:/home/xqding/apps/dssp-ver2hor:/home/xq/bin:/home/xq/apps/python/2.7/bin
NXDIR=/usr/NX
INPUTRC=/etc/inputrc
PWD=/home/xqding/appsrc
JAVA_HOME=/usr/java/latest
EDITOR=emacsclient
LANG=en_US.iso885915
PHENIX_USE_MTYPE=intel-linux-2.6-x86_64
PHENIX_ENVIRONMENT=1
BLASTDB=/home/xqding/bio/ncbi/db
PHENIX_VERSION=1.7.2
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
PHENIX_RELEASE_TAG=869
SHLVL=1
HOME=/home/xq
ROLLSROOT=/opt/rocks/share/devel/src/roll
LOGNAME=xqding
CVS_RSH=ssh
LESSOPEN=|/usr/bin/lesspipe.sh %s
BLASTMAT=/opt/bio/ncbi/data
G_BROKEN_FILENAMES=1
_=/usr/bin/env
I download the source code of libjpeg version 7 and install it on the Redhat computer. Then add the library directory to the export LD_LIBRARY_PATH=directory of libjpeg. Then the problem is solved. I appreciate the help I got from here. So I just add the solution.
It's possible that the libjpeg version installed with your RedHat is outdated (are you on RedHat 5?). Try and open the RedHat package manager and look for "jpeg". Installing a later version of the library might fix this issue.