How to install FLANN and pyflann on Windows - python

How can I setup FLANN on Python (pyflann) on Windows? I know FLANN is now in openCV but I need the standalone version. The instructions here suggest compiling the FLANN binary or downloading a version from PointClouds but I can't use any of these.
I compiled from source but after I tried to run setup.py I got this error:
>
C:\Python27\flann-1.8.4-src\src\python>python setup.py install
running install
running build
running build_py
Traceback (most recent call last):
File "setup.py", line 27, in <module>
package_data={'pyflann.lib': ['libflann.so', 'flann.dll', 'libflann.dll', 'libflann.dylib']},
File "C:\Python27\lib\distutils\core.py", line 152, in setup dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run()
File "C:\Python27\lib\distutils\command\install.py", line 563, in run self.run_command('build')
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run()
File "C:\Python27\lib\distutils\command\build.py", line 127, in run self.run_command(cmd_name)
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 971, in run_command cmd_obj.ensure_finalized()
File "C:\Python27\lib\distutils\cmd.py", line 109, in ensure_finalized self.finalize_options()
File "C:\Python27\lib\distutils\command\build_py.py", line 57, in finalize_options self.data_files = self.get_data_files()
File "C:\Python27\lib\distutils\command\build_py.py", line 117, in get_data_files file[plen:] for file in self.find_data_files(package, src_dir)
File "C:\Python27\lib\distutils\command\build_py.py", line 129, in find_data_files filelist = glob(os.path.join(src_dir, convert_path(pattern)))
File "C:\Python27\lib\ntpath.py", line 96, in join assert len(path) > 0
TypeError: object of type 'NoneType' has no len()
Could anyone help me to solve this or direct me to another version of flann which can I simply install?

Extract the zipped archive to C:\flann-1.8.4-src\.
Open a cmd window as Administrator (right click > Run as Administrator)
Then do the following:
cd C:\flann-1.8.4-src\
mkdir build
cd build
cmake .. -G "NMake Makefiles"
nmake install
The nmake install line should get pyflann installed without needing to call setup.py separately.

Related

Xfoil Manual Setup Through setup.py raise "CMake Error: Error: generator : MinGW Makefiles"

Xfoil Manual Setup Through setup.py raise "CMake Error: Error: generator : MinGW Makefiles"
I have downloaded the python XFOIL library and made some modifications to the API, which is written in Fortran f90, in order to get the thickness attribute, which is calculated in the XFOIL fortran library but not transferred to python through the API, as follows:
function get_thickness() bind(c, name='get_thickness')
use m_xgeom, only: THICK
integer(c_float) :: get_thickness
get_thickness = THICK
end function get_thickness
Since I've made this modification, I have to make the installation manually rather than using pip install.
I tried:
$RepoPath\xfoil-python-master>python setup.py install
But when I try to make the installation with python setup.py install, I get the following error:
running install
$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\command\install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build, pip and other standards-based tools.
setuptools.SetuptoolsDeprecationWarning,
$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\command\easy_install.py:147: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
EasyInstallDeprecationWarning,
running bdist_egg
running egg_info
writing xfoil.egg-info\PKG-INFO
writing dependency_links to xfoil.egg-info\dependency_links.txt
writing requirements to xfoil.egg-info\requires.txt
writing top-level names to xfoil.egg-info\top_level.txt
reading manifest file 'xfoil.egg-info\SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'xfoil.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=$RepoPath\\\xfoil-python-master\\build\\lib.win-amd64-cpython-37\\xfoil', '-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE=build\\temp.win-amd64-cpython-37\\Release', '-DPYTHON_EXECUTABLE=C:\\Users\\kandemir\\Anaconda3\\envs\\py37\\python.exe', '-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE', '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=$RepoPath\\\xfoil-python-master\\build\\lib.win-amd64-cpython-37\\xfoil', '-G', 'MinGW Makefiles']
CMake Error: Error: generator : MinGW Makefiles
Does not match the generator used previously: NMake Makefiles
Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
Traceback (most recent call last):
File "setup.py", line 149, in <module>
zip_safe=False
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
return run_commands(dist)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
dist.run_commands()
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\_distutils\dist.py", line 968, in run_commands
self.run_command(cmd)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\command\install.py", line 74, in run
self.do_egg_install()
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\command\install.py", line 123, in do_egg_install
self.run_command('bdist_egg')
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\_distutils\cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\command\bdist_egg.py", line 165, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\command\bdist_egg.py", line 151, in call_command
self.run_command(cmdname)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\_distutils\cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
self.build()
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\_distutils\command\install_lib.py", line 112, in build
self.run_command('build_ext')
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\_distutils\cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\command\build_ext.py", line 84, in run
_build_ext.run(self)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "$UserPath\Anaconda3\envs\py37\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 346, in run
self.build_extensions()
File "setup.py", line 110, in build_extensions
cwd=self.build_temp)
File "$UserPath\Anaconda3\envs\py37\lib\subprocess.py", line 363, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '$RepoPath\\\xfoil-python-master', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=$RepoPath\\\xfoil-python-master\\build\\lib.win-amd64-cpython-37\\xfoil', '-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE=build\\temp.win-amd64-cpython-37\\Release', '-DPYTHON_EXECUTABLE=C:\\Users\\kandemir\\Anaconda3\\envs\\py37\\python.exe', '-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE', '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=$RepoPath\\\xfoil-python-master\\build\\lib.win-amd64-cpython-37\\xfoil', '-G', 'MinGW Makefiles']' returned non-zero exit status 1.
Could you please help me to find the solution to that?

