Cython error while installing pandas from setup.py - python

Facing some errors related to cython while installing pandas from setup.py. Unable to fix that error. I'm trying to install the library offline with setup.py
[16/40] Cythonizing pandas\_libs/reduction.pyx
Error compiling Cython file:
------------------------------------------------------------
...
self.orig_data = self.buf.data
self.orig_len = self.buf.shape[0]
self.orig_stride = self.buf.strides[0]
self.buf.data = self.values.data
pandas\_libs\reduction.pyx:472:15: Assignment to a read-only property
Traceback (most recent call last):
File "setup.py", line 791, in <module>
setup_package()
File "setup.py", line 761, in setup_package
ext_modules=maybe_cythonize(extensions, compiler_directives=directives),
File "setup.py", line 540, in maybe_cythonize
return cythonize(extensions, *args, **kwargs)
File "D:\Pickle Examples\examples_aix\example_aix\lib\site-packages\Cython\Build\Dependencies.py", line 1110, in cythonize
cythonize_one(*args)
File "D:\Pickle Examples\examples_aix\example_aix\lib\site-packages\Cython\Build\Dependencies.py", line 1277, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: pandas\_libs/reduction.pyx

Related

Building wheel for numpy (pyproject.toml) ... error

I have created a python app in my namecheap cpanel. I uploaded by server files in that and also UI files in public_html. However, I was getting Internal Server Error 500. Then I contacted their customer service. They told me install joblib through terminal. I installed it. Then they said in my root folder a file named "stderr.log" it said numpy is missing. So I tried to install numpy. But it shows the following error. Even customer service person failed to provide a solution. When I try pip install numpy, it shows the following large error. Please help.
Building wheels for collected packages: numpy
Building wheel for numpy (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for numpy (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [61 lines of output]
Running from numpy source directory.
setup.py:67: DeprecationWarning:
`numpy.distutils` is deprecated since NumPy 1.23.0, as a result
of the deprecation of `distutils` itself. It will be removed for
Python >= 3.12. For older Python versions it will remain present.
It is recommended to use `setuptools < 60.0` for those Python versions.
For more details, see:
https://numpy.org/devdocs/reference/distutils_status_migration.html
import numpy.distutils.command.sdist
Traceback (most recent call last):
File "/opt/alt/python39/lib64/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/alt/python39/lib64/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/tmp/pip-build-env-r6jq5if_/overlay/lib64/python3.9/site-packages/cython.py", line 16, in <module>
from Cython.Compiler.Main import main
File "/tmp/pip-build-env-r6jq5if_/overlay/lib64/python3.9/site-packages/Cython/Compiler/Main.py", line 28, in <module>
from .Scanning import PyrexScanner, FileSourceDescriptor
ImportError: /tmp/pip-build-env-r6jq5if_/overlay/lib64/python3.9/site-packages/Cython/Compiler/Scanning.cpython-39-x86_64-linux-gnu.so: failed to map segment from shared object: Operation not permitted
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_pcg64.pyx
Traceback (most recent call last):
File "/tmp/pip-install-q0hfnoqk/numpy_6a92dfb088184f0aaac1f9f1f3acc80e/tools/cythonize.py", line 205, in <module>
main()
File "/tmp/pip-install-q0hfnoqk/numpy_6a92dfb088184f0aaac1f9f1f3acc80e/tools/cythonize.py", line 201, in main
find_process_files(root_dir)
File "/tmp/pip-install-q0hfnoqk/numpy_6a92dfb088184f0aaac1f9f1f3acc80e/tools/cythonize.py", line 192, in find_process_files
process(root_dir, fromfile, tofile, function, hash_db)
File "/tmp/pip-install-q0hfnoqk/numpy_6a92dfb088184f0aaac1f9f1f3acc80e/tools/cythonize.py", line 158, in process
processor_function(fromfile, tofile)
File "/tmp/pip-install-q0hfnoqk/numpy_6a92dfb088184f0aaac1f9f1f3acc80e/tools/cythonize.py", line 47, in process_pyx
subprocess.check_call(
File "/opt/alt/python39/lib64/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/nahiuzfc/virtualenv/classify_image/3.9/bin/python3.9_bin', '-m', 'cython', '-3', '--fast-fail', '-o', '_pcg64.c', '_pcg64.pyx']' returned non-zeroexit status 1.
Cythonizing sources
Traceback (most recent call last):
File "/home/nahiuzfc/virtualenv/classify_image/3.9/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/nahiuzfc/virtualenv/classify_image/3.9/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/nahiuzfc/virtualenv/classify_image/3.9/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-r6jq5if_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 230, in build_wheel
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
File "/tmp/pip-build-env-r6jq5if_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-r6jq5if_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 267, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/pip-build-env-r6jq5if_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 479, in <module>
setup_package()
File "setup.py", line 458, in setup_package
generate_cython()
File "setup.py", line 261, in generate_cython
raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects

Cython issue installing scikit-learn

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,

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.

build sklearn error cythonize failed

$ sudo python setup.py build
Gives me the following:
Partial import of sklearn during the build process.
Generating cython files
Cythonizing sources
sklearn
Processing sklearn/_isotonic.pyx
Traceback (most recent call last):
File "/home/scikit-learn/build_tools/cythonize.py", line 198, in <module>
main(root_dir_arg)
File "/home/ascikit-learn/build_tools/cythonize.py", line 190, in main
check_and_cythonize(root_dir)
File "/home/scikit-learn/build_tools/cythonize.py", line 182, in check_and_cythonize
cythonize_if_unchanged(cur_dir, cython_file, gen_file, hashes)
File "/home/scikit-learn/build_tools/cythonize.py", line 156, in cythonize_if_unchanged
cythonize(full_cython_path, full_gen_file_path)
File "/home/scikit-learn/build_tools/cythonize.py", line 61, in cythonize
raise Exception('Building scikit-learn requires Cython >= 0.21')
Exception: Building scikit-learn requires Cython >= 0.21
Traceback (most recent call last):
File "setup.py", line 297, in <module>
setup_package()
File "setup.py", line 280, in setup_package
generate_cython()
File "setup.py", line 185, in generate_cython
raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!
While cython is installed:
Processing ./Cython-0.24-cp27-cp27mu-manylinux1_x86_64.whl
Installing collected packages: Cython
Found existing installation: Cython 0.24
Uninstalling Cython-0.24:
Successfully uninstalled Cython-0.24
Successfully installed Cython-0.24

python + import C++ coding help. Missing compiler_cxx fix for MSVCCompiler; Unable to find vcvarsall.bat

I have scipy and numpy. So I installed MinGW as well as Cygwin. I added the path o MinGW to my
environmental variables. But when I run my python code it shows this error message.
*No module named msvccompiler in numpy.distutils; trying from distutils
Missing compiler_cxx fix for MSVCCompiler*
Traceback (most recent call last):
File "C:\Python27\jicrd_simulation.py", line 633, in <module>
cProfile.run('run()','infoprof_c_old')
File "C:\Python27\lib\cProfile.py", line 29, in run
prof = prof.run(statement)
File "C:\Python27\lib\cProfile.py", line 135, in run
return self.runctx(cmd, dict, dict)
File "C:\Python27\lib\cProfile.py", line 140, in runctx
exec cmd in globals, locals
File "<string>", line 1, in <module>
File "C:\Python27\jicrd_simulation.py", line 615, in run
P,trace=search(g)
File "C:\Python27\jicrd_simulation.py", line 580, in search
hits=compute_hits(g,pos,P)
File "C:\Python27\jicrd_simulation.py", line 299, in compute_hits
source_counts = thetarange(g,g.source,move)
File "C:\Python27\jicrd_simulation.py", line 229, in thetarange
headers=['<stdio.h>','<stdlib.h>','<math.h>','"'+g.path +'/comp.h"'])
File "C:\Python27\lib\site-packages\scipy\weave\inline_tools.py", line 355, in inline
**kw)
File "C:\Python27\lib\site-packages\scipy\weave\inline_tools.py", line 482, in compile_function
verbose=verbose, **kw)
File "C:\Python27\lib\site-packages\scipy\weave\ext_tools.py", line 367, in compile
verbose = verbose, **kw)
File "C:\Python27\lib\site-packages\scipy\weave\build_tools.py", line 272, in build_extension
setup(name = module_name, ext_modules = [ext],verbose=verb)
File "C:\Python27\lib\site-packages\numpy\distutils\core.py", line 186, in setup
return old_setup(**new_attr)
File "C:\Python27\lib\distutils\core.py", line 169, in setup
raise SystemExit, "error: " + str(msg)
CompileError: error: Unable to find vcvarsall.bat
So what should I do now? I have a MSVCCCompiler.
As you're talking about C++ coding, I assume you want to compile a C/C++ extension. The way I got my C extensions to compile on Win32 with MinGW was to explicitly append the compiler:
python setup.py build_ext --compiler mingw32
If you want to compile for Win64, MinGW seems not to be the best choice. I went with the tips here and here and got my extensions to compile with VC++ 10 from the Microsoft SDK.

Categories

Resources