roebel / py_find_1st Goto Github PK
View Code? Open in Web Editor NEWNumpy extension for finding the first element in an 1D array fullfilling a given condition
License: GNU General Public License v3.0
Numpy extension for finding the first element in an 1D array fullfilling a given condition
License: GNU General Public License v3.0
how to find the index of the first value for each row of a matrix?
Running ubuntu 18:
'pip install py-find-1st' just stalls, nothing happens.
Hello, I am unfortunately not able to see what your problem could be. For me things seem to build fine under python 3.8 with pip21.1.3. I have precompiled anaconda packages available in the channel roebel here. The package for python 3.8 was indeed missing but I just compiled and uploaded it. So you should be able to use conda to install it into your environment like this
conda install -c roebel py_find_1st
Let me know if this helps.
Originally posted by @roebel in #11 (comment)
Due to the numpy import in setup.py
, installing this library as dependency is very difficult, since it requires to be a 2 step process at all times:
pip install numpy
pip install py_find_1st
Installing only pip install py_find_1st
in new virtual environment results in an error.
I think this could be improved by wrapping the numpy-import into a try/except
block, catching ImportError
, then running a pip install numpy
from the setup.py script and reimport numpy (this time it should not fail since numpy is now available).
I've seen this in some other project recently, but i can't currently refind that...
Does py_find_1st support detecting the NaN value?
arr = np.array([1, np.nan, 3])
utf1st.find_1st(arr, np.nan, utf1st.cmp_equal)
Expected behavior would give 1
, while the code above outputs -1
libstdc++ was removed in macOS (XCode Command Line Tools v10), but py_find_1st is installable by changing to suggested libc++:
if compiler_is_clang(self.compiler.compiler):
for e in self.extensions:
e.extra_compile_args.append('-stdlib=libc++')
e.extra_compile_args.append('-Wno-unused-function')
for e in self.extensions:
e.extra_link_args.append('-stdlib=libc++')
When trying to install py-find-1st
on a MacBook with Apple's M1 processor, I get a massive error. I suspect its related to the new osx-arm64 architecture.
AssertionError: would build wheel with unsupported tag ('cp38', 'cp38', 'macosx_11_0_x86_64')
The error also says it failed to build Numpy, but Numpy is installed from the package on Conda-forge. (Numpy v1.19.4)
Any ideas on how to fix? Full error is attached, too big to post on Github.
Collecting py-find-1st
Using cached py_find_1st-1.1.4.tar.gz (8.7 kB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: /Users/ryan/miniforge3/envs/ft/bin/python3.8 /Users/ryan/miniforge3/envs/ft/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/6g/73g1_dms191f5pj1mc5n8byh0000gn/T/pip-build-env-1m32vbpx/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools 'numpy>=1.13.0' wheel
cwd: None
Complete output (2503 lines):
Collecting numpy>=1.13.0
Using cached numpy-1.19.4.zip (7.3 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Collecting setuptools
Using cached setuptools-50.3.2-py3-none-any.whl (785 kB)
Collecting wheel
Using cached wheel-0.36.1-py2.py3-none-any.whl (34 kB)
Building wheels for collected packages: numpy
Building wheel for numpy (PEP 517): started
Building wheel for numpy (PEP 517): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /Users/ryan/miniforge3/envs/ft/bin/python3.8 /Users/ryan/miniforge3/envs/ft/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/6g/73g1_dms191f5pj1mc5n8byh0000gn/T/tmp52v4o14q
cwd: /private/var/folders/6g/73g1_dms191f5pj1mc5n8byh0000gn/T/pip-install-mh5ei7a1/numpy_e012ee542ea441bf8ba8256d415fdaa9
Complete output (2480 lines):
numpy/random/_bounded_integers.pxd.in has not changed
numpy/random/_philox.pyx has not changed
numpy/random/_bounded_integers.pyx.in has not changed
......................[TRUNCATED]..........................
File "/private/var/folders/6g/73g1_dms191f5pj1mc5n8byh0000gn/T/pip-build-env-ed1i76z1/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "/Users/ryan/miniforge3/envs/ft/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Users/ryan/miniforge3/envs/ft/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Users/ryan/miniforge3/envs/ft/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/private/var/folders/6g/73g1_dms191f5pj1mc5n8byh0000gn/T/pip-build-env-ed1i76z1/overlay/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 328, in run
impl_tag, abi_tag, plat_tag = self.get_tag()
File "/private/var/folders/6g/73g1_dms191f5pj1mc5n8byh0000gn/T/pip-build-env-ed1i76z1/overlay/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 278, in get_tag
assert tag in supported_tags, "would build wheel with unsupported tag {}".format(tag)
AssertionError: would build wheel with unsupported tag ('cp38', 'cp38', 'macosx_11_0_x86_64')
----------------------------------------
ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/ryan/miniforge3/envs/ft/bin/python3.8 /Users/ryan/miniforge3/envs/ft/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/6g/73g1_dms191f5pj1mc5n8byh0000gn/T/pip-build-env-sjyacgvj/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools 'numpy>=1.13.0' wheel Check the logs for full command output.
[Collecting py-find-1st.txt](https://github.com/roebel/py_find_1st/files/5646749/Collecting.py-find-1st.txt)
================================================================================================ ERRORS =================================================================================================
________________________________________________________________________________ ERROR collecting test/test_find_1st.py _________________________________________________________________________________
ImportError while importing test module '/usr/ports/math/py-py-find-1st/work-py39/py_find_1st-1.1.5/test/test_find_1st.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.9/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
test/test_find_1st.py:5: in <module>
import utf1st_inst_dir.utils_find_1st as utf1st
E ModuleNotFoundError: No module named 'utf1st_inst_dir'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=========================================================================================== 1 error in 0.41s ============================================================================================
Version: 1.1.5
Python-3.9
FreeBSD 13.1
Hello,
I am trying to install the project and I get the error "ERROR: Could not build wheels for py-find-1st which use PEP 517 and cannot be installed directly". I have a macOS and I am trying to install the project in a a conda environment with python 3.8.10. I tried pip install --no-build-isolation py_find_1st which I saw was the solution in a similar case, but unfortunately did not work for me. Could you please help me?
Hello, I've tried to install this extension for quite a bit of time, but I keep falling into the same issue when running the commands in the cmd.
I've asked a lot of people about how to fix it, but I didn't manage to find an answer anywhere.
I'm getting the same error message, whether I run python setup.py build_ext
or python setup.py ìnstall
in the cmd:
D:\Chrome dl\py_find_1st-master>python setup.py build_ext
running build_ext
Traceback (most recent call last):
File "setup.py", line 117, in
zip_safe = False,
File "D:\Anaconda\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "D:\Anaconda\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "D:\Anaconda\lib\distutils\command\build_ext.py", line 338, in run
self.build_extensions()
File "setup.py", line 42, in build_extensions
if compiler_is_clang(self.compiler.compiler):
AttributeError: 'MSVCCompiler' object has no attribute 'compiler'`
D:\Chrome dl\py_find_1st-master>python setup.py install
running install
running bdist_egg
running egg_info
creating py_find_1st.egg-info
writing py_find_1st.egg-info\PKG-INFO
writing dependency_links to py_find_1st.egg-info\dependency_links.txt
writing top-level names to py_find_1st.egg-info\top_level.txt
writing manifest file 'py_find_1st.egg-info\SOURCES.txt'
reading manifest file 'py_find_1st.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'py_find_1st.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\utils_find_1st
copying utils_find_1st_init_.py -> build\lib.win-amd64-3.5\utils_find_1st
running build_ext
Traceback (most recent call last):
File "setup.py", line 117, in
zip_safe = False,
File "D:\Anaconda\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "D:\Anaconda\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "D:\Anaconda\lib\site-packages\setuptools-3.5.1-py3.5.egg\setuptools\command\install.py", line 65, in run
File "D:\Anaconda\lib\site-packages\setuptools-3.5.1-py3.5.egg\setuptools\command\install.py", line 107, in do_egg_install
File "D:\Anaconda\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "D:\Anaconda\lib\site-packages\setuptools-3.5.1-py3.5.egg\setuptools\command\bdist_egg.py", line 157, in run
File "D:\Anaconda\lib\site-packages\setuptools-3.5.1-py3.5.egg\setuptools\command\bdist_egg.py", line 143, in call_command
File "D:\Anaconda\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "D:\Anaconda\lib\site-packages\setuptools-3.5.1-py3.5.egg\setuptools\command\install_lib.py", line 8, in run
File "D:\Anaconda\lib\distutils\command\install_lib.py", line 107, in build
self.run_command('build_ext')
File "D:\Anaconda\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "D:\Anaconda\lib\distutils\command\build_ext.py", line 338, in run
self.build_extensions()
File "setup.py", line 42, in build_extensions
if compiler_is_clang(self.compiler.compiler):
AttributeError: 'MSVCCompiler' object has no attribute 'compiler'
Would you have any idea on how to fix it and manage to install the extension?
I've no knowledge of C++, and noone managed to find a solution, I have visual studio 2017 installed as well as its build tools extension.
I've verified that I installed everything necessary, yet no way to make the installation work.
The extension looks like it has very nice performances, and I hope to be able to use it in the future, any help would be gladly appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.