Python PIP on Ubuntu - python

When I run python pip on a new brand Ubuntu 15.04 system with all updates installed, I get the following assertion error. This is with Python 2.7.x. I get a very similar result with Python 3.4.x:
➜ pip list
adium-theme-ubuntu (0.3.4)
<...snip...>
pyOpenSSL (0.13.1)
pyserial (2.6)
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/list.py", line 80, in run
self.run_listing(options)
File "/usr/lib/python2.7/dist-packages/pip/commands/list.py", line 142, in run_listing
self.output_package_listing(installed_packages)
File "/usr/lib/python2.7/dist-packages/pip/commands/list.py", line 151, in output_package_listing
if dist_is_editable(dist):
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 367, in dist_is_editable
req = FrozenRequirement.from_dist(dist, [])
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 299, in from_dist
assert len(specs) == 1 and specs[0][0] == '=='
AssertionError

I think you should report this as a bug here. I can reproduce it in my Ubuntu 15.04 (64bit). The man page clearly states the pip list and pip3 list commands should simply list the packages, but in both cases they crash with AssertionError before completing.

Related

AttributeError: module 'html5lib.treebuilders.etree' has no attribute 'getETreeModule'

Suggestions please, thanks :)
pip list --outdated --format=freeze
Gives the following error:
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 223, in _main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/_internal/commands/list.py", line 175, in run
packages = self.get_outdated(packages, options)
File "/usr/lib/python3/dist-packages/pip/_internal/commands/list.py", line 184, in get_outdated
return [
File "/usr/lib/python3/dist-packages/pip/_internal/commands/list.py", line 184, in <listcomp>
return [
File "/usr/lib/python3/dist-packages/pip/_internal/commands/list.py", line 237, in iter_packages_latest_infos
for dist in map_multithread(latest_info, packages):
File "/usr/lib/python3.9/multiprocessing/pool.py", line 870, in next
raise value
File "/usr/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/usr/lib/python3/dist-packages/pip/_internal/commands/list.py", line 214, in latest_info
all_candidates = finder.find_all_candidates(dist.key)
File "/usr/lib/python3/dist-packages/pip/_internal/index/package_finder.py", line 825, in find_all_candidates
package_links = self.process_project_url(
File "/usr/lib/python3/dist-packages/pip/_internal/index/package_finder.py", line 793, in process_project_url
page_links = list(parse_links(html_page))
File "/usr/lib/python3/dist-packages/pip/_internal/index/collector.py", line 324, in wrapper_wrapper
return list(fn(page))
File "/usr/lib/python3/dist-packages/pip/_internal/index/collector.py", line 335, in parse_links
document = html5lib.parse(
File "/usr/share/python-wheels/html5lib-1.1-py2.py3-none-any.whl/html5lib/html5parser.py", line 44, in parse
tb = treebuilders.getTreeBuilder(treebuilder)
File "/usr/share/python-wheels/html5lib-1.1-py2.py3-none-any.whl/html5lib/treebuilders/__init__.py", line 85, in getTreeBuilder
return etree.getETreeModule(implementation, **kwargs).TreeBuilder
AttributeError: module 'html5lib.treebuilders.etree' has no attribute 'getETreeModule'
I solved this problem updating pip, i updated from pip 20.3.4 to 21.3
so just type:
pip install pip -U
Seems like there is some bug in pip itself.
I've done some analysis of this bug in in the Debian bugtracker.
It appears to be a race-condition triggered by the way Debian was packaging pip until recently. Dependencies were zipimported from wheels instead of vendored in the source tree, as upstream does.
This should already be resolved in Debian >= 12 (bookworm) and Ubuntu >= 22.04 (jammy).
An updated for pip in Debian 11 (bullseye) is in progress.
Not a fix, but a solution of sorts:
I 'fixed' this by updating every package.
for f in `pip list | tail -n +3 | cut -d' ' -f1`; do
pip install --update "$f";
done
I found OP's problem while logged-in as root and immediately after upgrading to Debian 11; dunno if that's significant.

How do I install opencv-python on pypy3 windows?

I'm kind of new in the programming world, and I've heard that pypy3 is 7x faster than python while running code, so I decided to give it a try. I created a bot to farm EXP on the game Yu-Gi-OH! duel links and wanted to run it with pypy3, however I need to install opencv and every time I try to do so I get this error .
commands I ran:
git clone https://github.com/skvark/opencv-python
cd opencv-python
pypy3 setup.py install
Error I got:
Traceback (most recent call last):
File "setup.py", line 457, in <module>
main()
File "setup.py", line 257, in main
cmake_source_dir=cmake_source_dir,
File "C:\Users\Jorge\AppData\Local\pypy3.6-v7.3.3-win32\site packages\skbuild\setuptools_wrap.py", line 625, in setup
cmake_source_dir, skbuild_kw['cmake_install_dir'])
File "setup.py", line 370, in _classify_installed_files_override
raise Exception("Not found: '%s'" % relpath_re)
Exception: Not found: 'python/cv2[^/]*\.pyd'
obs: I'm using windows
Can anyone help me?

How to build dev version of python datatable on macos (getting pip._vendor.pep517.wrappers.BackendUnavailable)

Following the directions on the datatable page https://datatable.readthedocs.io/en/latest/install.html
So I ran this:
$pip3 install git+https://github.com/h2oai/datatable
The result is :
Collecting git+https://github.com/h2oai/datatable
Cloning https://github.com/h2oai/datatable to /private/var/folders/d6/m67jyndd7h754m3810cl3bpm0000gp/T/pip-req-build-hv991zd2
Running command git clone -q https://github.com/h2oai/datatable /private/var/folders/d6/m67jyndd7h754m3810cl3bpm0000gp/T/pip-req-build-hv991zd2
Getting requirements to build wheel ... done
ERROR: Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 178, in main
status = self.run(options, args)
File "/usr/local/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 352, in run
resolver.resolve(requirement_set)
File "/usr/local/lib/python3.7/site-packages/pip/_internal/resolve.py", line 131, in resolve
self._resolve_one(requirement_set, req)
File "/usr/local/lib/python3.7/site-packages/pip/_internal/resolve.py", line 294, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/usr/local/lib/python3.7/site-packages/pip/_internal/resolve.py", line 242, in _get_abstract_dist_for
self.require_hashes
File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 362, in prepare_linked_requirement
abstract_dist.prep_for_dist(finder, self.build_isolation)
File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 169, in prep_for_dist
self.install_backend_dependencies(finder=finder)
File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 123, in install_backend_dependencies
reqs = req.pep517_backend.get_requires_for_build_wheel()
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/wrappers.py", line 71, in get_requires_for_build_wheel
'config_settings': config_settings
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/wrappers.py", line 162, in _call_hook
raise BackendUnavailable
pip._vendor.pep517.wrappers.BackendUnavailable
This is not actionable for me: I'm not certain what to fix/ how to proceed. Hints?
Note: in the meantime I have installed version 0.10.1 as follows:
sudo pip3 install 'datatable==0.10.1'
This has important by (expression based groupby) and sortvalues() that I need
Most likely this error occurs because you're trying to build datatable using an old version of pip. In order to build datatable from source, pip version 20.0 or higher is required.
Unfortunately, there is no way for a project to specify that it needs a specific minimum version of pip. And I presume if such setting would eventually be added, only the newest versions of pip would know about it anyways, defeating the purpose.

Python pip install error

I have just installed Python 3.4.3 on my MAC (Yosemite). I need to install a couple of lxml, however everytime I type in: pip install /""/, I get error messages.
I have followed multiple tutorials and pip is installed.
MAC already had Python 2.7., but I installed the 3.4.3. version, not sure if that is the issue.
The error message is:
Brunos-MacBook-Pro:~ BrunoPaesLeme$ pip install /Macintosh HD/Users//Downloads/pycairo-1.10.0-cp27-none-win_amd64.whl
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/commands/install.py", line 268, in run
wheel_cache
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/basecommand.py", line 268, in populate_requirement_set
wheel_cache=wheel_cache
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/req/req_install.py", line 207, in from_line
wheel_cache=wheel_cache)
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/req/req_install.py", line 66, in init
req = pkg_resources.Requirement.parse(req)
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/_vendor/pkg_resources/init.py", line 2960, in parse
reqs = list(parse_requirements(s))
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/_vendor/pkg_resources/init.py", line 2891, in parse_requirements
raise ValueError("Missing distribution spec", line)
ValueError: ('Missing distribution spec', '/Macintosh')
Anybody knows what I could be doing wrong? Any help would be appreciated.
try:
easy_install pip
pip install /"filepath"/
I have similar issue with pip install. However, if I do "sudo su -" then do my pip install 'fileName', that solve the problem for me.

libgfortran not found when installing scipy using enthought canopy

I am trying to install scipy using enpkg in Enthought Canopy but I am getting this error:
(canopy_env) server 17:10:33 ~ $ enpkg scipy
prefix: /home/user/apps/canopy_env
Traceback (most recent call last):
File "/home/user/apps/canopy_env/bin/enpkg", line 10, in <module>
sys.exit(main())
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/main.py", line 746, in main
install_req(enpkg, req, args) # install (default)
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/main.py", line 395, in install_req
_perform_install()
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/main.py", line 311, in _perform_install
enpkg.execute(actions)
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/enpkg.py", line 279, in execute
self.fetch(egg, force=int(opcode[-1]))
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/enpkg.py", line 455, in fetch
f.fetch_egg(egg, force, self._execution_aborted)
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/fetch.py", line 147, in fetch_egg
self.fetch(egg, execution_aborted)
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/fetch.py", line 30, in fetch
fi, info = self.remote.get(key)
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/store/indexed.py", line 47, in get
return self.get_data(key), self.get_metadata(key)
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/store/indexed.py", line 136, in get_data
raise KeyError("%s: %s" % (e, url))
KeyError: u'HTTP Error 404: NOT FOUND: https://api.enthought.com/eggs/rh5-64/libgfortran-3.0.0-1.egg'
I am using Canopy Express and this package is provided (see this)..
I have tried to install it from pip but, since I have not administration permissions, I am unable to install it..
Edit: the same happens with Pygments package when installing ipython:
appinst-2.1.2-1.egg [fetching]
55 KB [.................................................................]
MarkupSafe-0.18-2.egg [fetching]
26 KB [.................................................................]
...
KeyError: u'HTTP Error 404: NOT FOUND: https://api.enthought.com/eggs/rh5-64/Pygments-1.6.0-1.egg'
Thanks
a few of our free packages had been flagged as "commercial" by mistake. We fixed the problem and you should be able to install them now.
Sorry about the trouble!

Categories

Resources