Cython issue installing scikit-learn - python

I am trying to run sklearn, which I can import in Python 2.7.11, but
there was an installation problem. I tried going to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn and ran
python setup.py install
and got into some apparently Cython related issues:
Traceback (most recent call last):
File "setup.py", line 88, in <module>
setup(**configuration(top_path='').todict())
File "setup.py", line 82, in configuration
maybe_cythonize_extensions(top_path, config)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn/_build_utils/__init__.py", line 84, in maybe_cythonize_extensions
config.ext_modules = cythonize(config.ext_modules)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 908, in cythonize
aliases=aliases)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 778, in create_extension_list
for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 124, in nonempty
raise ValueError(error_msg)
ValueError: '_check_build.pyx' doesn't match any files
Does anyone have an idea as to what the issue might be?
Thanks,

Related

coudn't find location of python module

I'm working with ubuntu, and it gives following error
Traceback (most recent call last):
File "SMAPylModules/SMAPylDriverPy.m/src/licensing.py", line 559, in <module>
File "SMAPylModules/SMAPylDriverPy.m/src/application.py", line 151, in run
File "SMAPylModules/SMAPylDriverPy.m/src/licensing.py", line 155, in execute
File "SMAPylModules/SMAPylDriverPy.m/src/licensing.py", line 228, in runCurrentUsageApp
File "SMAPyrModules/SMAPyrUtiPy.m/src/uti.py", line 37, in spawnAndWait
File "SMAPyrModules/SMAPyrUtiPy.m/src/utiSpawn.py", line 93, in spawnAndWait
File "SMAPyrModules/SMAPyrUtiPy.m/src/utiSpawnImpl.py", line 643, in spawnAndWait
File "SMAPyrModules/SMAPyrUtiPy.m/src/utiSpawnImpl.py", line 477, in __init__
File "SMAPyrModules/SMAPyrUtiPy.m/src/utiSpawnImpl.py", line 438, in popenWrap
I cannot find the SMAPyModules directory as well as modules such as licensing.py, utiSpawn.py etc.
Could you give me some solution or advice?
In the console:
sudo apt install lsb

Pip installation causes RecursionError

