wxPython import error with Windows install - python

I have installed Python 3.4 and wxPython Phoenix on Windows 10. I go into Eclipse and add wxPython to the external libs in my project, but when I try to import it, I get this error:
Traceback (most recent call last):
File "C:\Users\linus\workspace\MiCS 1.2\main.py", line 1, in <module>
import wx
File "C:\Python34\Lib\site-packages\wx\__init__.py", line 17, in <module>
from wx.core import *
File "C:\Python34\Lib\site-packages\wx\core.py", line 6, in <module>
from ._core import *
ImportError: DLL load failed: The specified module could not be found.
I did some searching and tinkering and still can't figure out what's causing it. It shouldn't be the msvcp or msvcr DLLs as I have Office running just fine (or is that an incorrect assumption?) Any help is appreciated. Thanks.

How did you install wxpython?
As of now, the top page of the official site has wxpython 3.0 only for python27. So, I suspect you might not have installed it properly.
If you have your python34 at C:/Python34 then, cd to C:/Python34/Scripts first so that we make sure to use the pip for this python.
According to this post (https://groups.google.com/forum/#!topic/wxpython-dev/LmGIrQyh7jc), try
pip install -U --pre -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix
This should find the corresponding whl file for your python version and CPU architecture.
Or, you could manually download whl file at http://wxpython.org/Phoenix/snapshot-builds/
If you have 32 bit Python34, then look for ******-cp34-none-win32.whl
and simply do:
pip install path/to/the/whl/that/you/just/downloaded/wxPython_Phoenix-3.0.3.dev1839+4ecd949-cp34-none-win32.whl
After this, if you can import wx in the normal cmd then the problem should be coming from eclipse.

Related

Custom python install location: tkinter problems

I'm using Ubuntu 14.04. While I have to retain my "main" python install as 2.7.6, I need to install 2.7.9 to be able to use ssl.SSLContext, to get Flask to deal with HTTPS requests.
However, if I just do:
sudo make install
or
sudo make altinstall
in the Python-2.7.9 directory, I ultimately get:
make: *** [libinstall] Error 1
EDIT: this appears at the end of sudo make install:
...
Compiling /usr/local/lib/python2.7/xml/sax/saxutils.py ...
Compiling /usr/local/lib/python2.7/xml/sax/xmlreader.py ...
Compiling /usr/local/lib/python2.7/xmllib.py ...
Compiling /usr/local/lib/python2.7/xmlrpclib.py ...
Compiling /usr/local/lib/python2.7/zipfile.py ...
make: *** [libinstall] Error 1
So I installed it to a custom directory by modifying the call to ./config, which did not yield the libinstall error.
However, when I try to import Tkinter into Python 2.7.9 (running from the custom directory) I obtain:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/repos/Python279/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
If I just go ahead and install the vanilla way (i.e., to a non-custom directory) and simply ignore the libinstall error I get, upon importing Tkinter:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: /usr/lib/python2.7/lib-dynload/_tkinter.so: undefined symbol: PyFPE_jbuf
Does anyone have any idea what is going on?
Following furas' suggestion, installing via the
Python 2.7 PPA maintained be Felix Krull worked spectacularly. Thanks Furas!
EDIT Some notes:
Because this PPA installs python2.7 (specifically v. 2.7.11, as of 1/29/2016), this obviated the need for a custom python install location
While the PPA website mentions that this doesn't include python-tk, provided you have installed it, python plays with it just fine (solving my problem)
First of all source code from a program must be configured, compiled, then installed. You can do this by:
./configure # Or ./config depending on the file name
make
make install
Second of all when you tried to import the module _tkinter you wanted to import the .py file which was called Tkinter.py
Try to use:
import Tkinter

Error during library import in Python (Windows)

I am trying to configure svn hook for email notification using mailer.py script from apache, but it always crash on import of svn libs. I try two ways of installing svn and python. I try to install everything manually using command line and use CollableNet installer that have preinstalled Python and all libs I need but result is the same.
Now I try to import one library from hole package that I need using python in command line and I have such response:
>>> import svn.core
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named svn.core
I try to fix it using:
1) import sys; sys.path.append("C:\csvn\lib\svn-python\svn")
and
2) C:\csvn\lib\svn-python\svn>python "\__init__.py" install
But it didn't help.
For now I have no package with setup.py to install it.
I spend a lot of time on this task, and going crazy a little). Please give me any suggestion how to fix it.

