Installing wx python in python3 - python-3.x

I am running video player file in python 3 that has the following imports
import os
import time
import wx
import MplayerCtrl as mpc
import wx.lib.buttons as buttons
I get this the first time:
Traceback (most recent call last):
File "videoplayer.py", line 3, in <module>
import wx
ImportError: No module named 'wx'
When I try to install wx using pip3 install wx , this happens:
Downloading/unpacking wx
Downloading wx-3.0.3.tar.gz (41.8MB): 17.1MB downloaded
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python3/dist-packages/pip/req.py", line 1198, in prepare_files
do_download,
File "/usr/lib/python3/dist-packages/pip/req.py", line 1376, in unpack_url
self.session,
File "/usr/lib/python3/dist-packages/pip/download.py", line 572, in unpack_http_url
download_hash = _download_url(resp, link, temp_location)
File "/usr/lib/python3/dist-packages/pip/download.py", line 433, in _download_url
for chunk in resp_read(4096):
File "/usr/lib/python3/dist-packages/pip/download.py", line 421, in resp_read
chunk_size, decode_content=False):
File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py", line 225, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py", line 174, in read
data = self._fp.read(amt)
File "/usr/lib/python3.4/http/client.py", line 500, in read
return super(HTTPResponse, self).read(amt)
File "/usr/lib/python3.4/http/client.py", line 539, in readinto
n = self.fp.readinto(b)
File "/usr/lib/python3.4/socket.py", line 374, in readinto
return self._sock.recv_into(b)
File "/usr/lib/python3.4/ssl.py", line 769, in recv_into
return self.read(nbytes, buffer)
File "/usr/lib/python3.4/ssl.py", line 641, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
Storing debug log for failure in /home/cc/.pip/pip.log
How can I install wx in python3 without incurring this error?

Use the following to install python 3 wxpython phoenix.
pip3 install -U --pre --trusted-host wxpython.org -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix

Related

IPython Not opening (invalid syntax)

I have installed IPython using the command:
python3.7 -m pip install ipython
And it gave the prompt of successful installation as well but when i try to open IPython using the command:
python3.7 -m IPython
(NOTE: using IPython instead of ipython because that's how it is stored in my system)
I am getting the following error:
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.7/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.7/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/usr/local/lib/python3.7/dist-packages/IPython/__init__.py", line 54, in <module>
from .core.application import Application
File "/usr/local/lib/python3.7/dist-packages/IPython/core/application.py", line 25, in <module>
from IPython.core import release, crashhandler
File "/usr/local/lib/python3.7/dist-packages/IPython/core/crashhandler.py", line 27, in <module>
from IPython.core import ultratb
File "/usr/local/lib/python3.7/dist-packages/IPython/core/ultratb.py", line 119, in <module>
from IPython.utils import path as util_path
File "/usr/local/lib/python3.7/dist-packages/IPython/utils/path.py", line 17, in <module>
from IPython.utils.process import system
File "/usr/local/lib/python3.7/dist-packages/IPython/utils/process.py", line 19, in <module>
from ._process_posix import system, getoutput, arg_split, check_pid
File "/usr/local/lib/python3.7/dist-packages/IPython/utils/_process_posix.py", line 23, in <module>
import pexpect
File "/usr/lib/python3/dist-packages/pexpect/__init__.py", line 75, in <module>
from .pty_spawn import spawn, spawnu
File "/usr/lib/python3/dist-packages/pexpect/pty_spawn.py", line 15, in <module>
from .spawnbase import SpawnBase
File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 218
def expect(self, pattern, timeout=-1, searchwindowsize=-1, async=False):
^
SyntaxError: invalid syntax
Download pexpect4.6 source code from https://github.com/pexpect/pexpect/releases/tag/4.6
Extract the source code, get into the folder and install the pexpect by:
sudo python3.7 setup.py install
This should solve your problem. :)

Error while installing pip

While installing pip via get-pip.py faced this error, Any help on this will be appreciated.
C:\Python32>python get-pip.py
Traceback (most recent call last):
File "get-pip.py", line 20061, in <module>
main()
File "get-pip.py", line 194, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
import pip
File "c:\users\kanika~1\appdata\local\temp\tmps55rv7\pip.zip\pip\__init__.py",
line 21, in <module>
File "c:\users\kanika~1\appdata\local\temp\tmps55rv7\pip.zip\pip\_vendor\requests\__init__.py", line 66, in <module>
File "c:\users\kanika~1\appdata\local\temp\tmps55rv7\pip.zip\pip\_vendor\requests\models.py", line 856
http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)
^
SyntaxError: invalid syntax

Error using pip - module 'pip._vendor.html5lib' has no attribute 'parse'

