How to fix a broken pip in anaconda without removing dependent packages? - pip

When I try to install something with pip I get the message
You are using pip version 18.0, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Though, when I follow the advise here, I get:
Collecting pip Using cached
https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
Exception: Traceback (most recent call last): File
"/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/init.py",
line 2862, in _dep_map
return self.dep_map File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init.py",
line 2669, in getattr
raise AttributeError(attr) AttributeError: _DistInfoDistribution__dep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py",
line 93, in init
req = REQUIREMENT.parseString(requirement_string) File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pyparsing.py",
line 1632, in parseString
raise exc File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pyparsing.py",
line 1622, in parseString
loc, tokens = self._parse( instring, 0 ) File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pyparsing.py",
line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions ) File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pyparsing.py",
line 3395, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions ) File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pyparsing.py",
line 1383, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions ) File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pyparsing.py",
line 3183, in parseImpl
raise ParseException(instring, loc, self.errmsg, self) pip._vendor.pyparsing.ParseException: Expected stringEnd (at char 33),
(line:1, col:34)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/init.py",
line 2942, in init
super(Requirement, self).init(requirement_string) File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py",
line 97, in init
requirement_string[e.loc:e.loc + 8])) pip._vendor.packaging.requirements.InvalidRequirement: Invalid
requirement, parse error at "'; extra '"
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_internal/basecommand.py",
line 228, in main
status = self.run(options, args) File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_internal/commands/install.py",
line 318, in run
self._warn_about_conflicts(to_install) File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_internal/commands/install.py",
line 442, in _warn_about_conflicts
package_set, _dep_info = check_install_conflicts(to_install) File
"/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_internal/operations/check.py",
line 89, in check_install_conflicts
state = create_package_set_from_installed() File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_internal/operations/check.py",
line 39, in create_package_set_from_installed
retval[name] = PackageDetails(dist.version, dist.requires()) File
"/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/init.py",
line 2613, in requires
dm = self._dep_map File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/init.py",
line 2864, in _dep_map
self.dep_map = self._compute_dependencies() File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init.py",
line 2874, in _compute_dependencies
reqs.extend(parse_requirements(req)) File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/init.py",
line 2935, in parse_requirements
yield Requirement(line) File "/home/.../miniconda3/envs/py3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/init.py",
line 2944, in init
raise RequirementParseError(str(e)) pip._vendor.pkg_resources.RequirementParseError: Invalid requirement,
parse error at "'; extra '" You are using pip version 18.0, however
version 18.1 is available. You should consider upgrading via the 'pip
install --upgrade pip' command.
I tried conda install pip that did not help. when I try conda remove pip it wants to remove all the dependent packages, which is not what I really want to do. Any idea how to fix it without screwing up my environment?

This particular problem was caused by testpath. I removed that package with pip remove testpath and then I could update pip without errors. Unfortunately, the error message did not point me there. I found this solution at a GitHub issue page.
https://github.com/conda-forge/testpath-feedstock/issues/7

Related

ERROR: for mysql a bytes-like object is required, not 'str' using docker-compose and laravel sail

I’ve rebooted my system and then run all my containers using the vendor/bin/sail up command, the only one that failed to reload was MySQL. The error is the following :
ERROR: for mysql a bytes-like object is required, not 'str'
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/docker/api/client.py", line 261, in _raise_for_status
response.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http+docker://localhost/v1.25/containers/afdd1cbf7f45d9b20612bca
f73eef1b0bc1dd631bc6aa3dcfbf630c64e8a3662/start
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/compose/service.py", line 625, in start_container
container.start()
File "/usr/lib/python3/dist-packages/compose/container.py", line 241, in start
return self.client.start(self.id, **options)
File "/usr/lib/python3/dist-packages/docker/utils/decorators.py", line 19, in wrapped
return f(self, resource_id, *args, **kwargs)
File "/usr/lib/python3/dist-packages/docker/api/container.py", line 1095, in start
self._raise_for_status(res)
File "/usr/lib/python3/dist-packages/docker/api/client.py", line 263, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "/usr/lib/python3/dist-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 500 Server Error: Internal Server Error ("b'Ports are not available: listen tcp 0.0.0.0:3306: bind: An attempt was made
to access a socket in a way forbidden by its access permissions.'")
I’m running this container on ubuntu server 20.04.
It might fix the problem if you provide an absolute path to your nginx/mysql conf file. I haven't tried the solution yet.