Can't import WMI Python module

I'm new to python.
I'm working in windows environment. mostly win7.
My machine is win7 32bit also.
I downloaded the wmi module and used the .exe to install it.
when I try and 'import wmi', i get an error:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
import wmi
File "C:\Python33\lib\wmi.py", line 88, in <module>
from win32com.client import GetObject, Dispatch
ImportError: No module named 'win32com'
How can I solve this? Does win7 compliant with this module?
Regards
download WMI-1.4.9.win32.exe from https://pypi.python.org/pypi/WMI/ and it will resolve your problem
Instead you can also install win32com which would resolve the issue.
To install win32com use:
pip install pypiwin32
What worked for me is:
i downloaded the source named: WMI-1.4.9.zip from https://pypi.python.org/pypi/WMI/
Extracted all files from that zip file and saved it in a folder named: WMI-1.4.9 and then copied that folder to C:\Python27\Lib\site-packages.
After that I navigated to that folder C:\Python27\Lib\site-packages\WMI-1.4.9 and did a shift + right click -> Open Command line here and ran: python setup.py install
That's it, after that it worked for me like charm. No issues.
p.s - While installing exe I had some weird Access Denied errors, I tried by running the exe as Administrator even then I could get through it. Hence that didn't at all work for me.
Also I had pywin32 installed from here:
http://sourceforge.net/projects/pywin32/files/ (select the correct file - 'bittedness' and python version wise)

ImportError: No module named qgis.core

I am on Ubuntu 13.04. I get the following error message -
Traceback (most recent call last):
File "analyse.py", line 1, in <module>
from log import shelve
File "/home/shubham/SMART/TaxiData/log.py", line 27, in <module>
from demo import *
File "/home/shubham/SMART/zones/demo.py", line 5, in <module>
from qgis.core import *
ImportError: No module named qgis.core
Actually, everything was working fine till today morning. I guess this might be due to a package update.
I tried looking around on Google but my search was fruitless. So, I will really appreciate any help or pointers you guys can give :)
Thanks.
I solved the problem by completely removing the installation and using the nightly builds at 'deb http://qgis.org/debian-nightly raring main'.
If you have pip installed you could either try pip search qgis or pip freeze. The latter shows a list of all installed python packages to check if you have the package. Maybe try reinstalling qgis ...
Try sudo apt-get install python-qgis . The package does not appear to be available on PyPI, but it was listed as "python-qgis" in the Ubuntu packages.

Import VTK in Python Interpreter

Goal: Trying to use VTK library in Python Interpreter.
What I did: I have installed VTK using CMake with option VTK_WRAP_PYTHON and Shared_Library enabled and build the VTK in visual studio and it has finished with all builds successfully.
Then I made the Python_Path.
Problem: When I try to import vtk library into python, I get the following error message:
>>> import vtk
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import vtk
File "...\VTK\VTKvisual\Wrapping\Python\vtk\__init__.py", line 42, in <module>
from vtkFilteringPython import *
ImportError: No module named vtkFilteringPython
Any thoughts that why this is happening?
Thanks
It looks like you've added the location of the VTK package directory, containing .py files such as "filtering.py" and "vtkFilteringPython.pyd", to your PYTHONPATH.
However, now you need to add both this directory and also the directory containing vtkFilteringPythonD.dll and the other DLLs to your PATH. The location of this directory depends on whether you've just run the build, or also the INSTALL target. Usually it's in "VTK\bin" or "VTK\bin\BUILDTARGET" somewhere, where BUILDTARGET is for example Debug or Release.
Try running sudo apt-get install python-vtk
If you're only using the Python wrappers, right now, you can just install it from PyPI. Just do pip install vtk and you'll get the current version (which is now 8.1).
Look here for the announcement.

Categories

Resources