Python Error when installing ruamel.yaml package with pip - python

I am receiving an error when I want to install the ruamel.yaml package
Here is the command:
python --version;pip --version;pip install ruamel.yaml
And the output:
Python 2.7.10
pip 10.0.0 from /Library/Python/2.7/site-packages/pip (python 2.7)
Collecting ruamel.yaml
Downloading https://files.pythonhosted.org/packages/c1/ad/9557a78f1b61951623c56225e05dacdd81f80519f13fc39a926a5793edfa/ruamel.yaml-0.15.37.tar.gz (280kB)
100% |████████████████████████████████| 286kB 4.4MB/s
Complete output from command python setup.py egg_info:
sys.argv ['-c', 'egg_info', '--egg-base', 'pip-egg-info']
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/8j/69k5q3yn4y51g5nt2g7g9b9n24s68p/T/pip-install-htyM8C/ruamel.yaml/setup.py", line 917, in <module>
main()
File "/private/var/folders/8j/69k5q3yn4y51g5nt2g7g9b9n24s68p/T/pip-install-htyM8C/ruamel.yaml/setup.py", line 905, in main
setup(**kw)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py", line 272, in __init__
_Distribution.__init__(self,attrs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py", line 326, in finalize_options
ep.require(installer=self.fetch_build_egg)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2385, in require
reqs = self.dist.requires(self.extras)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2617, in requires
dm = self._dep_map
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2606, in _dep_map
if invalid_marker(marker):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1424, in is_invalid_marker
cls.evaluate_marker(text)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1549, in _markerlib_evaluate
env = cls._translate_metadata2(_markerlib.default_environment())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1537, in _translate_metadata2
for key, value in env
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1536, in <genexpr>
(key.replace('.', '_'), value)
ValueError: too many values to unpack
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/8j/69k5q3yn4y51g5nt2g7g9b9n24s68p/T/pip-install-htyM8C/ruamel.yaml/
To give a bit of a background. I installed python3 with brew and I uninstalled it thereafter.
Now I cannot install ruamel.yaml
Has anybody had the same issue?
How did you solve it?

You should do a pip list and check your version of setuptools should be (28.8.0). If you have an older version, upgrade with pip install -U setuptools.
You should consider upgrading from 2.7.10 to a newer version of Python 2 (currently 2.7.14), which should solve your SSL problems. Make sure you don't overwrite the system python if you are running on Linux.

I was able to resolve this by downgrading the python version from 3.10.+ to 3.9.+

Related

installing pip on rhel 7.6 + failed on unknown distribution option: project_urls

we tried to installe pip on rhel machine - rhel 7.6 version ( we have python 2.7 )
as the following
ls
AUTHORS.txt build dist docs LICENSE.txt MANIFEST.in NEWS.rst PKG-INFO pyproject.toml README.rst setup.cfg setup.py src
python setup.py install
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'
warnings.warn(msg)
Traceback (most recent call last):
File "setup.py", line 87, in <module>
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
File "/usr/lib64/python2.7/distutils/core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 269, in __init__
_Distribution.__init__(self,attrs)
File "/usr/lib64/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 302, in finalize_options
ep.load()(self, ep.name, value)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2443, in load
return self.resolve()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2453, in resolve
raise ImportError(str(exc))
ImportError: 'module' object has no attribute 'check_specifier'
we can see that installing is complain about
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
so we looked on setup.py
and we marked the following line - python_requires
entry_points={
"console_scripts": [
"pip=pip._internal.cli.main:main",
"pip{}=pip._internal.cli.main:main".format(sys.version_info[0]),
"pip{}.{}=pip._internal.cli.main:main".format(
*sys.version_info[:2]
),
],
},
zip_safe=False,
#python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*', )
then we run again
installation is now better and we can see the pip is installed as
which pip
/usr/bin/pip
but last lines are:
Traceback (most recent call last):
File "setup.py", line 86, in <module>
zip_safe=False,
File "/usr/lib64/python2.7/distutils/core.py", line 152, 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/site-packages/setuptools/command/install.py", line 73, in run
self.do_egg_install()
File "/usr/lib/python2.7/site-packages/setuptools/command/install.py", line 101, in do_egg_install
cmd.run()
File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 380, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 604, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 655, in install_item
self.process_distribution(spec, dist, deps)
File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 701, in process_distribution
distreq.project_name, distreq.specs, requirement.extras
TypeError: __init__() takes exactly 2 arguments (4 given)
so after re-run again the python setup.py install , installation succeeded without errors
example of last lines:
Extracting pip-20.1.1-py2.7.egg to /usr/lib/python2.7/site-packages
pip 20.1.1 is already the active version in easy-install.pth
Installing pip script to /usr/bin
Installing pip2.7 script to /usr/bin
Installing pip2 script to /usr/bin
Installed /usr/lib/python2.7/site-packages/pip-20.1.1-py2.7.egg
Processing dependencies for pip==20.1.1
Finished processing dependencies for pip==20.1.1
so the workaround here was the following
marked the line as
# python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
and run the following twice
python setup.py install
but this workaround maybe works but it is ugly
any suggestion how to fix the pip installation ?
reference - Using python_requires to require Python 2.7 or 3.2+

Pipenv not working after upgrade to python (Homebrew installed)

It appears pipenv and other python packages on my Mac are tied to Python 3.6 but should work fine with 3.7. I recently updated to python via
brew upgrade python
Running 3.7.0
$ pipenv update
Warning: Python 3.6 was not found on your system…
You can specify specific versions of Python with:
$ pipenv --python path/to/python
When I try to specify the path... I get:
```
$ pipenv --python 3.7 update
Creating a virtualenv for this project…
Pipfile: /Users/zane/src/dinghy-ping/Pipfile
Using /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/bin/python3.7 (3.7.0) to create virtualenv…
⠸Running virtualenv with interpreter /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/bin/python3.7
Using base prefix '/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7'
/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/virtualenv.py:1041: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
New python executable in /Users/zane/.local/share/virtualenvs/dinghy-ping-ePAjWOtt/bin/python3.7
Not overwriting existing python script /Users/zane/.local/share/virtualenvs/dinghy-ping-ePAjWOtt/bin/python (you must use /Users/zane/.local/share/virtualenvs/dinghy-ping-ePAjWOtt/bin/python3.7)
Please make sure you remove any previous custom paths from your /Users/zane/.pydistutils.cfg file.
Installing setuptools, pip, wheel...
Complete output from command /Users/zane/.local/s...AjWOtt/bin/python3.7 - setuptools pip wheel:
Looking in links: /usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages, /usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/virtualenv_support, /Users/zane/Library/Python/3.7/lib/python/site-packages/virtualenv_support
Collecting setuptools
Using cached https://files.pythonhosted.org/packages/96/06/c8ee69628191285ddddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl
Collecting pip
Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
Collecting wheel
Using cached https://files.pythonhosted.org/packages/5a/9b/6aebe9e2636d35d1a93772fa644c828303e1d5d124e8a88f156f42ac4b87/wheel-0.32.2-py2.py3-none-any.whl
Installing collected packages: setuptools, pip, wheel
Could not install packages due to an EnvironmentError: [Errno 1] Operation not permitted: '/bin/easy_install'
```
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/virtualenv.py", line 2343, in
main()
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/virtualenv.py", line 712, in main
symlink=options.symlink)
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/virtualenv.py", line 947, in create_environment
download=download,
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/virtualenv.py", line 904, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/virtualenv.py", line 796, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/zane/.local/s...AjWOtt/bin/python3.7 - setuptools pip wheel failed with error code 1
```
```
Traceback (most recent call last):
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/bin/pipenv", line 11, in
load_entry_point('pipenv==2018.10.13', 'console_scripts', 'pipenv')()
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1134, in invoke
Command.invoke(self, ctx)
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/cli/command.py", line 203, in cli
clear=state.clear,
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/core.py", line 565, in ensure_project
pypi_mirror=pypi_mirror,
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/core.py", line 500, in ensure_virtualenv
python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/core.py", line 901, in do_create_virtualenv
click.echo(crayons.blue("{0}".format(c.err)), err=True) File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/vendor/delegator.py", line 146, in err
return self._pexpect_out
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/lib/python3.7/site-packages/pipenv/vendor/delegator.py", line 114, in _pexpect_out
result += self.subprocess.after
TypeError: can only concatenate str (not "type") to str
```
The problem seems to be with:
Installing collected packages: setuptools, pip, wheel
Could not install packages due to an EnvironmentError: [Errno 1] Operation not permitted: '/bin/easy_install'

Import Error: module object has no attribute 'check_specifier' error

On my Buildbot virtual environments, I have been facing a weird error with installing tornado which is a dependency of sphinx-autobuild==0.6.0.
>>> pip install --upgrade sphinx-autobuild==0.6.0
Collecting tornado>=3.2 (from sphinx-autobuild==0.6.0->-r towerportal/requirements.txt (line 76))
Using cached https://files.pythonhosted.org/packages/cf/d1/3be271ae5eba9fb59df63c9891fdc7d8044b999e8ac145994cdbfd2ae66a/tornado-5.0.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-Bpw6k7/tornado/setup.py", line 192, in <module>
**kwargs
File "/spare/local/buildslave/.pyenv/versions/2.7.12/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/spare/local/buildslave/slaveA/demoA/build/virt/lib/python2.7/site-packages/setuptools/dist.py", line 269, in __init__
_Distribution.__init__(self,attrs)
File "/spare/local/buildslave/.pyenv/versions/2.7.12/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/spare/local/buildslave/slaveA/demoA/build/virt/lib/python2.7/site-packages/setuptools/dist.py", line 325, in finalize_options
ep.load()(self, ep.name, value)
File "/spare/local/buildslave/slaveA/demoA/build/virt/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2310, in load
return self.resolve()
File "/spare/local/buildslave/slaveA/demoA/build/virt/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2320, in resolve
raise ImportError(str(exc))
ImportError: 'module' object has no attribute 'check_specifier'
My setuptools version is 39.0.1. Fortunately reinstalling setuptools using pip install -I setuptools tends to fix the problem. But my real question is what does reinstalling the same package with same version name really changes such that it resolves the problem? Has setuptools been erroneously released with different codebase for same version?

How can I install GDAL in Ubuntu 16,04 with python 2.7.12 using pip?

I am trying to import some specific libraries using python. it should be easy like importing numpy for example like so:
import osgeo.gdal, gdal
from osgeo.gdalconst import *
But it seemed to me like the packages gdal and osgeo are missing so I went to the project interpreter to add these packages, Sadly i did not find the package osgeo and the package gdal could not be installed ... I looked it up in the net but it seems that there is no exact way to solve the matter.
I am using Ubuntu 16,04 with python 2.7.12 and PS GDAL is Geospatial Data Abstraction Library
This the error message that I am getting:
Collecting gdal
Using cached GDAL-2.2.3.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/GDAL.egg-info
writing pip-egg-info/GDAL.egg-info/PKG-INFO
writing top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/GDAL.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pycharm-packaging347/gdal/setup.py", line 339, in <module>
**extra )
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 "build/bdist.linux-x86_64/egg/setuptools/command/egg_info.py", line 180, in run
File "build/bdist.linux-x86_64/egg/setuptools/command/egg_info.py", line 207, in find_sources
File "build/bdist.linux-x86_64/egg/setuptools/command/egg_info.py", line 291, in run
File "build/bdist.linux-x86_64/egg/setuptools/command/egg_info.py", line 320, in add_defaults
File "build/bdist.linux-x86_64/egg/setuptools/command/sdist.py", line 130, in add_defaults
File "/usr/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
cmd_obj.ensure_finalized()
File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/tmp/pycharm-packaging347/gdal/setup.py", line 214, in finalize_options
self.gdaldir = self.get_gdal_config('prefix')
File "/tmp/pycharm-packaging347/gdal/setup.py", line 188, in get_gdal_config
return fetch_config(option)
File "/tmp/pycharm-packaging347/gdal/setup.py", line 141, in fetch_config
raise gdal_config_error, e""")
File "<string>", line 4, in <module>
__main__.gdal_config_error: [Errno 2] No such file or directory
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pycharm-packaging347/gdal/
You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Finally I found a solution to my problem.
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install gdal-bin
sudo apt-get -y install python-gdal
Thank you all for the contribution.

python2.7 install python daemon package using pip

When I try to install python daemon package I get this error all the time (installation tried by using pip command & downloading the archive and using pip to install):
pip install python-daemon-2.1.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/7p/x12ctdl94d59qnm_chhj2y240000gn/T/pip-2bGssA-build/setup.py", line 86, in <module>
"Topic :: Software Development :: Libraries :: Python Modules",
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "version.py", line 640, in __init__
super(ChangelogAwareDistribution, self).__init__(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 317, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 372, in fetch_build_eggs
replace_conflicting=True,
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 851, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1123, in best_match
return self.obtain(req, installer)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1135, in obtain
return installer(requirement)
File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 438, in fetch_build_egg
cmd.ensure_finalized()
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/usr/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 251, in finalize_options
'dist_version': self.distribution.get_version(),
File "version.py", line 656, in get_version
version_info = self.get_version_info()
File "version.py", line 651, in get_version_info
changelog_path = get_changelog_path(self)
File "version.py", line 552, in get_changelog_path
setup_dirname = os.path.dirname(distribution.script_name)
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 122, in dirname
i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/7p/x12ctdl94d59qnm_chhj2y240000gn/T/pip-2bGssA-build/
I'm new to python, searching for the error code and using the steps provided by other threads doesn't solved the problem.
Just write pip install python-daemon==2.1.2
No need to download python-daemon-2.1.2.tar.gz file while installing from PyPI using pip.
If you want to install using downloaded package follow these steps
tar xvf python-daemon-2.1.2.tar.gz
cd python-daemon-2.1.2
python setup.py install

Categories

Resources