f2py: limit.h file missing in numpy in Windows - numpy

I’m having trouble compiling some FortranIV code using f2py and the g77 compiler. I need to do this to call some very old code written in Fortran to an already existing Python module. I have gcc installed through MinGW but I’m not sure if that makes any difference. I am also running Python 2.7 with Numpy 1.7 and SciPy 0.12. My OS is Windows7 x64 but I have made sure that all my installs are 32bit versions. I am new to Python, Fortran and this forum so please bear with me.
The error I am getting when I compile the code with f2py is as follows:
C:\Python27\lib\site-packages\numpy\core\include\numpy\npy_common.h:291: limits.h: No such file or directory
error: Command "gcc -mno-cygwin -mdll -O2 -w -Wstrict-prototypes - DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 - Ic:\users\ncd69~1.boh\appdata\local\temp\tmpxbl4sc\src.win32-2.7 -IC:\Python27\lib\site- packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC - c:\users\ncd69~1.boh\appdata\local\temp\tmpxbl4sc\src.win32-2.7\hellomodule.c -o c:\users\ncd69~1.boh\appdata\local\temp\tmpxbl4sc\Release\users\ncd69~1.boh\appdata\local\temp\tmpxbl4sc\src.win32-2.7\hellomodule.o" failed with exit status 1
In order to isolate the problem I have used a test code that is compatible with the gfortran compiler. I make a call to the required compilers using ‘-c –compiler. The test is on the same lines as your basic ‘Hello World’. The error thrown up is identical for the real and test code. I looked up the erroneous file ‘npy_common.h’ and found that line 291 calls to include a header: limits.h.
Since the error occurs in the Numpy libraries I am assuming that the error is with Numpy? I can’t seem to figure out why this error would occur.

Related

Library not loaded: #rpath/libtbb.dylib in Prophet / Python

I'm on a Mac X1, Monterey.
I've installed prophet and run into this issue when trying to fit a model.
RuntimeError: Error during optimization: console log output:
dyld[90668]: Library not loaded: #rpath/libtbb.dylib
Referenced from: /Users/{username}/opt/anaconda3/lib/python3.9/site-packages/prophet/stan_model/prophet_model.bin
Reason: tried: '/private/var/folders/cd/dfrqgp4s4ll55cwb7rtgccbw0000gq/T/pip-install-rjpuj450/prophet_d7e4cce10e414c89a572fe3605ae9269/build/lib.macosx-11.1-arm64-cpython-39/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib' (no such file), '/private/var/folders/cd/dfrqgp4s4ll55cwb7rtgccbw0000gq/T/pip-install-rjpuj450/prophet_d7e4cce10e414c89a572fe3605ae9269/build/lib.macosx-11.1-arm64-cpython-39/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib' (no such file), '/usr/local/lib/libtbb.dylib' (no such file), '/usr/lib/libtbb.dylib' (no such file)
I know this has to do with the wrong paths being searched. I can find the dylib in
/Users/{user}/opt/anaconda3/lib/python3.9/site-packages/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/
But, it seems prophet doesn't know to look there. I'm curious how I can update/fix either the rpath variable or find another solution?
I tried to create a symbolic link with sudo ln -s, but don't have permissions on the laptop.
TIA!
I got it to work on Apple Silicon (M1 Max in my case) by installing older versions of both pystan and prophet:
pip install pystan==2.19.1.1
pip install prophet==1.0
The other important piece of the puzzle is that you should use Python 3.8 to get it working.
Installing older versions of the libraries and using Python 3.8 are both talked about in issue #2002 on Github, but there's not really an explanation of the libtbb.dylib error message.

Make77 error while installing Darknet on Windows

I am facing the Make77 problem. Can somebody help me out?
mingw32-make
gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast obj/captcha.o obj/lsd.o obj/super.o obj/art.o obj/tag.o obj/cifar.o obj/go.o obj/rnn.o obj/segmenter.o obj/regressor.o obj/classifier.o obj/coco.o obj/yolo.o obj/detector.o obj/nightmare.o obj/instance-segmenter.o obj/darknet.o libdarknet.a -o darknet -lm -pthread libdarknet.a
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: obj/go.o:go.c:(.text+0x329f): undefined reference to `__WSAFDIsSet#8'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: obj/go.o:go.c:(.text+0x32e1): undefined reference to `select#20'
collect2.exe: error: ld returned 1 exit status
Makefile:77: recipe for target 'darknet' failed
mingw32-make: *** [darknet] Error 1
I was in your shoes a few weeks ago and managed to fix that.
I am confident, you are trying to compile the original repository of Darknet on a Windows machine.
Cause
Unfortunately, one of the libraries used in go.c is *nix-only. It has a counterpart in Windows called winsock.h, but apparently it is not enough and the problem still persists.
Solution
Instead what you should do is use another repo of Darknet which is ported to Windows properly and has a lot of support. It has exactly the same functionality as the original repo except for very little changes which only makes the framework better. Instead of compiling with make command, you should build it with Microsoft Visual Studio. You may go with the latest version of MVS. If you want to use a GPU and install correctly, make sure you follow the instructions here https://github.com/AlexeyAB/darknet#requirements . To avoid any weird errors, install the requirements in order.
When all requirements are installed, navigate to build/darknet and open darknet.sln. Switch to Release and x64 and build the project.
That should be it. If you have any issues, let me know so I can help you. Also, if this solution works for you, make sure to mark my reply as the best answer.