Installing numpy in PyCharm on windows 10

I'm using Python 3.8 and I'm trying to install numpy on PyCharm 2019.2 but I keep having this error.
I have been told that there are problems in pythons 3.8 and that is why I can't install numpy.
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
failure.
removing: _configtest.c _configtest.obj _configtest.obj.d
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\hp\AppData\Local\Temp\pycharm-packaging\numpy\setup.py", line 444, in <module>
setup_package()
File "C:\Users\hp\AppData\Local\Temp\pycharm-packaging\numpy\setup.py", line 436, in setup_package
setup(**metadata)
File "C:\Users\hp\AppData\Local\Temp\pycharm-packaging\numpy\numpy\distutils\core.py", line 171, in setup
return old_setup(**new_attr)
File "C:\Users\hp\PycharmProjects\untitled\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\__init__.py", line 145, in setup
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\hp\AppData\Local\Temp\pycharm-packaging\numpy\numpy\distutils\command\install.py", line 62, in run
r = self.setuptools_run()
File "C:\Users\hp\AppData\Local\Temp\pycharm-packaging\numpy\numpy\distutils\command\install.py", line 36, in setuptools_run
return distutils_install.run(self)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\hp\AppData\Local\Temp\pycharm-packaging\numpy\numpy\distutils\command\build.py", line 47, in run
old_build.run(self)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\hp\AppData\Local\Temp\pycharm-packaging\numpy\numpy\distutils\command\build_src.py", line 142, in run
self.build_sources()
File "C:\Users\hp\AppData\Local\Temp\pycharm-packaging\numpy\numpy\distutils\command\build_src.py", line 153, in build_sources
self.build_library_sources(*libname_info)
File "C:\Users\hp\AppData\Local\Temp\pycharm-packaging\numpy\numpy\distutils\command\build_src.py", line 286, in build_library_sources
sources = self.generate_sources(sources, (lib_name, build_info))
File "C:\Users\hp\AppData\Local\Temp\pycharm-packaging\numpy\numpy\distutils\command\build_src.py", line 369, in generate_sources
source = func(extension, build_dir)
File "numpy\core\setup.py", line 669, in get_mathlib_info
raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program
Create a new project and virtual environment in PyCharm. Then try downgrading your python to 3.7.2 and uninstall then reinstall numpy through the project settings in pycharm. In your python or bash terminal run,
conda install python == 3.7.2
If you don't have Anaconda Distribution downloaded then navigate to the "Project Interpreter" in PyCharm and you can install/uninstall libraries directly from there with the plus and minus icon. I think you may have a underlying system problem so going for a fresh install of the dependencies you are having issues with should remedy the problem along with stepping away from version 3.8 of Python.

How can I solve the import error for the module util while running cx_Freeze?