This error popped up today while trying to install some packages using pip. Python version - 3.5.4
pip install pytesseract
It gives the following exception :
Collecting pytesseractException:
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in ru
n
wb.build(autobuilding=True)
File "C:\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare
_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Anaconda3\lib\site-packages\pip\req\req_set.py", line 554, in _prepar
e_file
require_hashes
File "C:\Anaconda3\lib\site-packages\pip\req\req_install.py", line 278, in pop
ulate_link
self.link = finder.find_requirement(self, upgrade)
File "C:\Anaconda3\lib\site-packages\pip\index.py", line 465, in find_requirem
ent
all_candidates = self.find_all_candidates(req.name)
File "C:\Anaconda3\lib\site-packages\pip\index.py", line 423, in find_all_cand
idates
for page in self._get_pages(url_locations, project_name):
File "C:\Anaconda3\lib\site-packages\pip\index.py", line 568, in _get_pages
page = self._get_page(location)
File "C:\Anaconda3\lib\site-packages\pip\index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "C:\Anaconda3\lib\site-packages\pip\index.py", line 811, in get_page
inst = cls(resp.content, resp.url, resp.headers)
File "C:\Anaconda3\lib\site-packages\pip\index.py", line 728, in __init__
self.parsed = html5lib.parse(
AttributeError: module 'pip._vendor.html5lib' has no attribute 'parse'
This exception comes up even for pip update commands. html5lib version is 0.999. The following code seems to be working fine.
import html5lib
document = html5lib.parse("<p>Hello World!")
Any pointers as to why this error is coming up would be helpful. Thanks in advance.
I was using anaconda and recently updated conda and anaconda and I recieved this error.
'conda update pip' fixed it

Can't install twython on Python 3.2 (Raspberry Pi)

I'm trying to install twython, but keep getting errors.
First attempt:
pi#raspberrypi ~/twython $ sudo pip-3.2 install twython
Running setup.py egg_info for package requests
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/pi/twython/build/requests/setup.py", line 52, in <module>
exec(f.read(), about)
File "<string>", line 14
__cake__ = u'\u2728 \U0001f370 \u2728'
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/pi/twython/build/requests/setup.py", line 52, in <module>
exec(f.read(), about)
File "<string>", line 14
__cake__ = u'\u2728 \U0001f370 \u2728'
^
SyntaxError: invalid syntax
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /home/pi/twython/build/requests
Next I searched on the last line of the error and followed some suggestions that said to make sure setuptools and ez_install were installed and up to date, but that didn't help.
Then I followed the backup instructions on ReadtheDocs that said to try to install it this way:
git clone git://github.com/ryanmcgrath/twython.git
cd twython
sudo python3 setup.py install
but it failed again:
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 640, in install_item
self.process_distribution(spec, dist, deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 692, in process_distribution
[requirement], self.local_index, self.easy_install
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 576, in resolve
dist = best[req.key] = env.best_match(req, self, installer)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 822, in best_match
return self.obtain(req, installer) # try and download/install
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 834, in obtain
return installer(requirement)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 608, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 638, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 828, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1105, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1094, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 31, in run_setup
lambda: exec(compile(open(
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 73, in run
return func()
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 34, in <lambda>
{'__file__':setup_script, '__name__':'__main__'})
File "setup.py", line 52, in <module>
Error in atexit._run_exitfuncs:
TypeError: 'NoneType' object is not callable
It turns out that Twython cannot work with Python v3.2 because it depends on the requests module which apparently is not supported in Python 3.2.
One of the developers of Twython just explained this to me on Twitter.

Python 3.4.3 - Error Pyshark capture.sniff()

Here is my code:
import pyshark
capture = pyshark.LiveCapture(interface='en0')
capture.sniff()
Now here is the error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
capture.sniff()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/capture/capture.py", line 109, in load_packets
self.apply_on_packets(keep_packet, timeout=timeout)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/capture/capture.py", line 201, in apply_on_packets
return self.eventloop.run_until_complete(coro)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/trollius/base_events.py", line 350, in run_until_complete
return future.result()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/trollius/futures.py", line 286, in result
raise self._exception
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/trollius/tasks.py", line 250, in _step
result = coro.throw(exc)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/capture/capture.py", line 212, in packets_from_tshark
tshark_process = yield From(self._get_tshark_process(packet_count=packet_count))
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/trollius/tasks.py", line 252, in _step
result = coro.send(value)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/capture/capture.py", line 298, in _get_tshark_process
parameters = [get_tshark_path(self.tshark_path), '-l', '-n', '-T', xml_type] + self.get_parameters(packet_count=packet_count)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyshark/tshark/tshark.py", line 93, in get_tshark_path
'Search these paths: {}'.format(possible_paths)
pyshark.tshark.tshark.TSharkNotFoundException: TShark not found. Try adding its location to the configuration file. Search these paths: ['C:\\Program Files\\Wireshark\\tshark.exe', '/usr/bin/tshark', '/bin/tshark', '/usr/sbin/tshark', '/sbin/tshark']
I am running mac os 10.10.x with python 3.4.3
Installed pyshark with sudo pip3 install pyshark
Try Installing tshark that worked for me and I am on Ubuntu linux.
sudo apt-get install TShark
Blessings.

Resources