ipython notebook installation on mac os x - macos

I am wondering if anyone has installed ipython notebook on mac OSX?
Currently I am able to run it in the terminal note but as soon as I type in the notebook version, there are problems encountered in running it.
Below is the error I have gotten:
Traceback (most recent call last): File
"/Users/tayyangki/anaconda/bin/ipython", line 9, in
load_entry_point('ipython==2.0.0-dev', 'console_scripts', 'ipython')() File
"/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/init.py",
line 118, in start_ipython
return launch_new_instance(argv=argv, **kwargs) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 565, in launch_instance
app.initialize(argv) File "", line 2, in initialize File
"/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 92, in catch_config_error
return method(app, *args, **kwargs) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/terminal/ipapp.py",
line 314, in initialize
super(TerminalIPythonApp, self).initialize(argv) File "", line 2, in initialize File
"/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 92, in catch_config_error
return method(app, *args, **kwargs) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/core/application.py",
line 371, in initialize
self.parse_command_line(argv) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/terminal/ipapp.py",
line 309, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv) File "", line 2, in parse_command_line File
"/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 92, in catch_config_error
return method(app, *args, **kwargs) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 474, in parse_command_line
return self.initialize_subcommand(subc, subargv) File "", line 2, in initialize_subcommand File
"/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 92, in catch_config_error
return method(app, *args, **kwargs) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 405, in initialize_subcommand
subapp = import_item(subapp) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/utils/importstring.py",
line 42, in import_item
module = import(package, fromlist=[obj]) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/html/notebookapp.py",
line 75, in
from IPython.consoleapp import IPythonConsoleApp File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/consoleapp.py",
line 43, in
from IPython.kernel.zmq.kernelapp import ( File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/kernel/zmq/kernelapp.py",
line 54, in
from .ipkernel import Kernel File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/kernel/zmq/ipkernel.py", line 40, in
from .zmqshell import ZMQInteractiveShell File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/kernel/zmq/zmqshell.py", line 36, in
from IPython.core.payloadpage import install_payload_page File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/core/payloadpage.py",
line 24, in
from docutils.core import publish_string File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/docutils/core.py",
line 20, in
from docutils import frontend, io, utils, readers, writers File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/docutils/frontend.py",
line 41, in
import docutils.utils File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/docutils/utils/init.py",
line 20, in
import docutils.io File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/docutils/io.py",
line 18, in
from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput File
"/Users/tayyangki/anaconda/lib/python2.7/site-packages/docutils/utils/error_reporting.py",
line 47, in
locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1] File
"/Users/tayyangki/anaconda/lib/python2.7/locale.py", line 511, in
getdefaultlocale
return _parse_localename(localename) File "/Users/tayyangki/anaconda/lib/python2.7/locale.py", line 443, in
_parse_localename
raise ValueError, 'unknown locale: %s' % localename ValueError: unknown locale: UTF-8
Greatly appreciated if someone could help me?

As noted here, the workaround for the "unknown locale: UTF-8" issue to add:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
to your to your ~/.bash_profile.

thanks for the info but I have found out the problems a few weeks ago and have forgotten to post it here....
It is just that for Mac installation, it is pretty tricky and hence while installing, instead of typing in: easy_install ipython, users have to specify the python version.
Thus, I will need to type in easy_install ipython2.7
After which all is fine and working great!

Related

Encountering type error handling when running allennlp test-install