I am trying to install a software called grizli (https://github.com/gbrammer/grizli/) in a conda environment. In one step I have to install another software called drizzle (https://github.com/gbrammer/drizzle.git). Thís installation always results in a RecursionError. As explained in the installation instructions I run
pip install git+https://github.com/gbrammer/drizzle.git
resulting in
Collecting git+https://github.com/gbrammer/drizzle.git
Cloning https://github.com/gbrammer/drizzle.git to /tmp/pip-req-build-ncjb9u8_
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-req-build-ncjb9u8_/setup.py", line 61, in <module>
cmdclassd = register_commands(PACKAGENAME, VERSION, RELEASE)
File "/tmp/pip-req-build-ncjb9u8_/astropy_helpers/astropy_helpers/setup_helpers.py", line 140, in register_commands
from .commands.build_sphinx import AstropyBuildSphinx, AstropyBuildDocs
File "/tmp/pip-req-build-ncjb9u8_/astropy_helpers/astropy_helpers/commands/build_sphinx.py", line 16, in <module>
from sphinx.setup_command import BuildDoc as SphinxBuildDoc
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/sphinx/setup_command.py", line 23, in <module>
from sphinx.application import Sphinx
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/sphinx/application.py", line 34, in <module>
from sphinx.environment import BuildEnvironment
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/sphinx/environment/__init__.py", line 38, in <module>
from sphinx.util.websupport import is_commentable
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/sphinx/util/websupport.py", line 11, in <module>
from sphinxcontrib.websupport.utils import is_commentable # NOQA
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/sphinxcontrib/websupport/__init__.py", line 15, in <module>
from sphinxcontrib.websupport.core import WebSupport # NOQA
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/sphinxcontrib/websupport/core.py", line 17, in <module>
from jinja2 import Environment, FileSystemLoader
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/jinja2/__init__.py", line 33, in <module>
from jinja2.environment import Environment, Template
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/jinja2/environment.py", line 15, in <module>
from jinja2 import nodes
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/jinja2/nodes.py", line 19, in <module>
from jinja2.utils import Markup
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/jinja2/utils.py", line 486, in <module>
MutableMapping.register(LRUCache)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/abc.py", line 158, in register
if issubclass(subclass, cls):
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/abc.py", line 209, in __subclasscheck__
ok = cls.__subclasshook__(subclass)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 884, in __extrahook__
if issubclass(subclass, scls):
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 1154, in __subclasscheck__
return super().__subclasscheck__(cls)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/abc.py", line 209, in __subclasscheck__
ok = cls.__subclasshook__(subclass)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 884, in __extrahook__
if issubclass(subclass, scls):
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 1154, in __subclasscheck__
return super().__subclasscheck__(cls)
...
...
...
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/abc.py", line 209, in __subclasscheck__
ok = cls.__subclasshook__(subclass)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 884, in __extrahook__
if issubclass(subclass, scls):
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 1154, in __subclasscheck__
return super().__subclasscheck__(cls)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/abc.py", line 209, in __subclasscheck__
ok = cls.__subclasshook__(subclass)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 884, in __extrahook__
if issubclass(subclass, scls):
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 1154, in __subclasscheck__
return super().__subclasscheck__(cls)
RecursionError: maximum recursion depth exceeded while calling a Python object
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-ncjb9u8_/
The three points in the code stand for the repetition of the three lines that always appear in the same order and probably cause the RecursionError.
I have already tried different pip versions but it didn't change anything. Does anybody have an idea?
I just got the same issue. The only solution that worked for me was to downgrade sphinx to a version <=1.5.6 as mentioned here: https://github.com/ericmandel/pyds9/issues/53 (note that I already had astro-helpers >=2.0 when I got the issue, so the solution is on downgrading sphinx)
Just do: pip install sphinx==1.5.6
and then hopefully drizzle will install correctly.

pip cant install radiopy

I've tried
pip install radiopy
Traceback:
C:\Users\олег\Downloads>pip install radiopy
Collecting radiopy
Using cached radio
py-0.6.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\29F0~1\AppData\Local\Temp\pip-build-blxa2oob\radiopy\setup.py, line 23, in <module>
version=get_version('radio.py'),
File "C:\Users\29F0~1\AppData\Local\Temp\pip-build-blxa2oob\radiopy\setup.py
return __version__
NameError: name '__version__' is not defined
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\29F0~1\AppData\Local\Temp\pip-build-blxa2oob\radiopy\
I've also tried:
easy_install radiopy
Traceback:
File "c:\python34\lib\site-packages\setuptools\sandbox.py", line 168, in save_modules
saved_exc.resume()
File "c:\python34\lib\site-packages\setuptools\sandbox.py", line 143, in resume
six.reraise(type, exc, self._tb)
File "c:\python34\lib\site-packages\pkg_resources\_vendor\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "c:\python34\lib\site-packages\setuptools\sandbox.py", line 156, in save_modules
yield saved
File "c:\python34\lib\site-packages\setuptools\sandbox.py", line 197, in setup_context yield
File "c:\python34\lib\site-packages\setuptools\sandbox.py", line 246, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "c:\python34\lib\site-packages\setuptools\sandbox.py", line 276, in run return func()
File "c:\python34\lib\site-packages\setuptools\sandbox.py", line 245, in runner
_execfile(setup_script, ns)
File "c:\python34\lib\site-packages\setuptools\sandbox.py", line 47, in _execfile
exec(code, globals, locals)
File "C:\Users\29F0~1\AppData\Local\Temp\easy_install-laprrvio\radiopy-0.6\setup.py", line 23, in <module>
File "C:\Users\29F0~1\AppData\Local\Temp\easy_install-laprrvio\radiopy-0.6\setup.py", line 19, in get_version
NameError: name '__version__' is not defined
Lately,
C:\Users\олег>pip install C:\\Users\\олег\\Downloads\\radiopy-0.6.tar.gz
Traceback:
C:\Users\олег>pip install C:\\Users\\олег\\Downloads\\radiopy-0.6.tar.gz
Processing c:\users\олег\downloads\radiopy-0.6.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\29F0~1\AppData\Local\Temp\pip-8evw0uk0-build\setup.py", line 23, in <module>
version=get_version('radio.py'),
File "C:\Users\29F0~1\AppData\Local\Temp\pip-8evw0uk0-build\setup.py", line 19, in get_version
return __version__
NameError: name '__version__' is not defined
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\29F0~1\AppData\Local\Temp\pip-8evw0uk0-build\
How can I solve this?
The module seems to support Python 2 only. The setup.py contains a very dubious hack to evaluate the __version__ variable:
def get_version(filename):
"""Extract __version__ from file by parsing it."""
with open(filename) as fp:
for line in fp:
if line.startswith('__version__'):
exec(line)
return __version__
What this does is to find a line that starts with __version__, namely __version__ = '0.6', and then execute it as dynamic code with exec, which works. However in Python 3 this doesn't modify local variables and thus __version__ is not defined on the next line.
Even if you fixed this bug, you'd met a countless others as the package is not Python-3-ready at all. The easiest solution would be to use Python 2. But even then I am not too sure if this works correctly on Windows as it is written for the mplayer/mencoder suite, and seems to be very Linux/POSIX minded in its code.

Installing pymongo on a nitrous.io box

I'm fairly new to Python, and Nitrous.IO, and MongoDB, and command line in general so would appreciate a little guidance here if possible.
I'm trying to install pymongo on my Nitrous.IO box but can't seem to find a way to do it - this tutorial suggests 'import pymongo' but that didn't work (see below).
I can't seem to find any tutorials or help on this - a google search for "install +pymongo with nitrous.io" gave me 0 results.
action#thirdyearproject-148753:~(master*)$ import pymongo
import: unable to open X server `' # error/import.c/ImportImageCommand/366.
action#thirdyearproject-148753:~(master*)$ pip install pymongo
Traceback (most recent call last):
File "/home/action/.parts/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 356, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 2431, in load_entry_point
return ep.load()
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 2147, in load
['__name__'])
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/__init__.py", line 10, in <modul
from pip.util import get_installed_distributions, get_prog
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/util.py", line 15, in <module>
from pip.locations import site_packages, running_under_virtualenv, virtualenv_no_global
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/locations.py", line 96, in <modu
build_prefix = _get_build_prefix()
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg/pip/locations.py", line 64, in _get_
path = os.path.join(tempfile.gettempdir(), 'pip_build_%s' %
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/tempfile.py", line 269, in gettempdir
tempdir = _get_default_tempdir()
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/tempfile.py", line 212, in _get_default_tempdir
("No usable temporary directory found in %s" % dirlist))
IOError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/home/action']
action#thirdyearproject-148753:~(master*)$ easy_install pymongo
Traceback (most recent call last):
File "/home/action/.parts/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 2829, in <module>
working_set = WorkingSet._build_master()
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 451, in _build_master
return cls._build_from_requirements(__requires__)
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 464, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/home/action/.parts/packages/python2/2.7.6/lib/python2.7/site-packages/pkg_resources.py", line 639, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: setuptools==2.2
action#thirdyearproject-148753:~(master*)$ parts install pymongo
parts: ERROR: Package "pymongo" not found
Aborting!
Does anyone know how I would go about installing this? It's starting to be a real pain!
You might be able to install it withpip using this advice. Once you've done that, you would use the import pymongo at the top of your code file.

GAE " no attribute 'HTTPSHandler' " dev_appserver.py

I am trying to use the google appengine python SKD from my ubuntu lucid. I have already compiled python2.5. But when I execute any "dev_appserver.py" command with it I get the following error:
Traceback (most recent call last):
File "dev_appserver.py", line 69, in <module>
run_file(__file__, globals())
File "dev_appserver.py", line 65, in run_file
execfile(script_path, globals_)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver_main.py", line 90, in <module>
from google.appengine.tools import appcfg
File "/media/Ultimate/WebD/django/app_engine/google_appengine/google/appengine/tools/appcfg.py", line 59, in <module>
from google.appengine.tools import appengine_rpc
File "/media/Ultimate/WebD/django/app_engine/google_appengine/google/appengine/tools/appengine_rpc.py", line 24, in <module>
import fancy_urllib
File "/media/Ultimate/WebD/django/app_engine/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py", line 328, in <module>
class FancyHTTPSHandler(urllib2.HTTPSHandler):
AttributeError: 'module' object has no attribute 'HTTPSHandler'
I have checked the urllib2 moduls of python2.6 and python2.5 but there was no difference in the models defination and HTTPSHandelr is there in python2.5 too. So I guess it is some other sort of error.
I tried to run with the default python2.6 too but then I get the following error:
WARNING 2010-09-11 12:08:40,848 datastore_file_stub.py:657] Could not read datastore data from /tmp/dev_appserver.datastore
Traceback (most recent call last):
File "./dev_appserver.py", line 69, in <module>
run_file(__file__, globals())
File "./dev_appserver.py", line 65, in run_file
execfile(script_path, globals_)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver_main.py", line 449, in <module>
sys.exit(main(sys.argv))
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver_main.py", line 426, in main
static_caching=static_caching)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver.py", line 3820, in CreateServer
server = HTTPServerWithScheduler((serve_address, port), handler_class)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver.py", line 3840, in __init__
request_handler_class)
File "/usr/lib/python2.6/SocketServer.py", line 400, in __init__
self.server_bind()
File "/usr/lib/python2.6/BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/usr/lib/python2.6/SocketServer.py", line 411, in server_bind
self.socket.bind(self.server_address)
File "<string>", line 1, in bind
socket.error: [Errno 98] Address already in use
It works well in windows and even under wine.
Update
Problem with python2.6 solved.
I had configured my apache server for a django deployment on the 8080 and 80 port some time earlier.
But there is still same error with python2.5 isntallation.
Solved the issue...just needed to build all dependencies of python using:
apt-get build-dep python
python compiles with no error even when all the dependencies are not installed. It just skips the modules which require them and builds python.
Solution for missing HTTPSHandler:
Before you build python 2.5 from source you need to enable ssl-socket by editing Modules/Setup.dist (more info here http://paltman.com/2007/nov/15/getting-ssl-support-in-python-251/)
The method described in this post worked perfectly for me (Ubuntu 11.10).
http://dewbot.posterous.com/installation-of-python-25-and-google-app-engi

Categories

Resources