ImportErrors with Python setuptools.command.sdist - python

I'm trying to install Newspaper, which installs a whole bunch of dependencies using pip. During the installation of a lot of its dependencies, this error is getting raised:
ImportError: <module 'setuptools.command.sdist' from '/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/setuptools/command/sdist.pyc'> has no '_default_revctrl' attribute
Installing without pip works fine, but is quite tedious due to the number of dependencies Newspaper has. Can anyone give me a hand?
Here's the full traceback for one instance of the error:
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/Pillow.egg-info
writing pip-egg-info/Pillow.egg-info/PKG-INFO
writing top-level names to pip-egg-info/Pillow.egg-info/top_level.txt
writing dependency_links to pip-egg-info/Pillow.egg-info/dependency_links.txt
writing pip-egg-info/Pillow.egg-info/PKG-INFO
writing top-level names to pip-egg-info/Pillow.egg-info/top_level.txt
writing dependency_links to pip-egg-info/Pillow.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/Pillow.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-auItlo/Pillow/setup.py", line 757, in <module>
zip_safe=True,
File "/usr/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "<string>", line 15, in replacement_run
File "/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/setuptools/command/egg_info.py", line 206, in find_sources
mm.run()
File "/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/setuptools/command/egg_info.py", line 290, in run
self.add_defaults()
File "/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/setuptools/command/egg_info.py", line 322, in add_defaults
rcfiles = list(walk_revctrl())
File "/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/setuptools/command/sdist.py", line 18, in walk_revctrl
for item in ep.load()(dirname):
File "/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/pkg_resources/__init__.py", line 2265, in load
raise ImportError("%r has no %r attribute" % (entry, attr))
ImportError: <module 'setuptools.command.sdist' from '/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/setuptools/command/sdist.pyc'> has no '_default_revctrl' attribute

This could also be caused by a change in setuptools released today:
https://bitbucket.org/pypa/setuptools/issue/320/cannot-upgrade-to-1001

running easy_install solved it for me:
easy_install --upgrade setuptools

Upgrading setuptools with pip can solve this:
sudo pip install --upgrade setuptools

Related

ModuleNotFoundError: No module named 'Cython' when installing pyarrow

