pygsl / pygsl

GNU General Public License v2.0
24 stars 8 forks source link

Setup config error (Windows) #35

Open 2u3rn opened 9 months ago

2u3rn commented 9 months ago

I have Windows 10 (64bit), Visual Studio 2019, Python 3.10. I have installed MSYS2 (C:\msys64). I have installed numpy-1.25.2 and gsl-2.7.1 in virtual environment. I unpacked 'pygsl-2.3.3.tar.gz' in C:\Projects\GSL2. I created 'gsl_site.py' in 'gsl_dist' folder:

prefix = os.path.join("C:\", "msys64", "usr") cflags = "-g -I" + os.path.join(prefix, "include") libs = "-L" + os.path.join(prefix, "lib")+ " -lgsl -lgslcblas -lm" version = "2.7" swig = os.path.join("C:\", "swigwin-4.1.1", "swig")

In Mingw64 command line I try to install pygsl. I type python setup.py config --compiler=mingw32 and have an error:

Traceback (most recent call last): ... File "C:\python310\lib\distutils\cygwinccompiler.py", line 84, in get_msvcr raise ValueError("Unknown MS Compiler version %s " % msc_ver) ValueError: Unknown MS Compiler version 1929

I apply patch for 'cygwinccompiler.py':

... elif msc_ver == '1700':

Visual Studio 2012 / Visual C++ 11.0

return ['msvcr110'] elif msc_ver == '1800':

Visual Studio 2013 / Visual C++ 12.0

return ['msvcr120'] elif msc_ver == '1900':

Visual Studio 2015 / Visual C++ 14.0

"msvcr140.dll no longer exists" http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx

return ['vcruntime140'] elif msc_ver == '1929': return ['vcruntime140'] else:

to do: can we make this futureproof?

raise ValueError("Unknown MS Compiler version %s " % msc_ver) ...

Setup config results an error:

<swig_extension.SWIG_Extension('__callback') at 0x1b0ff9b2650> Building testing ufuncs!

31 extension modules

running config dllwrap: WARNING: dllwrap is deprecated, use gcc -shared or ld -shared instead Looking for python310.dll INFO: Building import library (arch=AMD64): "C:\Projects\GSL2\venv\libs\libpython310.a" (from C:\python310\python310.dll) error: [Errno 2] No such file or directory: 'C:\Projects\GSL2\venv\libs\python310.def'

I copy 'python3.lib', 'python310.lib' and '_tkinter.lib' from C:\python310\libs to venv\libs in virtual environment. Setup config results an error:

Traceback (most recent call last): ... File "C:\python310\lib\distutils\unixccompiler.py", line 90, in preprocess pp_args = self.preprocessor + pp_opts TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'

In 'unixcompiler.py' I replaced the line

pp_args = self.preprocessor + pp_opts

with

pp_args = pp_opts pp_args.insert(0, self.preprocessor)

Setup config results an error:

Traceback (most recent call last): ... File "C:\Projects\GSL2\venv\lib\site-packages\numpy\distutils\ccompiler.py", line 141, in CCompiler_spawn display = ' '.join(list(display)) TypeError: sequence item 0: expected str instance, NoneType found display: [None, '-D__MSVCRT_VERSION__=0x1929', '-IC:\msys64\mingw64\include', '-o', '_configtest.i', '_configtest.c']

In 'ccompiler.py' I add the clause before join:

... if display[0] == None: display.remove(None)

I have errors:

... INFO: C compiler: gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes INFO: compile options: '-DMSVCRT_VERSION__=0x1929 -IC:\msys64\mingw64\include -c' INFO: gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -DMSVCRT_VERSION=0x1929 -IC:\msys64\mingw64\include -c _configtest.c -o _configtest.o _configtest.c:3:5: warning: function declaration isn't a prototype [-Wstrict-prototypes] INFO: gcc -g _configtest.o -LC:\msys64\mingw64\lib -lgsl -lgslcblas -lm -o _configtest.exe success! removing: _configtest.c _configtest.o _configtest.exe INFO: -DMSVCRT_VERSION=0x1929 -IC:\msys64\mingw64\include -o _configtest.i _configtest.c [WinError 2] The system cannot find the file specified removing: _configtest.c _configtest.i INFO: -DMSVCRT_VERSION=0x1929 -IC:\msys64\mingw64\include -o _configtest.i _configtest.c [WinError 2] The system cannot find the file specified removing: _configtest.c _configtest.i INFO: -DMSVCRT_VERSION=0x1929 -IC:\msys64\mingw64\include -o _configtest.i _configtest.c [WinError 2] The system cannot find the file specified removing: _configtest.c _configtest.i INFO: -DMSVCRT_VERSION__=0x1929 -IC:\msys64\mingw64\include -o _configtest.i _configtest.c [WinError 2] The system cannot find the file specified removing: _configtest.c _configtest.i ...

How can I overcome this and install pygsl?

PierreSchnizer commented 9 months ago

Thanks for all your effort and reporting on the steps. I am not using windows any more since long nor do I have access to an installation.

I will go over your report and try to give some advice.

Sincerely yours

Pierre

--------------------Ursprüngliche Nachricht--------------------
Von: 2u3rn ***@***.***>
Gesendet: Dienstag 28. November 2023 21:01
An: pygsl/pygsl ***@***.***>
CC: Subscribed ***@***.***>
Betreff: [pygsl/pygsl] Setup config error (Windows) (Issue #35)

I have Windows 10 (64bit), Visual Studio 2019, Python 3.10. I have
installed MSYS2 (C:\msys64). I have installed numpy-1.25.2 and gsl-2.7.1 in
virtual environment. I unpacked 'pygsl-2.3.3.tar.gz' in C:\Projects\GSL2. I
created 'gsl_site.py' in 'gsl_dist' folder:

    prefix = os.path.join("C:\", "msys64", "usr")
    cflags = "-g -I" + os.path.join(prefix, "include")
    libs = "-L" + os.path.join(prefix, "lib")+ " -lgsl -lgslcblas -lm"
    version = "2.7"
    swig = os.path.join("C:\", "swigwin-4.1.1", "swig")

In Mingw64 command line I try to install pygsl. I type python setup.py
config --compiler=mingw32 and have an error:

    Traceback (most recent call last):
    ..
    tFile "C:\python310\lib\distutils\cygwinccompiler.py", line 84, in
    get_msvcr
    raise ValueError("Unknown MS Compiler version %s " % msc_ver)
    ValueError: Unknown MS Compiler version 1929

I apply patch for 'cygwinccompiler.py':

    ...
    elif msc_ver == '1700':
    # Visual Studio 2012 / Visual C++ 11.0
    return ['msvcr110']
    elif msc_ver == '1800':
    # Visual Studio 2013 / Visual C++ 12.0
    return ['msvcr120']
    elif msc_ver == '1900':
    # Visual Studio 2015 / Visual C++ 14.0
    # "msvcr140.dll no longer exists" http://blogs.msdn.com/b/vcblog/
    archive/2014/06/03/visual-studio-14-ctp.aspx
    return ['vcruntime140']
    elif msc_ver == '1929':
    return ['vcruntime140']
    else:
    #to do: can we make this futureproof?
    raise ValueError("Unknown MS Compiler version %s " % msc_ver)
    ..

    e

Setup config results an error:

    <swig_extension.SWIG_Extension('__callback') at 0x1b0ff9b2650>
    Building testing ufuncs!
    #31 extension modules
    running config
    dllwrap: WARNING: dllwrap is deprecated, use gcc -shared or ld -shared
    instead
    Looking for python310.dll
    INFO: Building import library (arch=AMD64): "C:\Projects\GSL2\venv\libs
    \libpython310.a" (from C:\python310\python310.dll)
    error: [Errno 2] No such file or directory: 'C:\Projects\GSL2\venv\libs
    \python310.def'

I copy 'python3.lib', 'python310.lib' and '_tkinter.lib' from C:\python310\
libs to venv\libs in virtual environment. Setup config results an error:

    Traceback (most recent call last):
    ..
    tFile "C:\python310\lib\distutils\unixccompiler.py", line 90, in
    preprocess
    pp_args = self.preprocessor + pp_opts
    TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'

In 'unixcompiler.py' I replaced the line

    pp_args = self.preprocessor + pp_opts

with

    pp_args = pp_opts
    pp_args.insert(0, self.preprocessor)

Setup config results an error:

    Traceback (most recent call last):
    ..
    tFile "C:\Projects\GSL2\venv\lib\site-packages\numpy\distutils\
    ccompiler.py", line 141, in CCompiler_spawn
    display = ' '.join(list(display))
    TypeError: sequence item 0: expected str instance, NoneType found
    display: [None, '-D__MSVCRT_VERSION__=0x1929', '-IC:\msys64\mingw64\
    include', '-o', '_configtest.i', '_configtest.c']

In 'ccompiler.py' I add the clause before join:

    ...
    if display[0] == None:
    display.remove(None)

I have errors:

    ...
    INFO: C compiler: gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall
    -Wstrict-prototypes
    INFO: compile options: '-D__MSVCRT_VERSION__=0x1929 -IC:\msys64\mingw64
    \include -c'
    INFO: gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes
    -D__MSVCRT_VERSION__=0x1929 -IC:\msys64\mingw64\include -c
    _configtest.c -o _configtest.o
    _configtest.c:3:5: warning: function declaration isn't a prototype
    [-Wstrict-prototypes]
    INFO: gcc -g _configtest.o -LC:\msys64\mingw64\lib -lgsl -lgslcblas -lm
    -o _configtest.exe
    success!
    removing: _configtest.c configtest.o configtest.exe
    INFO: -D__MSVCRT_VERSION=0x1929 -IC:\msys64\mingw64\include -o
    _configtest.i _configtest.c
    [WinError 2] The system cannot find the file specified
    removing: configtest.c configtest.i
    INFO: -D__MSVCRT_VERSION=0x1929 -IC:\msys64\mingw64\include -o
    _configtest.i _configtest.c
    [WinError 2] The system cannot find the file specified
    removing: configtest.c configtest.i
    INFO: -D__MSVCRT_VERSION=0x1929 -IC:\msys64\mingw64\include -o
    _configtest.i _configtest.c
    [WinError 2] The system cannot find the file specified
    removing: configtest.c configtest.i
    INFO: -D__MSVCRT_VERSION=0x1929 -IC:\msys64\mingw64\include -o
    _configtest.i _configtest.c
    [WinError 2] The system cannot find the file specified
    removing: _configtest.c _configtest.i
    ..

    _

How can I overcome this and install pygsl?

—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>