Run iPython on Windows 8 64 bit - python

I am trying to run iPython on my Windows 8. I installed python 3.4.0 (32 bit version) and successfully installed iPython through the command
easy_install ipython[all]
The problem is when I try to run it
ipython notebook
I get the following error:
Traceback (most recent call last):
File "C:\Python34\Scripts\ipython-script.py", line 9, in <module>
load_entry_point('ipython==3.1.0', 'console_scripts', 'ipython')()
File "C:\Python34\lib\site-packages\IPython\__init__.py", line 120, in start_ipython return launch_new_instance(argv=argv, **kwargs)
File "C:\Python34\lib\site-packages\IPython\config\application.py", line 573, in launch_instance app.initialize(argv)
File "<string>", line 2, in initialize
File "C:\Python34\lib\site-packages\IPython\config\application.py", line 75, in catch_config_error return method(app, *args, **kwargs)
File "C:\Python34\lib\site-packages\IPython\terminal\ipapp.py", line 321, in initialize super(TerminalIPythonApp, self).initialize(argv)
File "<string>", line 2, in initialize
File "C:\Python34\lib\site-packages\IPython\config\application.py", line 75, in catch_config_error return method(app, *args, **kwargs)
File "C:\Python34\lib\site-packages\IPython\core\application.py", line 369, in initialize self.parse_command_line(argv)
File "C:\Python34\lib\site-packages\IPython\terminal\ipapp.py", line 316, in parse_command_line return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<string>", line 2, in parse_command_line
File "C:\Python34\lib\site-packages\IPython\config\application.py", line 75, in catch_config_error return method(app, *args, **kwargs)
File "C:\Python34\lib\site-packages\IPython\config\application.py", line 471, in parse_command_line return self.initialize_subcommand(subc, subargv)
File "<string>", line 2, in initialize_subcommand
File "C:\Python34\lib\site-packages\IPython\config\application.py", line 75, in catch_config_error return method(app, *args, **kwargs)
File "C:\Python34\lib\site-packages\IPython\config\application.py", line 402, in initialize_subcommand subapp = import_item(subapp)
File "C:\Python34\lib\site-packages\IPython\utils\importstring.py", line 42, in import_item module = __import__(package, fromlist=[obj])
File "C:\Python34\lib\site-packages\IPython\html\notebookapp.py", line 30, in <module> check_for_zmq('13', 'IPython.html')
File "C:\Python34\lib\site-packages\IPython\utils\zmqrelated.py", line 10, in check_for_zmq import zmq
File "C:\Python34\lib\site-packages\zmq\__init__.py", line 25, in <module> _libsodium = ctypes.cdll.LoadLibrary(bundled_sodium[0])
File "C:\Python34\lib\ctypes\__init__.py", line 429, in LoadLibrary return self._dlltype(name)
File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
Probably the 'name' of some application is wrongly specified. Can you help me to understand how to fix it?
Thank you!

Easy_Install is the devil (IMHO). You might want to use Continuum Anaconda. The Continuum solution is one that simply "just works" and helps to avoid the many hassles you will most likely have later with Easy_Install.

Related

Spark Error: "ModuleNotFoundError: No module named 'notebook'" even when jupyter is installed