I am using Windows 10 and pip installed the latest allennlp branch. When I successfully install the package, I encountered the following:
$ allennlp test-install
Traceback (most recent call last):
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\604194\AppData\Local\Continuum\anaconda3\envs\domains\Scripts\allennlp.exe\__main__.py", line 4, in <module>
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\site-packages\allennlp\run.py", line 15, in <module>
from allennlp.commands import main # pylint: disable=wrong-import-position
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\site-packages\allennlp\commands\__init__.py", line 8, in <module>
from allennlp.commands.configure import Configure
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\site-packages\allennlp\commands\configure.py", line 27, in <module>
from allennlp.service.config_explorer import make_app
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\site-packages\allennlp\service\config_explorer.py", line 24, in <module>
from allennlp.common.configuration import configure, choices
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\site-packages\allennlp\common\__init__.py", line 1, in <module>
from allennlp.common.from_params import FromParams
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\site-packages\allennlp\common\from_params.py", line 48, in <module>
from allennlp.common.params import Params
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\site-packages\allennlp\common\params.py", line 173, in <module>
class Params(MutableMapping):
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\site-packages\allennlp\common\params.py", line 236, in Params
def pop(self, key: str, default: Any = DEFAULT) -> Any:
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\site-packages\overrides\overrides.py", line 67, in overrides
return _overrides(method, check_signature, check_at_runtime)
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\site-packages\overrides\overrides.py", line 93, in _overrides
_validate_method(method, super_class, check_signature)
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\site-packages\overrides\overrides.py", line 114, in _validate_method
ensure_signature_is_compatible(super_method, method, is_static)
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\site-packages\overrides\signature.py", line 87, in ensure_signature_is_compatible
super_sig, sub_sig, super_type_hints, sub_type_hints, is_static, method_name
File "c:\users\604194\appdata\local\continuum\anaconda3\envs\domains\lib\site-packages\overrides\signature.py", line 213, in ensure_all_positional_args_defined_in_sub
f"`{method_name}: {sub_param.name} must be a supertype of `{super_param.annotation}` but is `{sub_param.annotation}`"
TypeError: `Params.pop: key must be a supertype of `<class 'inspect._empty'>` but is `<class 'str'>`
Any advice on how to resolve this issue? Thanks!
EDIT: Edited my question for more information if needed. Thanks!

while launching spyder , spyder kernel is showing this error. and anaconda is also not installing other environments

Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site‑packages\spyder\plugins\ipythonconsole\plugin.py", line 1223, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle)
File "C:\Users\Mahima Kaushik\AppData\Roaming\Python\Python38\site‑packages\jupyter_client\manager.py", line 309, in start_kernel
kernel_cmd, kw = self.pre_start_kernel(**kw)
File "C:\Users\Mahima Kaushik\AppData\Roaming\Python\Python38\site‑packages\jupyter_client\manager.py", line 256, in pre_start_kernel
self.write_connection_file()
File "C:\Users\Mahima Kaushik\AppData\Roaming\Python\Python38\site‑packages\jupyter_client\connect.py", line 468, in write_connection_file
self.connection_file, cfg = write_connection_file(self.connection_file,
File "C:\Users\Mahima Kaushik\AppData\Roaming\Python\Python38\site‑packages\jupyter_client\connect.py", line 138, in write_connection_file
with secure_write(fname) as f:
File "C:\ProgramData\Anaconda3\lib\contextlib.py", line 113, in enter
return next(self.gen)
File "C:\Users\Mahima Kaushik\AppData\Roaming\Python\Python38\site‑packages\jupyter_core\paths.py", line 435, in secure_write
win32_restrict_file_to_user(fname)
File "C:\Users\Mahima Kaushik\AppData\Roaming\Python\Python38\site‑packages\jupyter_core\paths.py", line 361, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed while importing win32api: %1 is not a valid Win32 application.
https://github.com/spyder-ide/spyder/issues/12040#issuecomment-705033049
https://github.com/spyder-ide/spyder/issues/12040#issuecomment-705057347
I removed the following directory to fix my problem:
C:\Users\Mahima Kaushik\AppData\Roaming\Python

Setting up Python Virtual Env Initiating Jupyter Notebook gaierror: [Errno -2] Name or service not known

When I try to Initiate Jupyter notebook in the virtual env, I get the following error - .gaierror: [Errno -2] Name or service not known
Virtual Env -wget https://pypi.python.org/packages/source/v/virtualenv/virtualenv-12.0.7.tar.gz
Traceback (most recent call last):
File "/home/vraja/pyspark/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/home/vraja/pyspark/lib/python2.7/site-
packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/vraja/pyspark/lib/python2.7/site-
packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/home/vraja/pyspark/lib/python2.7/site-
packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/home/vraja/pyspark/lib/python2.7/site-
packages/notebook/notebookapp.py", line 1629, in initialize
self.init_webapp()
File "/home/vraja/pyspark/lib/python2.7/site-
packages/notebook/notebookapp.py", line 1379, in init_webapp
self.jinja_environment_options,
File "/home/vraja/pyspark/lib/python2.7/site-
packages/notebook/notebookapp.py", line 158, in __init__
default_url, settings_overrides, jinja_env_options)
File "/home/vraja/pyspark/lib/python2.7/site-
packages/notebook/notebookapp.py", line 251, in init_settings
allow_remote_access=jupyter_app.allow_remote_access,
File "/home/vraja/pyspark/lib/python2.7/site-
packages/traitlets/traitlets.py", line 556, in __get__
return self.get(obj, cls)
File "/home/vraja/pyspark/lib/python2.7/site-
packages/traitlets/traitlets.py", line 535, in get
value = self._validate(obj, dynamic_default())
File "/home/vraja/pyspark/lib/python2.7/site-
packages/notebook/notebookapp.py", line 872, in _default_allow_remote
for info in socket.getaddrinfo(self.ip, self.port, 0,
socket.SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known
(pyspark)-sh-4.1$
did you set profile variable ?..
Please add below env variable in profile file.
export PYSPARK_DRIVER_PYTHON=jupyter
export PYSPARK_DRIVER_PYTHON_OPTS='notebook'
Changed NotebookApp.ip='*' to Changed NotebookApp.ip='0.0.0.0' according to https://github.com/jupyterlab/jupyterlab/issues/5410 (Pazitos10 comment)

Celery not starting in OS X - dbm.error: db type is dbm.gnu, but the module is not available

I'm trying to run celery worker in OS X (Mavericks). I activated virtual environment (python 3.4) and tried to start Celery with this argument:
celery worker --app=scheduling -linfo
Where scheduling is my celery app.
But I ended up with this error: dbm.error: db type is dbm.gnu, but the module is not available
Complete stacktrace:
Traceback (most recent call last):
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/kombu/utils/__init__.py", line 320, in __get__
return obj.__dict__[self.__name__]
KeyError: 'db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/other/PhoenixEnv/bin/celery", line 9, in <module>
load_entry_point('celery==3.1.9', 'console_scripts', 'celery')()
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/__main__.py", line 30, in main
main()
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/bin/celery.py", line 80, in main
cmd.execute_from_commandline(argv)
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/bin/celery.py", line 768, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/bin/base.py", line 308, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/bin/celery.py", line 760, in handle_argv
return self.execute(command, argv)
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/bin/celery.py", line 692, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0])
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/bin/worker.py", line 175, in run_from_argv
return self(*args, **options)
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/bin/base.py", line 271, in __call__
ret = self.run(*args, **kwargs)
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/bin/worker.py", line 209, in run
).start()
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/worker/__init__.py", line 100, in __init__
self.setup_instance(**self.prepare_args(**kwargs))
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/worker/__init__.py", line 141, in setup_instance
self.blueprint.apply(self, **kwargs)
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/bootsteps.py", line 221, in apply
step.include(parent)
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/bootsteps.py", line 347, in include
return self._should_include(parent)[0]
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/bootsteps.py", line 343, in _should_include
return True, self.create(parent)
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/worker/components.py", line 220, in create
w._persistence = w.state.Persistent(w.state, w.state_db, w.app.clock)
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/worker/state.py", line 161, in __init__
self.merge()
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/worker/state.py", line 169, in merge
self._merge_with(self.db)
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/kombu/utils/__init__.py", line 322, in __get__
value = obj.__dict__[self.__name__] = self.__get(obj)
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/worker/state.py", line 238, in db
return self.open()
File "/Users/other/PhoenixEnv/lib/python3.4/site-packages/celery/worker/state.py", line 165, in open
self.filename, protocol=self.protocol, writeback=True,
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/shelve.py", line 239, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/shelve.py", line 223, in __init__
Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/dbm/__init__.py", line 91, in open
"available".format(result))
dbm.error: db type is dbm.gnu, but the module is not available
Please help.
I switched to python3.5 and got the same error. On Ubuntu I could fix it with
aptitude install python3.5-gdbm
I got the same error. On Macbook I could fix it with
brew install gdb

vim ConqueTerm running bpython LookupError

I am trying to run bpython in my VIM ConqueTerm, but I got the following error:
Traceback (most recent call last):stebin <F9> Pager <F2> Show Source
File "/usr/local/bin/bpython", line 8, in <module>
load_entry_point('bpython==0.10.1', 'console_scripts', 'bpython')()
File "/Library/Python/2.7/site-packages/bpython/cli.py", line 1756, in main
banner=banner)
File "/Library/Python/2.7/site-packages/bpython/cli.py", line 1658, in curses_wrapper
return func(stdscr, *args, **kwargs)
File "/Library/Python/2.7/site-packages/bpython/cli.py", line 1708, in main_curses
clirepl = CLIRepl(main_win, interpreter, statusbar, config, idle)
File "/Library/Python/2.7/site-packages/bpython/cli.py", line 261, in __init__
repl.Repl.__init__(self, interp, config)
File "/Library/Python/2.7/site-packages/bpython/repl.py", line 355, in __init__
self.rl_history.load(pythonhist, getpreferredencoding())
File "/Library/Python/2.7/site-packages/bpython/repl.py", line 208, in load
with codecs.open(filename, 'r', encoding, 'ignore') as hfile:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.py", line 884, in open
info = lookup(encoding)
LookupError: unknown encoding:
I am using MacVim and Bash.

Resources