easy_install can't install package - python

I'm trying to write a setup.py file for my python project:
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
requires = [
'requests',
'simplejson',
'logging',
'rfc3987',
]
setup(name='xxxxxxx',
version='0.1',
description='xxxxxxx API',
url='https://github.com/xxxxxxxx',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=requires,
)
When I execute it I'm getting this error:
Searching for rfc3987
Reading http://pypi.python.org/simple/rfc3987/
Best match: rfc3987 1.3.1
Downloading https://pypi.python.org/packages/source/r/rfc3987/rfc3987-1.3.1.tar.gz#md5=397b1c1cd8b934269e53a621d56d9ed2
Processing rfc3987-1.3.1.tar.gz
Running rfc3987-1.3.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-AYV_bv/rfc3987-1.3.1/egg-dist-tmp-G8Kbay
Traceback (most recent call last):
File "/usr/bin/easy_install", line 9, in <module>
load_entry_point('distribute==0.6.10', 'console_scripts', 'easy_install')()
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 1715, in main
with_ei_usage(lambda:
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 1696, in with_ei_usage
return f()
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 1719, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 236, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 472, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 502, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 681, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 958, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 947, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 29, in run_setup
lambda: execfile(
File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 70, in run
return func()
File "/usr/lib/python2.6/site-packages/setuptools/sandbox.py", line 31, in <lambda>
{'__file__':setup_script, '__name__':'__main__'}
File "setup.py", line 4, in <module>
File "/tmp/easy_install-AYV_bv/rfc3987-1.3.1/rfc3987.py", line 324, in <module>
File "/tmp/easy_install-AYV_bv/rfc3987-1.3.1/rfc3987.py", line 323, in <genexpr>
File "/tmp/easy_install-AYV_bv/rfc3987-1.3.1/rfc3987.py", line 319, in _interpret_unicode_escapes
ValueError: zero length field name in format
If I try just easy_install rfc3987 I'm getting the same error.
Are there any ways to go around this?

rfc3987 claims that it works on Python 2.7 and 3.x. You're trying to install it on 2.6. So it fails.
The problem has nothing to do with your own package, or with easy_install. If you download the tarball manually and run python2.6 setup.py install, you get the same error. And in fact, at least in 1.3.1, there's code that clearly isn't legal under Python 2.6, like this function.
From the git history, it looks like there have been changes to make it Python 2.6 compatible, so the next release may work. Until then, you won't be able to use it from 2.6.

Related

Problems installing signal processing and machine learning toolbox Bob

I'm trying to install the package from: https://gitlab.idiap.ch/bob/bob.paper.ijcb2021_vision_transformer_pad.
I had to edit the spec-file.txt to update the missing links with the earliest version available from each package and also modified the buildout file to connect via http instead of ssh. I working with conda + mamba in Ubuntu 20.04 and bob.extension is installed, however I can't get past this point when running buildout. Any tips on how to fix this? Thank you.
Here is the prompt I get with buildout:
mr.developer: Queued 'bob.db.hqwmca' for checkout.
mr.developer: Queued 'bob.io.stream' for checkout.
mr.developer: Queued 'bob.ip.stereo' for checkout.
mr.developer: Skipped checkout of existing package 'bob.db.hqwmca'.
mr.developer: Skipped checkout of existing package 'bob.io.stream'.
mr.developer: Skipped checkout of existing package 'bob.ip.stereo'.
Develop: '/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/src/bob.io.stream'
bob.buildout.tools: taking requirement `setuptools' (45.2.0) from `/usr/lib/python3/dist-packages'
bob.buildout.tools: taking requirement `numpy' (1.22.1) from `/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/eggs/numpy-1.22.1-py3.8-linux-x86_64.egg'
bob.buildout.tools: taking requirement `scipy' (1.7.3) from `/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/eggs/scipy-1.7.3-py3.8-linux-x86_64.egg'
bob.buildout.tools: Installing `bob.io.base' for package `/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/src/bob.io.stream'...
Getting distribution for 'bob.io.base'.
WARNING: The easy_install command is deprecated and will be removed in a future version.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-taijyg5a/bob.io.base-4.0.0/setup.py", line 10, in <module>
ModuleNotFoundError: No module named 'bob.extension'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 2372, in main
setup(
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 450, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 693, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 738, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 923, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1191, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1177, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 253, in run_setup
raise
File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 166, in save_modules
saved_exc.resume()
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "/usr/lib/python3/dist-packages/setuptools/_vendor/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-taijyg5a/bob.io.base-4.0.0/setup.py", line 10, in <module>
ModuleNotFoundError: No module named 'bob.extension'
An error occurred when trying to install /tmp/tmpo3qzby_8get_dist/bob.io.base-4.0.0.zip. Look above this message for any errors that were output by easy_install.
While:
Installing.
Processing develop directory '/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/src/bob.io.stream'.
Getting distribution for 'bob.io.base'.
An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/zc/buildout/buildout.py", line 2174, in main
getattr(buildout, command)(args)
File "/usr/lib/python3/dist-packages/zc/buildout/buildout.py", line 679, in install
installed_develop_eggs = self._develop()
File "/usr/lib/python3/dist-packages/zc/buildout/buildout.py", line 922, in _develop
zc.buildout.easy_install.develop(setup, dest)
File "/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/eggs/bob.buildout-2.3.0-py3.8.egg/bob/buildout/extension.py", line 170, in develop
tools.satisfy_requirements(self.buildout, directory, working_set)
File "/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/eggs/bob.buildout-2.3.0-py3.8.egg/bob/buildout/tools.py", line 231, in satisfy_requirements
working_set = install_package(buildout, req, working_set)
File "/home/angela/Descargas/bob.paper.ijcb2021_vision_transformer_pad/eggs/bob.buildout-2.3.0-py3.8.egg/bob/buildout/tools.py", line 200, in install_package
new_ws = zc.buildout.easy_install.install(
File "/usr/lib/python3/dist-packages/zc/buildout/easy_install.py", line 957, in install
return installer.install(specs, working_set)
File "/usr/lib/python3/dist-packages/zc/buildout/easy_install.py", line 682, in install
for dist in self._get_dist(requirement, ws):
File "/usr/lib/python3/dist-packages/zc/buildout/easy_install.py", line 574, in _get_dist
dists = [_move_to_eggs_dir_and_compile(dist, self._dest)]
File "/usr/lib/python3/dist-packages/zc/buildout/easy_install.py", line 1745, in _move_to_eggs_dir_and_compile
[tmp_loc] = glob.glob(os.path.join(tmp_dest, '*'))
ValueError: not enough values to unpack (expected 1, got 0)
From your comment it seems you have a lot of different Python versions installed; 2.7, 3.6, 3.7 and 3.8.
Normally, having multiple versions of Python 3 installed is not a problem in and of itself. But it can lead to mistakes.
Especially since there usually is a python3 link that can only point to one version.
So what I suspect that happened is that you installed bob.extensions for a different Python version then the one you are using for bob.paper.
Or you installed it in a different virtual environment (if you are using those)!
My recommendation is to check if you really need all the different versions. If not, note down which packages you have installed for the different Python version and decide which ones you need.
Then delete all Python versions except 3.8, and make sure that there is a link python3 pointing to python3.8.
Then install all the prequisites and bob.extensions and bob.paper on that.
I've never used conda on a non-windows machine, and normally I would advise to stick with python from python.org, or whatever your distribution has packages for.

Error with pip after upgrading : 'module' object has no attribute 'SSL_ST_INIT'

After upgrading pip, I try to do a 'pip freeze', but i've this error :
# pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB)
100% |################################| 1.3MB 737kB/s
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Successfully installed pip-10.0.1
# pip freeze
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip._internal import main
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/__init__.py", line 42, in <module>
from pip._internal import cmdoptions
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cmdoptions.py", line 16, in <module>
from pip._internal.index import (
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 15, in <module>
from pip._vendor import html5lib, requests, six
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 86, in <module>
from pip._vendor.urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 105, in <module>
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
Reading some post here, I found various solutions, but it's not working.
So I try another things, like installing using easy_install :
# sudo python -m easy_install --upgrade pyOpenSSL
Searching for pyOpenSSL
Reading https://pypi.python.org/simple/pyOpenSSL/
Best match: pyOpenSSL 18.0.0
Downloading https://files.pythonhosted.org/packages/9b/7c/ee600b2a9304d260d96044ab5c5e57aa489755b92bbeb4c0803f9504f480/pyOpenSSL-18.0.0.tar.gz#sha256=6488f1423b00f73b7ad5167885312bb0ce410d3312eb212393795b53c8caa580
Processing pyOpenSSL-18.0.0.tar.gz
Writing /tmp/easy_install-_qJ8_t/pyOpenSSL-18.0.0/setup.cfg
Running pyOpenSSL-18.0.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-_qJ8_t/pyOpenSSL-18.0.0/egg-dist-tmp-KM4cDC
warning: no previously-included files found matching 'leakcheck'
warning: no previously-included files found matching 'codecov.yml'
warning: no previously-included files matching '*.py' found under directory 'leakcheck'
warning: no previously-included files matching '*.pem' found under directory 'leakcheck'
warning: no previously-included files matching '*.cert' found under directory 'examples/simple'
warning: no previously-included files matching '*.pkey' found under directory 'examples/simple'
no previously-included directories found matching 'doc/_build'
no previously-included directories found matching '.travis'
no previously-included directories found matching '.mention-bot'
zip_safe flag not set; analyzing archive contents...
Adding pyOpenSSL 18.0.0 to easy-install.pth file
Installed /usr/local/lib/python2.7/dist-packages/pyOpenSSL-18.0.0-py2.7.egg
Processing dependencies for pyOpenSSL
Searching for cryptography>=2.2.1
Reading https://pypi.python.org/simple/cryptography/
Best match: cryptography 2.2.2
Downloading https://files.pythonhosted.org/packages/ec/b2/faa78c1ab928d2b2c634c8b41ff1181f0abdd9adf9193211bd606ffa57e2/cryptography-2.2.2.tar.gz#sha256=9fc295bf69130a342e7a19a39d7bbeb15c0bcaabc7382ec33ef3b2b7d18d2f63
Processing cryptography-2.2.2.tar.gz
Writing /tmp/easy_install-rHRU6X/cryptography-2.2.2/setup.cfg
Running cryptography-2.2.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-rHRU6X/cryptography-2.2.2/egg-dist-tmp-eABQpn
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/dist-packages/easy_install.py", line 5, in <module>
main()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 2199, in main
lambda: setup(
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 2185, in with_ei_usage
return f()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 2202, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 393, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 636, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 668, in install_item
self.process_distribution(spec, dist, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 716, in process_distribution
[requirement], self.local_index, self.easy_install
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 631, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 874, in best_match
return self.obtain(req, installer)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 886, in obtain
return installer(requirement)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 636, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 666, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 856, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1078, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1063, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 68, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 114, in run
return func()
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 67, in runner
_execfile(setup_script, ns)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 43, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-rHRU6X/cryptography-2.2.2/setup.py", line 28, in <module>
RuntimeError: cryptography requires setuptools 18.5 or newer, please upgrade to a newer version of setuptools
and, so, upgrading 'setuptools' :
# sudo python -m easy_install --upgrade setuptools
Searching for setuptools
Reading https://pypi.python.org/simple/setuptools/
Best match: setuptools 39.2.0
Downloading https://files.pythonhosted.org/packages/1a/04/d6f1159feaccdfc508517dba1929eb93a2854de729fa68da9d5c6b48fa00/setuptools-39.2.0.zip#sha256=f7cddbb5f5c640311eb00eab6e849f7701fa70bf6a183fc8a2c33dd1d1672fb2
Processing setuptools-39.2.0.zip
Writing /tmp/easy_install-wH5_qA/setuptools-39.2.0/setup.cfg
Running setuptools-39.2.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-wH5_qA/setuptools-39.2.0/egg-dist-tmp-cpMLIT
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'
warnings.warn(msg)
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/dist-packages/easy_install.py", line 5, in <module>
main()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 2199, in main
lambda: setup(
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 2185, in with_ei_usage
return f()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 2202, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 393, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 636, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 666, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 856, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1078, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1063, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 68, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 114, in run
return func()
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 67, in runner
_execfile(setup_script, ns)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 43, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-wH5_qA/setuptools-39.2.0/setup.py", line 195, in <module>
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 266, in __init__
_Distribution.__init__(self,attrs)
File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 301, in finalize_options
ep.load()(self, ep.name, value)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2195, in load
raise ImportError("%r has no %r attribute" % (entry, attr))
ImportError: <module 'setuptools.dist' from '/usr/lib/python2.7/dist-packages/setuptools/dist.pyc'> has no 'check_specifier' attribute
And, the last try, using a specific version of pyOpenSSL :
# sudo pip install pyOpenSSL==16.2.0
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip._internal import main
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/__init__.py", line 42, in <module>
from pip._internal import cmdoptions
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cmdoptions.py", line 16, in <module>
from pip._internal.index import (
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 15, in <module>
from pip._vendor import html5lib, requests, six
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 86, in <module>
from pip._vendor.urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 105, in <module>
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
Another idea to resolve this please ? :)
Thanks a lot.
F.
The problem is coming from pyopenssl. The first thing you can do is trying to remove and re-install pyopenssl :
apt-get --auto-remove --yes remove python-openssl
pip install pyOpenSSL
But it also could be a path problem.
Upgrading the OS-provided pip is a well-known 'own goal' and should be avoided unless absolutely necessary.
First, you may need to re-install the OS package, to restore normal use of the 'pip' command.
If you must have a newer pip: try installing it from a self-contained installer, see here: https://pip.pypa.io/en/stable/installing/ and not with the existing pip. Unless you must have it available for all users, run the install with '--user' option - and use the same option when installing packages with pip - that way you leave the OS-provided Python and pip things alone and don't overwrite them and can always return to them by deleting everything Python-related from ~/.local/.
In all cases, after you recover from pip being stuck as you have it right now, try upgrading pyOpenSSL first (or pip install-ing it with --user).
Another helpful tip that I found somewhere on the Web: always use python -m pip instead of running pip directly, this avoids problems with pip picking up the wrong version or the pip module (or running the wrong python executable, if you've got more than one).

MemoryError When Installing tzwhere

On an AWS EC2, I cloned pytzwhere using:
sudo git clone --recursive https://github.com/pegler/pytzwhere.git
Then I tried to install it using Python 2.7 and:
sudo python setup.py install
Unfortunately it stops with the following error:
...
Extracting tzwhere-2.2-py2.7.egg to /usr/local/lib/python2.7/site-packages
Traceback (most recent call last):
File "setup.py", line 32, in <module>
'Topic :: Software Development :: Localization',
File "/usr/lib64/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 117, in do_egg_install
cmd.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 393, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 623, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 672, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 820, in install_eggs
return [self.install_egg(dist_filename, tmpdir)]
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 900, in install_egg
os.path.dirname(destination)))
File "/usr/lib64/python2.7/distutils/cmd.py", line 349, in execute
util.execute(func, args, msg, dry_run=self.dry_run)
File "/usr/lib64/python2.7/distutils/util.py", line 309, in execute
func(*args)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1177, in unpack_and_compile
unpack_archive(egg_path, destination, pf)
File "/usr/lib/python2.7/dist-packages/setuptools/archive_util.py", line 50, in unpack_archive
driver(filename, extract_dir, progress_filter)
File "/usr/lib/python2.7/dist-packages/setuptools/archive_util.py", line 117, in unpack_zipfile
data = z.read(info.filename)
File "/usr/lib64/python2.7/zipfile.py", line 935, in read
return self.open(name, "r", pwd).read()
File "/usr/lib64/python2.7/zipfile.py", line 630, in read
data = self.read1(n)
File "/usr/lib64/python2.7/zipfile.py", line 684, in read1
max(n - len_readbuffer, self.MIN_READ_SIZE)
MemoryError
I'll appreciate it if you guide me how to solve this problem.

ZipImportError while installing setuptools windows 7

I want to install django framework, but I need setuptools for it. I found the same question here on stackoverflow, but it doesn't seem to provide a solution.
I use official installing instructions for setuptools on win7
but it doesn't finish, it says it has been installed, but it isn't completely (I can't import it in django\setup.py). Since it's a module helping to setup other modules it's kind of fail it cannot install itself. I get this error:
Installed c:\python27\lib\site-packages\setuptools-3.4.4-py2.7.egg # installed? i don't think so
Processing dependencies for setuptools==3.4.4
Traceback (most recent call last):
File "setup.py", line 217, in <module>
dist = setuptools.setup(**setup_params)
File "C:\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\setuptools\c
ommand\install.py", line 61, in run
self.do_egg_install()
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\setuptools\c
ommand\install.py", line 111, in do_egg_install
cmd.run()
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\setuptools\c
ommand\easy_install.py", line 358, in run
self.easy_install(spec, not self.no_deps)
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\setuptools\c
ommand\easy_install.py", line 574, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\setuptools\c
ommand\easy_install.py", line 625, in install_item
self.process_distribution(spec, dist, deps)
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\setuptools\c
ommand\easy_install.py", line 671, in process_distribution
[requirement], self.local_index, self.easy_install
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 633, in resolve
requirements.extend(dist.requires(req.extras)[::-1])
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 2291, in requires
dm = self._dep_map
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 2277, in _dep_map
for extra,reqs in split_sections(self._get_metadata(name)):
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 2715, in split_sections
for line in yield_lines(s):
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 1989, in yield_lines
for ss in strs:
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 2305, in _get_metadata
for line in self.get_metadata_lines(name):
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 1369, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 1361, in get_metadata
return self._get(self._fn(self.egg_info,name))
File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 1425, in _get
return self.loader.get_data(path)
zipimport.ZipImportError: bad local file header in c:\python27\lib\site-packages
\setuptools-3.4.4-py2.7.egg
Something went wrong during the installation.
See the error message above.
Try the 3.0 version https://pypi.python.org/packages/source/s/setuptools/setuptools-3.0.zip. It worked on my Python v2.75 when I had the same problem.

Determine python version in Easy Install

I wan't to install 'twisted' module on CentOS 5.9 . There is python 2.4 by default on it and because of other program dependencies I can't remove python 2.4 .
I have installed Python 2.7 by yum install python27 and installed Easy Install by yum install python-setuptools . Now when I try to install 'twisted' with easy_install twisted I got this error:
< ... truncated ... >
Running Twisted-12.3.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-YeUGBS/Twisted-12.3.0/egg-dist-tmp-NhwZo-
Traceback (most recent call last):
File "/usr/bin/easy_install", line 7, in ?
sys.exit(
File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 1670, in main
with_ei_usage(lambda:
File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 1659, in with_ei_usage
return f()
File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 1674, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "/usr/lib/python2.4/distutils/core.py", line 149, in setup
dist.run_commands()
File "/usr/lib/python2.4/distutils/dist.py", line 946, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.4/distutils/dist.py", line 966, in run_command
cmd_obj.run()
File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 211, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 446, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 471, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 655, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 930, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 919, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 26, in run_setup
DirectorySandbox(setup_dir).run(
File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 63, in run
return func()
File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 29, in <lambda>
{'__file__':setup_script, '__name__':'__main__'}
File "setup.py", line 64, in ?
File "setup.py", line 46, in main
File "./twisted/__init__.py", line 47
class Dummy(object):
^
SyntaxError: invalid syntax
As you see, Easy Install use python 2.4 instead of python 2.7 . How can it force it to use python 2.7 ?
You can manually use which ever Python version you want by typing e.g. Python2.7 <script>. Try to execute python2.7 -m easy_install twisted instead.
If for some reason easy_install wasn't installed for Python 2.7 you can download and install it manually here.

Categories

Resources