VirtualBox anaconda installation failing

Having trouble installing anaconda on my Ubuntu VirtualBox. Have tried rebooting and have tried assigning a bigger chunk of base memory but still failing at the final few hurdles.
Unpacking payload ...
concurrent.futures.process._RemoteTraceback:
'''
Traceback (most recent call last):
File "concurrent/futures/process.py", line 368, in _queue_management_worker
File "multiprocessing/connection.py", line 251, in recv
TypeError: __init__() missing 1 required positional argument: 'msg'
'''
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "entry_point.py", line 69, in <module>
File "concurrent/futures/process.py", line 484, in _chain_from_iterable_of_lists
File "concurrent/futures/_base.py", line 611, in result_iterator
File "concurrent/futures/_base.py", line 439, in result
File "concurrent/futures/_base.py", line 388, in __get_result
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or
pending.
[1981] Failed to execute script entry_point

Using command/shell modules causes: ValueError: Key name may not begin with an underscore on multiple runs

Ansible throws an error on every task which uses the shell or command modules, but not when running for the first time on a new machine.
The process I use is to image a new raspberry pi, and then use ansible to set up the services that I need. Running ansible for the first time works fine, but if I run it again (without changing anything) it fails, saying ValueError: Key name may not begin with an underscore
Here is an example of a task that throws an error. Running /usr/local/bin/pigpiod -v on the remote machine works as expected/
- name: see if pigpiod is the correct version
command: "/usr/local/bin/pigpiod -v"
register: pigpiod_version
Here is the error:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: Key name may not begin with an underscore
fatal: [issacs_box]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 113, in <module>\n File \"<stdin>\", line 105, in _ansiballz_main\n File \"<stdin>\", line 48, in invoke_module\n File \"/usr/lib/python3.5/imp.py\", line 234, in load_module\n return load_source(name, filename, file)\n File \"/usr/lib/python3.5/imp.py\", line 170, in load_source\n module = _exec(spec, sys.modules[name])\n File \"<frozen importlib._bootstrap>\", line 626, in _exec\n File \"<frozen importlib._bootstrap_external>\", line 673, in exec_module\n File \"<frozen importlib._bootstrap>\", line 222, in _call_with_frames_removed\n File \"/tmp/ansible_command_payload_hc3z4iej/__main__.py\", line 292, in <module>\n File \"/tmp/ansible_command_payload_hc3z4iej/__main__.py\", line 199, in main\n File \"/tmp/ansible_command_payload_hc3z4iej/ansible_command_payload.zip/ansible/module_utils/basic.py\", line 901, in __init__\n File \"/tmp/ansible_command_payload_hc3z4iej/ansible_command_payload.zip/ansible/module_utils/basic.py\", line 2243, in _log_invocation\n File \"/tmp/ansible_command_payload_hc3z4iej/ansible_command_payload.zip/ansible/module_utils/basic.py\", line 2201, in log\n File \"systemd/_journal.pyx\", line 68, in systemd._journal.send\n File \"systemd/_journal.pyx\", line 32, in systemd._journal._send\nValueError: Key name may not begin with an underscore\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
I had the wrong PYPI package installed. Coincidentally, there is a package called systemd (version 0.16.1) which is different from the official systemd-python (version 234) package. Running pip3 uninstall systemd and then pip3 install systemd-python --user solved the problem.
Seems like a weird Ansible bug. What version are you using? Can you try to downgrade and/or upgrade a version. If that would fix this error, please notify the Ansible developers and create an issue at their repo.
Else, try to update and/or downgrade your Python version. It could be that something is wrong with this file /usr/lib/python3.5/imp.py