I am trying to install packages from requirements.txt in a virtualenv. However, when pip comes to installing pyarrow, it fails with the following:
Collecting pyarrow==0.9.0 (from -r requirements.txt (line 41))
Using cached https://files.pythonhosted.org/packages/be/2d/11751c477e4e7f4bb07ac7584aafabe0d0608c170e4bff67246d695ebdbe/pyarrow-0.9.0.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/tj/nzhk3hh12074tfyhtgpkw0zm0000gn/T/pip-install-dgdvn2c1/pyarrow/setup.py", line 29, in <module>
from Cython.Distutils import build_ext as _build_ext
ModuleNotFoundError: No module named 'Cython'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/tj/nzhk3hh12074tfyhtgpkw0zm0000gn/T/pip-install-dgdvn2c1/pyarrow/
I am using Python 3.6.3 and Pip 18.0
What I tried:
Most of the SO answers ask to check if python and pip refer to the venv python and I am sure it does.
$ which python
/Users/ME/repos/myproject/venv/bin/python
(venv)
I also tried installing cython via pip and even then installation fails albeit with a different error.
How do I solve this?
Edit:
Stacktrace after installing Cython:
Collecting pyarrow==0.9.0 (from -r requirements.txt (line 41))
Using cached https://files.pythonhosted.org/packages/be/2d/11751c477e4e7f4bb07ac7584aafabe0d0608c170e4bff67246d695ebdbe/pyarrow-0.9.0.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/tj/nzhk3hh12074tfyhtgpkw0zm0000gn/T/pip-install-98s3ff2r/pyarrow/setup.py", line 508, in <module>
url="https://arrow.apache.org/"
File "/Users/ME/Work/myproject/venv/lib/python3.6/site-packages/setuptools/__init__.py", line 131, in setup
return distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/Users/ME/Work/myproject/venv/lib/python3.6/site-packages/setuptools/dist.py", line 370, in __init__
k: v for k, v in attrs.items()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 281, in __init__
self.finalize_options()
File "/Users/ME/Work/myproject/venv/lib/python3.6/site-packages/setuptools/dist.py", line 529, in finalize_options
ep.load()(self, ep.name, value)
File "/private/var/folders/tj/nzhk3hh12074tfyhtgpkw0zm0000gn/T/pip-install-98s3ff2r/pyarrow/.eggs/setuptools_scm-3.0.5-py3.6.egg/setuptools_scm/integration.py", line 23, in version_keyword
dist.metadata.version = get_version(**value)
File "/private/var/folders/tj/nzhk3hh12074tfyhtgpkw0zm0000gn/T/pip-install-98s3ff2r/pyarrow/.eggs/setuptools_scm-3.0.5-py3.6.egg/setuptools_scm/__init__.py", line 135, in get_version
parsed_version = _do_parse(config)
File "/private/var/folders/tj/nzhk3hh12074tfyhtgpkw0zm0000gn/T/pip-install-98s3ff2r/pyarrow/.eggs/setuptools_scm-3.0.5-py3.6.egg/setuptools_scm/__init__.py", line 77, in _do_parse
parse_result = _call_entrypoint_fn(config, config.parse)
File "/private/var/folders/tj/nzhk3hh12074tfyhtgpkw0zm0000gn/T/pip-install-98s3ff2r/pyarrow/.eggs/setuptools_scm-3.0.5-py3.6.egg/setuptools_scm/__init__.py", line 40, in _call_entrypoint_fn
return fn(config.absolute_root)
File "/private/var/folders/tj/nzhk3hh12074tfyhtgpkw0zm0000gn/T/pip-install-98s3ff2r/pyarrow/setup.py", line 462, in parse_version
return version_from_scm(root)
File "/private/var/folders/tj/nzhk3hh12074tfyhtgpkw0zm0000gn/T/pip-install-98s3ff2r/pyarrow/.eggs/setuptools_scm-3.0.5-py3.6.egg/setuptools_scm/__init__.py", line 28, in version_from_scm
return _version_from_entrypoint(root, "setuptools_scm.parse_scm")
File "/private/var/folders/tj/nzhk3hh12074tfyhtgpkw0zm0000gn/T/pip-install-98s3ff2r/pyarrow/.eggs/setuptools_scm-3.0.5-py3.6.egg/setuptools_scm/__init__.py", line 44, in _version_from_entrypoint
for ep in iter_matching_entrypoints(config.absolute_root, entrypoint):
AttributeError: 'str' object has no attribute 'absolute_root'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/tj/nzhk3hh12074tfyhtgpkw0zm0000gn/T/pip-install-98s3ff2r/pyarrow/
This is a known issue (#2163) with pyarrow that has been closed without a fix.
It's worth noting that there is no pyarrow 0.9.0 wheel available for MacOS in pypi. It was made available in a subsequent 0.9.0.post1 release.
The following should work with Python 3.6 on MacOS:
pip install pyarrow==0.9.0.post1

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.

Fipy nominally installed but fipy.test() fails with error messages

I'm attempting to get FiPy set up using Miniconda 2 on a Windows 7 system, and got to the point of running the test suite with the recommended python -c "import fipy; fipy.test()".
Unfortunately rather than getting test results, the suite gave me an error with stack trace:
running egg_info
creating c:\users\bram\appdata\local\temp\tmpbzt0mv\FiPy.egg-info
writing c:\users\bram\appdata\local\temp\tmpbzt0mv\FiPy.egg-info\PKG-INFO
writing top-level names to c:\users\bram\appdata\local\temp\tmpbzt0mv\FiPy.egg-info\top_level.txt
writing dependency_links to c:\users\bram\appdata\local\temp\tmpbzt0mv\FiPy.egg-info\dependency_links.txt
writing manifest file 'c:\users\bram\appdata\local\temp\tmpbzt0mv\FiPy.egg-info\SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
reading manifest file 'c:\users\bram\appdata\local\temp\tmpbzt0mv\FiPy.egg-info\SOURCES.txt'
writing manifest file 'c:\users\bram\appdata\local\temp\tmpbzt0mv\FiPy.egg-info\SOURCES.txt'
running test
running build_ext
fipy version 3.1.3
numpy version 1.12.0
pysparse is not installed
scipy version 0.18.1
matplotlib is not installed
gist is not installed
mpi4py is not installed
mpi4py is not installed
enthought.mayavi is not installed
gmsh is not installed
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\Users\Bram\Miniconda2\lib\site-packages\fipy\__init__.py", line 164, in test
cmdclass={'test': _TestClass(_test)})
File "D:\Users\Bram\Miniconda2\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "D:\Users\Bram\Miniconda2\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "D:\Users\Bram\Miniconda2\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "D:\Users\Bram\Miniconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\setuptools\command\test.py", line 172, in run
File "D:\Users\Bram\Miniconda2\lib\site-packages\fipy\tests\testClass.py", line 236, in run_tests
testLoader = loader_class()
File "D:\Users\Bram\Miniconda2\lib\unittest\main.py", line 94, in __init__
self.parseArgs(argv)
File "D:\Users\Bram\Miniconda2\lib\unittest\main.py", line 149, in parseArgs
self.createTests()
File "D:\Users\Bram\Miniconda2\lib\unittest\main.py", line 158, in createTests
self.module)
File "D:\Users\Bram\Miniconda2\lib\unittest\loader.py", line 130, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "D:\Users\Bram\Miniconda2\lib\unittest\loader.py", line 100, in loadTestsFromName
parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'testFiPy'
Can anyone help me get this to work? I don't know where to start with this outcome.
Just wanted to add for those who (like me) are new to git and conda - to install the FiPy from develop branch you should (following this answer):
Activate your conda environment: source activate myenv (or activate
myenv for windows)
Install git and pip: conda install git pip
Install FiPy: pip install git+git://github.com/usnistgov/fipy#develop