I am trying to run pyspark in the linux terminal. I have most of the installation done but I am getting the following error when I call pyspark in the linux terminal:
[TerminalIPythonApp] WARNING | Subcommand `ipython notebook` is deprecated and will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook` in the future
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-110>", line 2, in initialize
File "/usr/lib/python3/dist-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/lib/python3/dist-packages/IPython/terminal/ipapp.py", line 307, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/usr/lib/python3/dist-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/lib/python3/dist-packages/IPython/core/application.py", line 455, in initialize
self.parse_command_line(argv)
File "/usr/lib/python3/dist-packages/IPython/terminal/ipapp.py", line 302, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<decorator-gen-4>", line 2, in parse_command_line
File "/usr/lib/python3/dist-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/lib/python3/dist-packages/traitlets/config/application.py", line 514, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "/usr/lib/python3/dist-packages/IPython/core/application.py", line 244, in initialize_subcommand
return super(BaseIPythonApplication, self).initialize_subcommand(subc, argv)
File "<decorator-gen-3>", line 2, in initialize_subcommand
File "/usr/lib/python3/dist-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/lib/python3/dist-packages/traitlets/config/application.py", line 445, in initialize_subcommand
subapp = import_item(subapp)
File "/usr/lib/python3/dist-packages/ipython_genutils/importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
ModuleNotFoundError: No module named 'notebook'
Most other forums say to install jupyter as follows:
pip install jupyter
but I already have this done.
Try this:
PYSPARK_DRIVER_PYTHON=ipython3 pyspark

Python ImportError: cannot import name 'Poller' while running pyspark

I have referred to this tut to get started with pyspark on windows. These are the steps I followed:
Downloaded spark prebuilt for hadoop 2.7 from here
Extracted spark-2.1.0-bin-hadoop2.7.tgz to the directory set as %SPARK_HOME% in environment variables
Downloaded winutils.exe from here
Pasted winutils.exe in %SPARK_HOME%\bin
Set %HADOOP_HOME% to same directory as %SPARK_HOME%
Set %PYSPARK_DRIVER_PYTHON% to ipython
Set %PYSPARK_DRIVER_PYTHON_OPTS% to notebook
Added ;%SPARK_HOME%\bin to %PATH%
But when I run
> pyspark --master local[2]
I get following error:
[TerminalIPythonApp] WARNING | Subcommand `ipython notebook` is deprecated and will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook` in the future
Traceback (most recent call last):
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\mahesh\Softwares\python\WinPython-64bit-3.4.4.4Qt5\python-3.4.4.amd64\Scripts\ipython.exe\__main__.py", line 9, in <module>
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\IPython\__init__.py", line 125, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\traitlets\config\application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-113>", line 2, in initialize
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\IPython\terminal\ipapp.py", line 308, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\IPython\core\application.py", line 450, in initialize
self.parse_command_line(argv)
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\IPython\terminal\ipapp.py", line 303, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<decorator-gen-4>", line 2, in parse_command_line
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\traitlets\config\application.py", line 514, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\IPython\core\application.py", line 243, in initialize_subcommand
return super(BaseIPythonApplication, self).initialize_subcommand(subc, argv)
File "<decorator-gen-3>", line 2, in initialize_subcommand
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\traitlets\config\application.py", line 445, in initialize_subcommand
subapp = import_item(subapp)
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\ipython_genutils\importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\notebook\notebookapp.py", line 31, in <module>
from zmq.eventloop import ioloop
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\zmq\eventloop\__init__.py", line 3, in <module>
from zmq.eventloop.ioloop import IOLoop
File "d:\mahesh\softwares\python\winpython-64bit-3.4.4.4qt5\python-3.4.4.amd64\lib\site-packages\zmq\eventloop\ioloop.py", line 21, in <module>
from zmq import (
ImportError: cannot import name 'Poller'
I am correctly able to run spark scala shell with >spark-shell command.
As you can see in the stack trace, I had win-python installed already at path
D:\mahesh\Softwares\python\WinPython-64bit-3.4.4.4Qt5\python-3.4.4.amd64
Thus, my %PYTHON_HOME% is D:\mahesh\Softwares\python\WinPython-64bit-3.4.4.4Qt5.
But my %SPARK_HOME% is D:\mahesh\Programs\spark-2.3.0-bin-hadoop2.7.
Running where pyspark command gives following output:
D:\mahesh\Programs\spark-2.3.0-bin-hadoop2.7\bin\pyspark
D:\mahesh\Programs\spark-2.3.0-bin-hadoop2.7\bin\pyspark.cmd
D:\mahesh\Softwares\python\WinPython-64bit-3.4.4.4Qt5\python-3.4.4.amd64\Scripts\pyspark
D:\mahesh\Softwares\python\WinPython-64bit-3.4.4.4Qt5\python-3.4.4.amd64\Scripts\pyspark.cmd
I believe my issue is some missconfiguration of my windows spark environment. Thats why I gave all above information. So whats going wrong here?
Note that I performed the steps without using Anaconda and GOW (Gnu on windows) as suggested in the tut.
Point your %PYSPARK_DRIVER_PYTHON% to a virtual environment with all dependencies including 'Poller' and then check.
Else you can try installing 'Poller' in ipython environment( which I frankly dont know how!)

Using pip install within PyScripter

I want to install a Python package within a script in PyScripter.
import pip
package = 'xlsxwriter'
pip.main(['install', package])
Following error occurs:
Collecting xlsxwriter
Downloading XlsxWriter-0.9.3-py2.py3-none-any.whl (136kB)
Exception:
Traceback (most recent call last):
File "C:\Python27\ArcGIS10.4\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Python27\ArcGIS10.4\lib\site-packages\pip\commands\install.py", line 299, in run
requirement_set.prepare_files(finder)
File "C:\Python27\ArcGIS10.4\lib\site-packages\pip\req\req_set.py", line 370, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Python27\ArcGIS10.4\lib\site-packages\pip\req\req_set.py", line 587, in _prepare_file
session=self.session, hashes=hashes)
File "C:\Python27\ArcGIS10.4\lib\site-packages\pip\download.py", line 810, in unpack_url
hashes=hashes
File "C:\Python27\ArcGIS10.4\lib\site-packages\pip\download.py", line 649, in unpack_http_url
hashes)
File "C:\Python27\ArcGIS10.4\lib\site-packages\pip\download.py", line 871, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "C:\Python27\ArcGIS10.4\lib\site-packages\pip\download.py", line 577, in _download_url
progress_indicator = DownloadProgressBar(max=total_length).iter
File "C:\Python27\ArcGIS10.4\lib\site-packages\pip\utils\ui.py", line 158, in __init__
super(WindowsMixin, self).__init__(*args, **kwargs)
File "C:\Python27\ArcGIS10.4\lib\site-packages\pip\utils\ui.py", line 82, in __init__
super(InterruptibleMixin, self).__init__(*args, **kwargs)
File "C:\Python27\ArcGIS10.4\lib\site-packages\pip\utils\ui.py", line 118, in __init__
super(DownloadProgressMixin, self).__init__(*args, **kwargs)
File "C:\Python27\ArcGIS10.4\lib\site-packages\pip\_vendor\progress\helpers.py", line 58, in __init__
if self.file.isatty() and self.hide_cursor:
File "<string>", line 523, in __getattr__
File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\netref.py", line 150, in __getattr__
return syncreq(self, consts.HANDLE_GETATTR, name)
File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\netref.py", line 71, in syncreq
return conn.sync_request(handler, oid, *args)
File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py", line 434, in sync_request
raise obj
AttributeError: DebugOutput instance has no attribute 'isatty'
Why does this error occur und how to fix it? The same code works well when using the Python interpreter directly, but not with PyScripter for some reason.
Thanks a lot for your help.