Deploy Laravel on Cloud Foundry

I`m trying to deploy Laravel on Cloud Foundry, but at the end, it failed.
I followed this tutorial step by step. Also, I tried to solve my problem by this question but it doesn't work for me. And the overall view of my app is looks like this
However this is the errors, when I push the app to cf:
WARNING: A version of PHP has been specified in both `composer.json` and `./bp-config/options.json`.
WARNING: The version defined in `composer.json` will be used.
The extension 'fpm' is not provided by this buildpack.
The extension 'tokenizer' is not provided by this buildpack.
[ErrorException]
file_put_contents(/tmp/app/htdocs/bootstrap/cache/services.json): failed to open stream: No such file or directory
-----> Composer command failed
Traceback (most recent call last):
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/scripts/compile.py", line 50, in <module>
.from_build_pack('lib/additional_commands')
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/lib/build_pack_utils/builder.py", line 208, in extensions
process_extension(path, ctx, 'compile', process, args=[self])
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/lib/build_pack_utils/utils.py", line 69, in process_extension
success(getattr(extn, to_call)(*args))
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/extensions/composer/extension.py", line 414, in compile
return composer.compile(install)
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/lib/extension_helpers.py", line 154, in compile
self._compile(install)
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/extensions/composer/extension.py", line 181, in _compile
self.run()
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/extensions/composer/extension.py", line 316, in run
*self._ctx['COMPOSER_INSTALL_OPTIONS'])
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/extensions/composer/extension.py", line 360, in run
shell=True)
File "/tmp/buildpacks/ca44b1cd9a98d10d3246e577384a9145/lib/build_pack_utils/runner.py", line 109, in stream_output
raise CalledProcessError(retcode, cmd)
build_pack_utils.runner.CalledProcessError: Command '<open file '<fdopen>', mode 'w' at 0x7fa7340816f0>' returned non-zero exit status 1
Failed to compile droplet
Exit status 223
Staging failed: Exited with status 223
I need your help to solve this issue!

Ubuntu 10.04 - Python multiprocessing - 'module' object has no attribute 'local' error

The following code is from the python 2.6 manual.
from multiprocessing import Process
import os
def info(title):
print(title)
print('module name:', 'me')
print('parent process:', os.getppid())
print('process id:', os.getpid())
def f(name):
info('function f')
print('hello', name)
if __name__ == '__main__':
info('main line')
p = Process(target=f, args=('bob',))
p.start()
p.join()
This creates the following stack traces:
Traceback (most recent call last):
File "threading.py", line 1, in <module>
from multiprocessing import Process
File "/usr/lib/python2.6/multiprocessing/__init__.py", line 64, in <module>
from multiprocessing.util import SUBDEBUG, SUBWARNING
File "/usr/lib/python2.6/multiprocessing/util.py", line 287, in <module>
class ForkAwareLocal(threading.local):
AttributeError: 'module' object has no attribute 'local'
Exception AttributeError: '_shutdown' in <module 'threading' from '/home/v0idnull/tmp/pythreads/threading.pyc'> ignored
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.6/multiprocessing/util.py", line 258, in _exit_function
info('process shutting down')
TypeError: 'NoneType' object is not callable
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.6/multiprocessing/util.py", line 258, in _exit_function
info('process shutting down')
TypeError: 'NoneType' object is not callable
I'm completely clueless as to WHY this is happening, and google has given me very little to work with.
that code runs fine on my machine:
Ubuntu 10.10, Python 2.6.6 64-bit.
but your error is actually because you have a file named 'threading.py' that you are running this code from (see the stack-trace details). this is causing a namespace mismatch, since the multiprocessing module needs the 'real' threading module. try renaming your file to something other than 'threading.py' and running it again.
also... the example you posted is not from the Python 2.6 docs... it is from the Python 3.x docs. make sure you are reading the docs for the version that matches what you are running.

Resources