How to install pybrain

I am attempting to install pybrains but I am getting this error:
C:\Python34\python.exe "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.4\helpers\pycharm\pycharm_setup_runner.py" C:\Users\PycharmProjects\Youtube\pybrain-pybrain-87c7ac3\setup.py
Testing started at 14:08 ...
running pycharm_test
running egg_info
writing PyBrain.egg-info\PKG-INFO
writing dependency_links to PyBrain.egg-info\dependency_links.txt
writing top-level names to PyBrain.egg-info\top_level.txt
reading manifest file 'PyBrain.egg-info\SOURCES.txt'
writing manifest file 'PyBrain.egg-info\SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.4\helpers\pycharm\pycharm_setup_runner.py", line 26, in <module>
exec (fh.read(), globals(), locals())
File "<string>", line 21, in <module>
File "C:\PYTHON34\LIB\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\PYTHON34\LIB\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\PYTHON34\LIB\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\site-packages\setuptools\command\test.py", line 138, in run
self.with_project_on_sys_path(self.run_tests)
File "C:\Python34\lib\site-packages\setuptools\command\test.py", line 118, in with_project_on_sys_path
func()
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.4\helpers\pycharm\pycharm_commands\pycharm_test.py", line 18, in run_tests
testLoader=loader_class()
File "C:\PYTHON34\LIB\unittest\main.py", line 92, in __init__
self.parseArgs(argv)
File "C:\PYTHON34\LIB\unittest\main.py", line 139, in parseArgs
self.createTests()
File "C:\PYTHON34\LIB\unittest\main.py", line 146, in createTests
self.module)
File "C:\PYTHON34\LIB\unittest\loader.py", line 146, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "C:\PYTHON34\LIB\unittest\loader.py", line 146, in <listcomp>
suites = [self.loadTestsFromName(name, module) for name in names]
File "C:\PYTHON34\LIB\unittest\loader.py", line 105, in loadTestsFromName
module = __import__('.'.join(parts_copy))
File "c:\users\dhowarth\pycharmprojects\youtube\pybrain-pybrain-87c7ac3\pybrain\__init__.py", line 1, in <module>
from structure.__init__ import *
ImportError: No module named 'structure'
Process finished with exit code 1
Where do I find the 'Structure' module?
Anyone having the same issue?
I have followed the instructions on: https://github.com/pybrain/pybrain/wiki/installation.
what am I missing?
The Pybrain can be setup by pip install pybrain directly.
The FNN in pybrain have a bit problem of convergence and performance. As substitution, there are lots of advices on Python for AI, such as FANN (An example) and scikit-learn (for lots of ML method but not contains FNN directly).
Try not to use pip. I always prefer getting the entire folder from PyPI or github (if available) and then doing the simple python setup.py install.
Also, whenever you do some work with the packages which are under active development (or not very commonly use), please read their documentation.
If you see the documentation : Here. You will see that they use Python 2.x.
And you are clearly using Python 3.x.
Get Python 2.x and download the folder from github. Unzip it and install.
Hope it helps.
Cheers.
Try following queries:
pip install numpy
pip install scipy
pip install pybrain
OR:
download ez_setup.py and run it:
python ez_setup.py
OR:
use easy_install:
easy_install pybrain

Categories

Resources