I can not get ipython notebook working. Ubuntu 12.04 [duplicate]

This question already has answers here:
ImportError: No module named jinja2
(8 answers)
Closed 9 years ago.
I installed ipython notebook using their instructions. That didn't work. So i tried other instructions. I seemed to get closer to getting it working. currently this is the output i get when i try to run ipnotebook.
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 9, in <module>
load_entry_point('ipython==1.1.0', 'console_scripts', 'ipython')()
File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/__init__.py", line 118, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 544, in launch_instance
app.initialize(argv)
File "<string>", line 2, in initialize
File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 89, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/terminal/ipapp.py", line 312, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<string>", line 2, in initialize
File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 89, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/core/application.py", line 362, in initialize
self.parse_command_line(argv)
File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/terminal/ipapp.py", line 307, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<string>", line 2, in parse_command_line
File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 89, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 474, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<string>", line 2, in initialize_subcommand
File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 89, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 405, in initialize_subcommand
subapp = import_item(subapp)
File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/utils/importstring.py", line 42, in import_item
module = __import__(package, fromlist=[obj])
File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/html/notebookapp.py", line 38, in <module>
from jinja2 import Environment, FileSystemLoader
ImportError: No module named jinja2
In order to load Jinja locally you also have to have it installed locally
easy_install Jinja2
or
pip install Jinja2
or
sudo apt-get install python-jinja2

Python unicode error dependent on the path I supply?

I have been having some issues executing a command (launching IPython) over SSH. In troubleshooting it, I've come across something I can't understand. IPython either launches or doesn't dependent on whether I supply the full path or not - what's going wrong here?
/home/ubuntu/anaconda/bin/ipython notebook —-profile=server
...gives me the errors below, while:
~/anaconda/bin/ipython notebook --profile=server
...loads IPython flawlessly.
It's worth confirming that when I go to my home directory by typing cd, I do indeed get /home/ubuntu
Full stack trace:
ubuntu#ip-10-204-37-226:~$ /home/ubuntu/anaconda/bin/ipython notebook
—-profile=server Traceback (most recent call last): File
"/home/ubuntu/anaconda/bin/ipython", line 6, in
sys.exit(start_ipython()) File "/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/init.py",
line 118, in start_ipython
return launch_new_instance(argv=argv, **kwargs) File "/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/config/application.py",
line 544, in launch_instance
app.initialize(argv) File "", line 2, in initialize File
"/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/config/application.py",
line 89, in catch_config_error
return method(app, *args, **kwargs) File "/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/terminal/ipapp.py",
line 312, in initialize
super(TerminalIPythonApp, self).initialize(argv) File "", line 2, in initialize File
"/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/config/application.py",
line 89, in catch_config_error
return method(app, *args, **kwargs) File "/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/core/application.py",
line 362, in initialize
self.parse_command_line(argv) File "/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/terminal/ipapp.py",
line 307, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv) File "", line 2, in parse_command_line File
"/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/config/application.py",
line 89, in catch_config_error
return method(app, *args, **kwargs) File "/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/config/application.py",
line 463, in parse_command_line
self.argv = list(argv) File "/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/utils/traitlets.py",
line 315, in set
new_value = self._validate(obj, value) File "/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/utils/traitlets.py",
line 323, in _validate
return self.validate(obj, value) File "/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/utils/traitlets.py",
line 1215, in validate
value = self.validate_elements(obj, value) File "/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/utils/traitlets.py",
line 1291, in validate_elements
return super(List, self).validate_elements(obj, value) File "/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/utils/traitlets.py",
line 1225, in validate_elements
v = self._trait.validate(obj, v) File "/home/ubuntu/anaconda/lib/python2.7/site-packages/IPython/utils/traitlets.py",
line 1028, in validate
return unicode(value) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

Categories