IronPython: impossible to use pip - python-2.7

In the last two weeks I noticed that my ironpython installation is not able to use pip anymore, e.g.:
ipy.exe -m pip install <package>
the stacktrace is similar to the following:
File "<path_to_bin>\bin\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "<path_to_bin>\bin\lib\site-packages\pip\commands\install.py", line 324, in run
requirement_set.prepare_files(finder)
File "<path_to_bin>\bin\lib\site-packages\pip\req\req_set.py", line 376, in prepare_files
discovered_reqs.extend(self._prepare_file(
File "<path_to_bin>\bin\lib\site-packages\pip\req\req_set.py", line 551, in _prepare_file
req_to_install.populate_link(
File "<path_to_bin>\bin\lib\site-packages\pip\req\req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "<path_to_bin>\bin\lib\site-packages\pip\index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "<path_to_bin>\bin\lib\site-packages\pip\index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "<path_to_bin>\bin\lib\site-packages\pip\index.py", line 568, in _get_pages
page = self._get_page(location)
File "<path_to_bin>\bin\lib\site-packages\pip\index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "<path_to_bin>\bin\lib\site-packages\pip\index.py", line 811, in get_page
inst = cls(resp.content, resp.url, resp.headers)
File "<path_to_bin>\bin\lib\site-packages\pip\index.py", line 728, in __init__
self.parsed = html5lib.parse(
File "<path_to_bin>\bin\lib\site-packages\pip\_vendor\html5lib\html5parser.py", line 35, in parse
if self.data.matchBytes(key):
File "<path_to_bin>\bin\lib\site-packages\pip\_vendor\html5lib\_inputstream.py", line 668, in matchBytes
data = self[p:p + len(bytes)]
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
for any package, even trying to update pip itself.
I currently use ironpython 2.7.12, but it seems to fail the same way with the beta 3.4. I install pip with the ensurepip module, which corresponds to pip-19.2.3 setuptools-41.2.0

Related

Uninstall and re-install of Anaconda 2.7 won't fix kernel problem in Jupyter

I am in a VM environment (Win 7 VirtualBox) and had gotten the Anaconda 2.7 suite to work.
Being new to Python, I was working on some code that instructed me to install PythonWin to do some connection with Crystal Reports. Seemed to install OK but then started getting some errors about the kernel in Jupyter not starting.
Uninstalled everything and I think got rid of any bad links and such from the previous installs.
Did the fresh install of Anaconda 2.7 and did NOT install PythonWin. Now stuck with a broken/unable to load kernel in Jupyter. Here's the error below. All help much appreciated from this newbie. Thanks!
Traceback (most recent call last):
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\web.py", line 1592, in _execute
result = yield result
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1133, in run
value = future.result()
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\concurrent.py", line 261, in result
raise_exc_info(self._exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1141, in run
yielded = self.gen.throw(*exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\notebook\services\sessions\handlers.py", line 73, in post
type=mtype))
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1133, in run
value = future.result()
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\concurrent.py", line 261, in result
raise_exc_info(self._exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1141, in run
yielded = self.gen.throw(*exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 79, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1133, in run
value = future.result()
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\concurrent.py", line 261, in result
raise_exc_info(self._exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1141, in run
yielded = self.gen.throw(*exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 92, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1133, in run
value = future.result()
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\concurrent.py", line 261, in result
raise_exc_info(self._exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 326, in wrapper
yielded = next(result)
File "C:\Users\Victor\Anaconda2\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 160, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\Users\Victor\Anaconda2\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\Victor\Anaconda2\lib\site-packages\jupyter_client\manager.py", line 259, in start_kernel
**kw)
File "C:\Users\Victor\Anaconda2\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File "C:\Users\Victor\Anaconda2\lib\site-packages\jupyter_client\launcher.py", line 138, in launch_kernel
proc = Popen(cmd, **kwargs)
File "C:\Users\Victor\Anaconda2\lib\subprocess.py", line 394, in __init__
errread, errwrite)
File "C:\Users\Victor\Anaconda2\lib\subprocess.py", line 644, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Figure I'll close the loop since I've found a solution - after uninstalling everything related to Anaconda and going through the file system and deleting all Anaconda related folders I re-installed Anaconda 2.7 as admin. Also during the setup I selected the choice to make the program available to all users.
Install finished and Anaconda 2.7 and all the modules worked as expected.

cannot install packages through pip

Python: 2.7.12
Pip: 8.1.1
When I sudo pip install pandas, it shows as follows:
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 317, in run
requirement_set.prepare_files(finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 512, in _prepare_file
finder, self.upgrade, require_hashes)
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 273, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 442, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 400, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 545, in _get_pages
page = self._get_page(location)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 648, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 757, in get_page
"Cache-Control": "max-age=600",
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 378, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 46, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 376, in send
timeout=timeout
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 610, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 228, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
download .whl file for pandas
try
pip install pandas.whl
or upgrade or pip and repeat the command
pip install pandas
I think there is some problem with pip command. So you can install Anaconda for python 2.7 (Download). It comes with pip by default.
Once download will be completed (it is script file).
Give the permission to the script file.
sudo chmod 777 Anaconda2-5.1.0-Linux-x86_64.sh
Run the script file on terminal../Anaconda2-5.1.0-Linux-x86_64.sh or bash Anaconda2-5.1.0-Linux-x86_64.sh
Follow the instruction from point 4th to this document here

Hive installation fails on Hadoop 2.7.3 through amabari

I am trying to install hive on hadoop 2.7.2 with hdp 2.5. My ambari version is 2.4. Every other component is working fine (HDFS,YARN, MR2, ZOOKEEPER etc.).
When i am trying to install hive with new MySql database through ambari UI it give me following error for HCat client installation:
Traceback (most recent call last): File "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py", line 85, in <module>
HCatClient().execute() File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 280, in execute
method(env) File "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py", line 35, in install
self.install_packages(env) File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 567, in install_packages
retry_count=agent_stack_retry_count) File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 155, in __init__
self.env.run() File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 160, in run
self.run_action(resource, action) File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 124, in run_action
provider_action() File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/__init__.py", line 54, in action_install
self.install_package(package_name, self.resource.use_repos, self.resource.skip_repos) File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/yumrpm.py", line 49, in install_package
self.checked_call_with_retries(cmd, sudo=True, logoutput=self.get_logoutput()) File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/__init__.py", line 83, in checked_call_with_retries
return self._call_with_retries(cmd, is_checked=True, **kwargs) File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/__init__.py", line 91, in _call_with_retries
code, out = func(cmd, **kwargs) File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 71, in inner
result = function(command, **kwargs) File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 93, in checked_call
tries=tries, try_sleep=try_sleep) File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 141, in _call_wrapper
result = _call(command, **kwargs_copy) File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 294, in _call
raise Fail(err_msg) resource_management.core.exceptions.Fail: Execution of '/usr/bin/yum -d 0 -e 0 -y install hive_2_5_0_0_1245' returned 1. Error unpacking rpm package hive_2_5_0_0_1245-1.2.1000.2.5.0.0-1245.el6.noarch error: unpacking of archive failed on file /usr/hdp/2.5.0.0-1245/hive/conf: cpio: rename failed - Is a directory

Can't use pytest-bdd after installation

I installed pytest-bdd at /home/marlu/.local using python setup.py install --user, since I don't have admin privileges. Both python2.7 and pytest are located at /usr/bin/. When I check if pytest-bdd is working correctly by running py.test --version I get an error, could anyone tell me why? Thanks!
Error output:
Traceback (most recent call last):
File "/usr/bin/py.test", line 9, in <module>
load_entry_point('pytest==2.7.0', 'console_scripts', 'py.test-2.7')()
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 32, in main
config = _prepareconfig(args, plugins)
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 85, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 521, in __call__
return self._docall(self.methods, kwargs)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 528, in _docall
firstresult=self.firstresult).execute()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 393, in execute
return wrapped_call(method(*args), self.execute)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 109, in wrapped_call
wrap_controller.send(call_outcome)
File "/usr/lib/python2.7/site-packages/_pytest/helpconfig.py", line 28, in pytest_cmdline_parse
config = outcome.get_result()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 138, in get_result
py.builtin._reraise(*ex)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 123, in __init__
self.result = func()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
res = method(*args)
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 636, in pytest_cmdline_parse
self.parse(args)
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 746, in parse
self._preparse(args)
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 713, in _preparse
self.pluginmanager.consider_setuptools_entrypoints()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 282, in consider_setuptools_entrypoints
self.register(plugin, name=name)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 189, in register
reg(plugin, name) # may call addhooks
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 604, in _register_plugin
{'pluginmanager': self.pluginmanager})
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 360, in call_plugin
kwargs=kwargs, firstresult=True).execute()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
res = method(*args)
File "/home/marlu/.local/lib/python2.7/site-packages/pytest_bdd-2.17.0-py2.7.egg/pytest_bdd/plugin.py", line 15, in pytest_addhooks
from pytest_bdd import hooks
File "/home/marlu/.local/lib/python2.7/site-packages/pytest_bdd-2.17.0-py2.7.egg/pytest_bdd/hooks.py", line 38, in <module>
#pytest.hookspec(firstresult=True)
AttributeError: 'module' object has no attribute 'hookspec'
#pytest.hookspec was introduced in pytest 2.8, so you'd need to upgrade pytest, or downgrade pytest-bdd to 2.16.1. (Whoops, I was the one who broke 2.7 compatibility)

running pip gives UnicodeEncodeError

I just reinstalled python and pip, but when i run the command pip i should expect to see the help info for pip commands. instead i get this:
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pip.exe\__main__.py", line 9, in <module>
File "C:\Python27\lib\site-packages\pip\__init__.py", line 210, in main
cmd_name, cmd_args = parseopts(args)
File "C:\Python27\lib\site-packages\pip\__init__.py", line 165, in parseopts
parser.print_help()
File "C:\Python27\lib\optparse.py", line 1670, in print_help
file.write(self.format_help().encode(encoding, "replace"))
File "C:\Python27\lib\optparse.py", line 1650, in format_help
result.append(self.format_option_help(formatter))
File "C:\Python27\lib\optparse.py", line 1633, in format_option_help
result.append(group.format_help(formatter))
File "C:\Python27\lib\optparse.py", line 1114, in format_help
result += OptionContainer.format_help(self, formatter)
File "C:\Python27\lib\optparse.py", line 1085, in format_help
result.append(self.format_option_help(formatter))
File "C:\Python27\lib\optparse.py", line 1074, in format_option_help
result.append(formatter.format_option(option))
File "C:\Python27\lib\optparse.py", line 316, in format_option
help_text = self.expand_default(option)
File "C:\Python27\lib\site-packages\pip\baseparser.py", line 110, in expand_de
fault
return optparse.IndentedHelpFormatter.expand_default(self, option)
File "C:\Python27\lib\optparse.py", line 288, in expand_default
return option.help.replace(self.default_tag, str(default_value))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf8' in position 11:
ordinal not in range(128)
i have had python 3.4 installed before this but wanted to change to 2.7. on 3.4 pip were running fine, but there were some issues with django on python3.4
edit: user folder contains non-ascii character. This worked with python 3.4 but not with 2.7
Created a new user with ascii compliant characters. Pip now works fine with no errors.