I have Python version 2.7, cx_freeze version 5.0 and Ubuntu 16.04.
On running the command python2 setup.py buildin the requisite directory, I am getting the following error:
running build
running build_exe
Traceback (most recent call last):
File "setup.py", line 39, in <module>
executables = executables
File "/usr/lib/python2.7/dist-packages/cx_Freeze/dist.py", line 349, in setup
distutils.core.setup(**attrs)
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 "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
self.run_command(cmd_name)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/cx_Freeze/dist.py", line 219, in run
freezer.Freeze()
File "/usr/lib/python2.7/dist-packages/cx_Freeze/freezer.py", line 618, in Freeze
import cx_Freeze.util
ImportError: No module named util
cx_freeze has its source code here and here. I thought of downloading the util file to the cx_freeze folder on my local machine but neither did I get it nor am I sure of the validness of this method.
So, how do I solve this issue ?

Installing RPy2 from source files on Windows 7

I am trying to install rpy2-2.3.1 on Windows 7, using the source files under rpy2-2.3.1.tar.gz.
However, upon running setup.py on the command prompt, I get the trace-back below. I have checked a few stack-overflow posts on installing RPy2 on windows 7 and am already aware that it is a challenge. Does anyone have an idea what went wrong in my case?
Thanks in advance.
P.S: I cannot install it using the .exe since I get the 'Python version 2.7. required, which was not found in the registry' warning and do not have privileges to update the registry. So it is not an option for me.
P.S2: Before I started getting this trace-back I set up the R path as: C:\Program Files\R\R-3.01\bin. This I believe points to a 64-bit R. May this be causing the problem?
I:\Documents\Visual Studio 2010\Projects\MyProject\rpy2-2.3.1>C:/Python27/python.exe setup.py install
running install
running build
running build_py
running build_ext
Traceback (most recent call last):
File "setup.py", line 463, in <module>
'rpy2': ['doc/source/rpy2_logo.png', ]}
File "C:\u\windows\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\u\windows\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\u\windows\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\u\windows\Python27\lib\distutils\command\install.py", line 563, in run
self.run_command('build')
File "C:\u\windows\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\u\windows\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\u\windows\Python27\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\u\windows\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\u\windows\Python27\lib\distutils\dist.py", line 971, in run_command
cmd_obj.ensure_finalized()
File "C:\u\windows\Python27\lib\distutils\cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "setup.py", line 163, in finalize_options
config += get_rconfig(r_home, about)
File "setup.py", line 333, in get_rconfig
rc = RConfig.from_string(rconfig, allow_empty = allow_empty)
File "setup.py", line 293, in from_string
+ '\nin string\n' + string)
ValueError: Invalid substring
in string
This site has what you are looking for. It has a lot of good modules in .exe format:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2

getting "error: Unable to find vcvarsall.bat" then "RuntimeError: autoconf error" trying to install pycrypto on windows

After googling around, I found most answers say: install mingw, then use "setup.py install build --compiler=mingw32" to install. This is what I get:
C:\Users\Joe\Desktop\pycrypto-2.6>setup.py install build --compiler=mingw32
running install
running build
running build_py
running build_ext
running build_configure
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/cygdrive/c/Users/Joe/Desktop/pycrypto-2.6':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
Traceback (most recent call last):
File "C:\Users\Joe\Desktop\pycrypto-2.6\setup.py", line 456, in <module>
core.setup(**kw)
File "C:\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\distutils\command\install.py", line 563, in run
self.run_command('build')
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Users\Joe\Desktop\pycrypto-2.6\setup.py", line 251, in run
self.run_command(cmd_name)
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Users\Joe\Desktop\pycrypto-2.6\setup.py", line 278, in run
raise RuntimeError("autoconf error")
RuntimeError: autoconf error
I've also tried install pycrypto using the prebuilt binaries for windows from www.voidspace.org.uk
The vcvarsall.bat file contains instructions for choosing the appropriate Microsoft C compiler for your machine. Since you do not have that file you have correctly attempted to install and use another compiler, MinGW.
The only step you are missing is to add the location of the MinGW compiler to your PATH environment variable. Please see the accepted answer to the following question for detailed instructions: How do I add the MinGW bin directory to my system path?

Categories

Resources