Python 3.7 + Visual Studio 2107 + boost 1.69

I am trying to get boost 1.69 working with visual studio 2107. My goal is to use Numpy in C++
When I include #include boost/python/numpy.hpp
The error I am getting is:
Searching C:\boost_1_69_0\stage\lib\boost_python37-vc141-mt-gd-x32-1_69.lib:
1>LINK : fatal error LNK1104: cannot open file 'boost_numpy37-vc141-mt-gd-x32-1_69.lib'
I am pretty sure that I have this file in this directory.
My architucture in the project is x86, 32-bit addrressing
I built boost as follows:
.\bbotstarp.bat
.\b2 -j8 --toolset=msvc-14.1 --build-type=complete link=static runtime-link=static architecture=x86 address-model=32 stage --with-python
I added the include and link folders to the project.
I do not use precompiled headers
Is there anything that I am missing?
Thanks
I had the same problem. It seems like Boost python is not supported by python 3.7 vert well.
Using python 3.6 will solve this problem.
I have been looking at this issue for months and finally figure out the root cause and solutions. The root cause that boost numpy is not built is because numpy is unable to be imported when ./b2 checks for numpy. As a clue from this post Using boost numpy with visual studio 2019 and python 3.8, you can append --debug-configuration to see the debugging information of boost python building process like this in my PC
notice: [python-cfg] Checking for NumPy...
notice: [python-cfg] running command 'C:/Anaconda3_Install_Root/envs/my_envs/python -c "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())"'
And, the error comes from ImportError for some reason:
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
After looking at this post numpy is already installed with Anaconda but I get an ImportError (DLL load failed: The specified module could not be found), I found this import process has to be under python environment such as under conda environment or PyCharm terminal (They both work in my PC) with all the required PATH to be imported. Now I can generate numpy static library with Python 3.8, VS 2019, boost v1.74, Windows 10. The command I use to build boost python is .\b2 --with-python python-debugging=off threading=multi variant=release li
nk=static address-model=64 stage --debug-configuration. Hopefully, that will work in yours.

How to use pyinstaller generate a pyqt5 sotfware?

I'm using pyinstaller to generate a executable pyqt5 software in ubuntu 16.04,but i got some trouble,how do i fix it?
My os is Ubuntu16.04LTS,and python version is anconda3 python3.6.5,
my pyqt5 is using pip to install,which show in pip list is 5.11.3,and qmake version is 3.1.
I add the anconda's lib dir into my LD_LIBRARY_PATH(if not,when i run pyinstaller myfile.py it shows "TypeError: expected str, bytes or os.PathLike object, not NoneType"),and i can successfully get my executable pyqt5 software.
BUT,when i run my executable app,something goes wrong,which is
what should i do?Thanks a lot for your help!
ImportError: /home/kanghao/dabao/dist/train_tool/libQt5Core.so.5:
version `Qt_5.11' not found (required by
/home/kanghao/dabao/dist/train_tool/PyQt5/QtCore.so) [11591] Failed to
execute script train_tool
my code is in webpage:https://blog.csdn.net/yourgreatfather/article/details/85063787
I expect my code can become a executable sotfware.

Not getting TBB to compile test examples

I am not getting TBB to work. I am following the steps in the "Getting started" document.
I am doing the following steps:
downloading the linux files + the sources files.
extracting them in 1 directory
calling make
going to tbb.../bin calling source tbbvars.sh intel64
going to examples/Getting_started/sub_string_finder
calling make
I then get the error:
sub_string_finder.cpp:32:30: fatal error: tbb/parallel_for.h: No such file or directory
I really googled a lot but can't find any related stuff.
I did also try to add some -I statement but it didnt help
I assume it is kind of a including/linking problem but I dont know how to fix.
This is all done on fedora 16 64bit. (kernel 3.1.4) // TBB version 4.0
The solution was to install tbb-devel package.