Code Monkey home page Code Monkey logo

pygsl's Introduction

PyGSL: Python interface for GNU Scientific Library

PyGSL is a Python wrapper for the GNU Scientific Library (GSL). Nearly all modules are wrapped. A lot of tests are covering various functionality.

Please report it as a Github Issue if you find a bug. We are looking forward to contributions of new submodules, while maintaining the available code, and welcome pull requests.

PyGSL moved from Sourceforge to GitHub in 2021.

Requirements

To build the interface, you will need

Installing PyGSL

Installing from a release archive

First, uninstall old versions of PyGSL. gsl-config must be on your path.

Make sure that the Python package wheel is installed:

pip install wheel

It is needed by the PyGSL installer.

You can download a .tar.gz file of the latest PyGSL release at https://github.com/pygsl/pygsl/releases. Then run:

tar -xvzf pygsl-x.y.z.tar.gz
cd pygsl-x.y.z
python setup.py gsl_wrappers
python setup.py config
sudo python setup.py install

This will install PyGSL system-wide; for a local install that does not require superuser privileges, specify an installation prefix, for example --prefix=/home/work/.local.

To set the GSL location explicitly, use the argument --gsl-prefix=/path/to/gsl.

PyGSL is installed to the Python packages path, and can be uninstalled by typing:

rm -r <python install path>/lib/python<version>/site-packages/pygsl

Installation via PyPI

PyGSL can also be installed using the pip package installer. SWIG is required to be installed and can usually be found via your distribution's package manager (for example, apt install swig).

To install PyGSL from PyPI, simply type:

pip install pygsl

To remove PyGSL, use:

pip uninstall pygsl

Using PyGSL

Do NOT test the interface in the distribution root directory! -- please install it first and then change to the tests directory and execute python run_test.py. If you want to execute it in the distribution root directory, please run python setup.py build_ext -i first! It will put the required binary files into the pygsl directory.

Just write in Python

import pygsl.sf
print("%g+/-%g"%pygsl.sf.erf(1))

or

import pygsl.rng
rng=pygsl.rng.rng()
print rng.gaussian(1.0)

You may set the environment variable LD_LIBRARY_PATH to find the gsl shared object.

Supported Platforms

  • Linux with Python 3.x and GSL 2.x
  • Mac OS X with Python 3.x and GSL 2.x
  • Win32 with Python 3.x and GSL 2.x

but is supposed to compile and run on any posix platform.

Currently it is being tested using GitHub Actions continuous integration on:

  • Python 3.8, numpy-latest and GSL 2.7.1 under Ubuntu Linux 22.04.2.

Testing

The directory test will contain several testsuites, based on Python unittest. Change to this directory to run the tests.

What is implemented (versus GSL 2.1):

  • Blas
  • BSplines
  • Chebyshev
  • Combination
  • Const
  • Diff
  • Eigen
  • Fit
  • Ieee
  • Integrate
  • Interpolation
  • Interpolation2D
  • Linalg
  • Math
  • Minimize
  • Multifit
  • Multifit_nlin
  • Multimin
  • Multiroots
  • Odeiv
  • Permutation
  • Poly
  • Qrng
  • Rng
  • Roots
  • Siman
  • Sf
  • Spline
  • Statistics

What is not implemented yet (versus GSL 1.10)

  • GSL Capabilites not yet wrapped by PyGSL

    • Sorting
    • N-tuples
  • GSL Capabilites partly implemented

    • Discrete Hankel Transforms

See also the TODO file in the distribution.

For the exact function volume for a module, please type:

import pygsl.sf
dir(pygsl.sf)

You can do this with the other modules, too. The naming scheme is the same as in GSL.

Documentation

The function reference can be found in the docstrings and at the gsl-reference.

Written documentation can be found in the doc/ref directory.

See also the examples directory.

Support

Support requests and all other questions should be submitted as a GitHub Issue.

Developement

You can browse our git repository.

If you want to contribute to PyGSL, please fork the repository and create a pull request.

The script tools/extract_tool.py generates most of the special function code.

History

A GSL interface for Python was needed for a project at Center for applied informatics Cologne.

pygsl-0.0.3 was released on May 23, 2001.

Thanks

  • Charl Linssen for continous integration
  • Jochen Küpper for pygsl.statistics
  • Fabian Jakobs for pygsl.blas, pygsl.eigen, pygsl.linalg and pygsl.permutation
  • Leonardo Milano for rpm build support and test
  • Eric Gurrola and Peter Stoltz for testing and supporting the port of pygsl to the MAC
  • Sebastien Maret for supporting the Fink http://fink.sourceforge.net port of pygsl.
  • Michael Forbes for Series Acceleration
  • and all for support by providing feed back on testing or showing by email that the code is useful for them

Maintainers

PyGSL is currently maintained by Achim Gaedke, Pierre Schnizer and Charl Linssen.

pygsl's People

Contributors

clinssen avatar jamesjer avatar pierreschnizer avatar sergeiossokine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pygsl's Issues

Starter in this

I attempted to install pygsl on my mac. I followed the installation steps and at the end where i had to write in python include pygsl.sf it gave me an "no module named pygsl.sf". I know I am doing something wrong but cannot figure it out. It would be nice if anyone could help me.

Remove dependency on `numpy.distutils` since it is deprecated and it will be removed from numpy

The work being done here is in order to prepare for Python 3.13 in Fedora.

https://numpy.org/doc/stable/reference/distutils_status_migration.html#distutils-status-migration

There is a failure in Fedora 40 due to

+ /usr/bin/python3 setup.py gsl_wrappers
/builddir/build/BUILD/pygsl-2.3.3/gsl_dist/gsl_Location.py:63: SyntaxWarning: invalid escape sequence '\.'
  return re.split('\.',version)
Traceback (most recent call last):
  File "/builddir/build/BUILD/pygsl-2.3.3/gsl_dist/gsl_Extension.py", line 25, in <module>
    from array_includes import array_include_dirs
  File "/builddir/build/BUILD/pygsl-2.3.3/gsl_dist/array_includes.py", line 7, in <module>
    from numpy.distutils.misc_util import get_numpy_include_dirs
ModuleNotFoundError: No module named 'numpy.distutils'

https://numpy.org/doc/stable/reference/distutils_status_migration.html#distutils-status-migration

This can be easily solved since pygsl only uses a single call that has a direct equivalent in numpy:

-array_include_dirs = []
-from numpy.distutils.misc_util import get_numpy_include_dirs
-array_include_dirs = get_numpy_include_dirs()
+import numpy
+array_include_dirs = [ numpy.get_include() ]

I can't install using pip "ModuleNotFoundError: No module named 'gsl_site'"

`Traceback (most recent call last):
File "E:\pygsl-2.3.3\gsl_dist\gsl_Location.py", line 141, in init
import gsl_site
ModuleNotFoundError: No module named 'gsl_site'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:\pygsl-2.3.3\setup.py", line 99, in
from gsl_Extension import gsl_Extension
File "E:\pygsl-2.3.3\gsl_dist\gsl_Extension.py", line 22, in
from gsl_Location import gsl_Location
File "E:\pygsl-2.3.3\gsl_dist\gsl_Location.py", line 160, in
gsl_Location = _gsl_Location_file()
File "E:\pygsl-2.3.3\gsl_dist\gsl_Location.py", line 148, in init
raise DistutilsExecError(msg % des)
distutils.errors.DistutilsExecError: I do not know how to run gsl-config
on this system. Therefore you must provide me with the information
where to find the GSL library. I could not import `gsl_site'.
Reason: No module named 'gsl_site'. Copy gsl_site_example.py to gsl_site.py.
Edit the variables in that file to reflect your installation.

(rcop) E:\pygsl-2.3.3>python setup.py install
Traceback (most recent call last):
File "E:\pygsl-2.3.3\gsl_dist\gsl_Location.py", line 141, in init
import gsl_site
ModuleNotFoundError: No module named 'gsl_site'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:\pygsl-2.3.3\setup.py", line 99, in
from gsl_Extension import gsl_Extension
File "E:\pygsl-2.3.3\gsl_dist\gsl_Extension.py", line 22, in
from gsl_Location import gsl_Location
File "E:\pygsl-2.3.3\gsl_dist\gsl_Location.py", line 160, in
gsl_Location = _gsl_Location_file()
File "E:\pygsl-2.3.3\gsl_dist\gsl_Location.py", line 148, in init
raise DistutilsExecError(msg % des)
distutils.errors.DistutilsExecError: I do not know how to run gsl-config
on this system. Therefore you must provide me with the information
where to find the GSL library. I could not import gsl_site'. Reason: No module named 'gsl_site'. Copy gsl_site_example.py to gsl_site.py. Edit the variables in that file to reflect your installation.

Move GSL "special functions" out of ``testing`` module

See #11.

[...] Achim originally implemented the module sf. I started way back (15 years ago or so) to implement these functions as Numeric/numarray/numpy universal functions.

I started to implement them as testing ones ...
I think fpr the next major release these should be shifted over to pygsl.sf ...

Module not found pygsl.errno

import pygsl.errno
ModuleNotFoundError: No module named 'pygsl.errno'

Version: PyGSL 2.3.3
Platform: Ubuntu 18.04

test.py
import pygsl.sf
print("%g+/-%g"%pygsl.sf.erf(1))

Installing from PyPI requires swig

In order to get python -m pip install pygsl (as shown in README.rst) to work, I had to install swig first. A note about the swig dependency could be helpful there.

siman.py invalid import

Hi,

I think a problem was introduced in this commit..

from abc import abstractmethod, abcmeta

abcmeta does not exist and I'm guessing it should be replaced by ABCMeta.

Thanks !

Failure to compile with gcc 14

This report comes from trying to build a package for the Python 3.13 in Fedora:

Trying to compile this with gcc 14 I get these errors:

  swig_src/odeiv2_wrap.c:4336:66: error: passing argument 2 of ‘_pygsl_odeiv2_check_step_jacobian’ from incompatible pointer type [-Wincompatible-pointer-types]
   4336 |                 status = _pygsl_odeiv2_check_step_jacobian(step, &sys->dydt);
        |                                                                  ^~~~~~~~~~
        |                                                                  |
        |                                                                  const gsl_odeiv2_system *
  swig_src/odeiv2_wrap.c:3548:104: note: expected ‘const pygsl_odeiv2_system *’ but argument is of type ‘const gsl_odeiv2_system *’
   3548 | static int _pygsl_odeiv2_check_step_jacobian(const pygsl_odeiv2_step *step, const pygsl_odeiv2_system *sys)
        |                                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
  swig_src/odeiv2_wrap.c: In function ‘pygsl_odeiv2_driver_apply_fixed_step’:
  swig_src/odeiv2_wrap.c:4513:89: error: passing argument 2 of ‘_pygsl_odeiv2_check_step_jacobian’ from incompatible pointer type [-Wincompatible-pointer-types]
   4513 |                 status = _pygsl_odeiv2_check_step_jacobian(self->driver->s, self->driver->sys);
        |                                                                             ~~~~~~~~~~~~^~~~~
        |                                                                                         |
        |                                                                                         const gsl_odeiv2_system *
  swig_src/odeiv2_wrap.c:3548:104: note: expected ‘const pygsl_odeiv2_system *’ but argument is of type ‘const gsl_odeiv2_system *’
   3548 | static int _pygsl_odeiv2_check_step_jacobian(const pygsl_odeiv2_step *step, const pygsl_odeiv2_system *sys)
        |                                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
  swig_src/odeiv2_wrap.c: In function ‘pygsl_odeiv2_driver_apply’:
  swig_src/odeiv2_wrap.c:4554:89: error: passing argument 2 of ‘_pygsl_odeiv2_check_step_jacobian’ from incompatible pointer type [-Wincompatible-pointer-types]
   4554 |                 status = _pygsl_odeiv2_check_step_jacobian(self->driver->s, self->driver->sys);
        |                                                                             ~~~~~~~~~~~~^~~~~
        |                                                                                         |
        |                                                                                         const gsl_odeiv2_system *
  swig_src/odeiv2_wrap.c:3548:104: note: expected ‘const pygsl_odeiv2_system *’ but argument is of type ‘const gsl_odeiv2_system *’
   3548 | static int _pygsl_odeiv2_check_step_jacobian(const pygsl_odeiv2_step *step, const pygsl_odeiv2_system *sys)
        |                                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
...
error: command '/usr/bin/gcc' failed with exit code 1

This is quite reasonable because (in the same file):

typedef struct{
	gsl_odeiv2_system dydt;
	PyGSL_odeiv_parameter_pass params;
} pygsl_odeiv2_system;

expected ‘const pygsl_odeiv2_system *’ but argument is of type ‘const gsl_odeiv2_system *’

And so it is not possible to replace a gsl_odeiv2_system by a pygsl_odeiv2_system.

Multinomial Example

For some reason this example doesn't work for me.

Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

from pygsl import rng
r = rng.mt19937_1998()
phi = (0.2,0.2,0.2,0.4)
k = 5
n = r.multinomial(phi, k, 10)
Traceback (most recent call last):
File "", line 1, in
ValueError: object of too small depth for desired array

Being new to using this library I'd appreciate any help.

Setup config error (Windows)

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: '-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?

Can't install on Windows via pip

Windows 10 Pro 64bit, Python 3.11.4:

pip install -U pygsl

Collecting pygsl
Downloading pygsl-2.3.3.tar.gz (1.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 8.6 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [36 lines of output]
Traceback (most recent call last):
File "C:\Users\mlap\AppData\Local\Temp\pip-install-43om8uhc\pygsl_79de1370e4ec4a408c9b2e164f15cda6\gsl_dist\gsl_Location.py", line 141, in init
import gsl_site
ModuleNotFoundError: No module named 'gsl_site'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "C:\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "C:\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
             ^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\mlap\AppData\Local\Temp\pip-build-env-4r14593i\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\mlap\AppData\Local\Temp\pip-build-env-4r14593i\overlay\Lib\site-packages\setuptools\build_meta.py", line 323, in _get_build_requires
      self.run_setup()
    File "C:\Users\mlap\AppData\Local\Temp\pip-build-env-4r14593i\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup
      exec(code, locals())
    File "<string>", line 99, in <module>
    File "C:\Users\mlap\AppData\Local\Temp\pip-install-43om8uhc\pygsl_79de1370e4ec4a408c9b2e164f15cda6\gsl_dist\gsl_Extension.py", line 22, in <module>
      from gsl_Location import gsl_Location
    File "C:\Users\mlap\AppData\Local\Temp\pip-install-43om8uhc\pygsl_79de1370e4ec4a408c9b2e164f15cda6\gsl_dist\gsl_Location.py", line 160, in <module>
      gsl_Location = _gsl_Location_file()
                     ^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\mlap\AppData\Local\Temp\pip-install-43om8uhc\pygsl_79de1370e4ec4a408c9b2e164f15cda6\gsl_dist\gsl_Location.py", line 148, in __init__
      raise DistutilsExecError(msg % des)
  distutils.errors.DistutilsExecError: I do not know how to run gsl-config
  on this system. Therefore you must provide me with the information
  where to find the GSL library. I could not import `gsl_site'.
  Reason: No module named 'gsl_site'. Copy gsl_site_example.py to gsl_site.py.
  Edit the variables in that file to reflect your installation.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Some issue in installation in pygsl on Mac OS (with M1 chip)

WARNING: Discarding https://files.pythonhosted.org/packages/0f/82/8bc81042923e474de30a080a551f11a4a352c098a569e6e126f313322735/pygsl-2.3.2.tar.gz#sha256=fa5d018d4421373f5390ac199bc5d484ef317d8358505b35a795bb89f96c8a9c (from https://pypi.org/simple/pygsl/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using cached pygsl-2.3.0.1.tar.gz (1.1 MB)
ERROR: Command errored out with exit status 1:
command: /Users/adwaitkulkarni/Documents/apps/anaconda3/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_92117b3e8fa64e35a869283e2428474a/setup.py'"'"'; file='"'"'/private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_92117b3e8fa64e35a869283e2428474a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-pip-egg-info-n4q4x186
cwd: /private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_92117b3e8fa64e35a869283e2428474a/
Complete output (16 lines):
/Users/adwaitkulkarni/Documents/apps/anaconda3/lib/python3.9/site-packages/setuptools/version.py:1: UserWarning: Module errno was already imported from None, but /private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_92117b3e8fa64e35a869283e2428474a is being added to sys.path
import pkg_resources
/bin/sh: gsl-config: command not found
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_92117b3e8fa64e35a869283e2428474a/setup.py", line 99, in
from gsl_Extension import gsl_Extension
File "/private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_92117b3e8fa64e35a869283e2428474a/gsl_dist/gsl_Extension.py", line 22, in
from gsl_Location import gsl_Location
File "/private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_92117b3e8fa64e35a869283e2428474a/gsl_dist/gsl_Location.py", line 158, in
gsl_Location = _gsl_Location_gsl_config()
File "/private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_92117b3e8fa64e35a869283e2428474a/gsl_dist/gsl_Location.py", line 111, in init
self.prefix = self.get_gsl_info('--prefix').strip()
File "/private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_92117b3e8fa64e35a869283e2428474a/gsl_dist/gsl_Location.py", line 133, in get_gsl_info
raise DistutilsExecError("could not start %s"%self.gsl_config_tool)
distutils.errors.DistutilsExecError: could not start gsl-config
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/17/fc/9c11163f017a0d6877141d4d4edb619b0f05990d865caab840a2d0463581/pygsl-2.3.0.1.tar.gz#sha256=b248a899a9df0b94996fd5fe070f8ecbd3d42ca07486a829dedcdfdd70a3337d (from https://pypi.org/simple/pygsl/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using cached pygsl-2.1.1.tar.gz (733 kB)

ERROR: Command errored out with exit status 1:
command: /Users/adwaitkulkarni/Documents/apps/anaconda3/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_aa60613eeea3405eb880491abe461bed/setup.py'"'"'; file='"'"'/private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_aa60613eeea3405eb880491abe461bed/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-pip-egg-info-58_14dp1
cwd: /private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_aa60613eeea3405eb880491abe461bed/
Complete output (18 lines):
/bin/sh: gsl-config: command not found
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_aa60613eeea3405eb880491abe461bed/setup.py", line 74, in
from gsl_Extension import gsl_Extension
File "/private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_aa60613eeea3405eb880491abe461bed/gsl_dist/gsl_Extension.py", line 138, in
gsl_Location = _gsl_Location_gsl_config()
File "/private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_aa60613eeea3405eb880491abe461bed/gsl_dist/gsl_Extension.py", line 93, in init
self.prefix = self.get_gsl_info('--prefix').strip()
File "/private/var/folders/_q/bnvmgm191hz962m9y1gcstqw0000gq/T/pip-install-crivcl09/pygsl_aa60613eeea3405eb880491abe461bed/gsl_dist/gsl_Extension.py", line 114, in get_gsl_info
raise DistutilsExecError("could not start %s"%self.gsl_config_tool)
distutils.errors.DistutilsExecError: could not start gsl-config
No array object was selected.
No array object was selected.
Looking for a suitable array moduleSELECTED a NEW array module ->numpy
Please make sure that all modules are built with the same setting.
e.g. remove the build directory and start the build process again!
numpy
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/38/d9/ac760af4d74a99d757bf93c5d29dd7847ad40b761d090527b69484f4ac5b/pygsl-2.1.1.tar.gz#sha256=052ef186d499332a325edd0d46a0f9ae0726050da07f2328cfd659d620e2be33 (from https://pypi.org/simple/pygsl/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pygsl (from versions: 2.1.1, 2.3.0.1, 2.3.2)
ERROR: No matching distribution found for pygsl

(base) Phy8s-Mac-Studio:~ adwaitkulkarni$

could not start gsl-config

I was installing pygsl on my mac. Its updated mac with Mac Os Sonoma (Version 14.0 (23A344)). As Written in documentation i Followed all instructions for installations.
Here its terminal code:

Phy8s-Mac-Studio:~ adwaitkulkarni$ conda install wheel
Collecting package metadata (current_repodata.json): done
Solving environment: done

==> WARNING: A newer version of conda exists. <==
current version: 23.3.1
latest version: 23.10.0

Please update conda by running

 conda update -n base -c defaults conda

Or to minimize the number of packages updated during conda update use

 conda install conda=23.10.0

All requested packages already installed.

Phy8s-Mac-Studio:~ adwaitkulkarni$ cd Downloads/

Phy8s-Mac-Studio:Downloads adwaitkulkarni$ cd pygsl.2.3.3
-bash: cd: pygsl.2.3.3: No such file or directory

Phy8s-Mac-Studio:Downloads adwaitkulkarni$ cd pygsl-2.3.3

Phy8s-Mac-Studio:pygsl-2.3.3 adwaitkulkarni$ python3 setup.py gsl_wrappers
Traceback (most recent call last):
File "/Users/adwaitkulkarni/Downloads/pygsl-2.3.3/setup.py", line 92, in
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
ModuleNotFoundError: No module named 'wheel'

Phy8s-Mac-Studio:pygsl-2.3.3 adwaitkulkarni$ conda activate

(base) Phy8s-Mac-Studio:pygsl-2.3.3 adwaitkulkarni$ python3 setup.py gsl_wrappers
/bin/sh: gsl-config: command not found
Traceback (most recent call last):
File "/Users/adwaitkulkarni/Downloads/pygsl-2.3.3/setup.py", line 99, in
from gsl_Extension import gsl_Extension
File "/Users/adwaitkulkarni/Downloads/pygsl-2.3.3/gsl_dist/gsl_Extension.py", line 22, in
from gsl_Location import gsl_Location
File "/Users/adwaitkulkarni/Downloads/pygsl-2.3.3/gsl_dist/gsl_Location.py", line 158, in
gsl_Location = _gsl_Location_gsl_config()
File "/Users/adwaitkulkarni/Downloads/pygsl-2.3.3/gsl_dist/gsl_Location.py", line 111, in init
self.prefix = self.get_gsl_info('--prefix').strip()
File "/Users/adwaitkulkarni/Downloads/pygsl-2.3.3/gsl_dist/gsl_Location.py", line 133, in get_gsl_info
raise DistutilsExecError("could not start %s"%self.gsl_config_tool)
distutils.errors.DistutilsExecError: could not start gsl-config

$(base) Phy8s-Mac-Studio:pygsl-2.3.3 adwaitkulkarni$

[Bug]: Impossible to install

Windows 11 Pro 64bit, Python 3.11, failed to install:

C:\Users\User\Downloads>py -3.11 -m pip install -U pygsl
Collecting pygsl
Downloading pygsl-2.3.3.tar.gz (1.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 4.9 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [36 lines of output]
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Temp\pip-install-di80nit0\pygsl_2192209ed4144c878b81d4a94329bf26\gsl_dist\gsl_Location.py", line 141, in init
import gsl_site
ModuleNotFoundError: No module named 'gsl_site'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "C:\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "C:\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
             ^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\User\AppData\Local\Temp\pip-build-env-87dc8xng\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\User\AppData\Local\Temp\pip-build-env-87dc8xng\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
      self.run_setup()
    File "C:\Users\User\AppData\Local\Temp\pip-build-env-87dc8xng\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 99, in <module>
    File "C:\Users\User\AppData\Local\Temp\pip-install-di80nit0\pygsl_2192209ed4144c878b81d4a94329bf26\gsl_dist\gsl_Extension.py", line 22, in <module>
      from gsl_Location import gsl_Location
    File "C:\Users\User\AppData\Local\Temp\pip-install-di80nit0\pygsl_2192209ed4144c878b81d4a94329bf26\gsl_dist\gsl_Location.py", line 160, in <module>
      gsl_Location = _gsl_Location_file()
                     ^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\User\AppData\Local\Temp\pip-install-di80nit0\pygsl_2192209ed4144c878b81d4a94329bf26\gsl_dist\gsl_Location.py", line 148, in __init__
      raise DistutilsExecError(msg % des)
  distutils.errors.DistutilsExecError: I do not know how to run gsl-config
  on this system. Therefore you must provide me with the information
  where to find the GSL library. I could not import `gsl_site'.
  Reason: No module named 'gsl_site'. Copy gsl_site_example.py to gsl_site.py.
  Edit the variables in that file to reflect your installation.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

C:\Users\User\Downloads>

PyPi install fails in call to swig.

This might be a problem only on my side but if I try:
pip install pygsl
setup.py bdist_wheel fails in a call to swig:

  Downloading pygsl-2.3.2.tar.gz (1.1 MB)                                                                                                                                                                                                                                                                                                                   
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 13.5 MB/s eta 0:00:00                                                                                                                                                                                                                                                                                               
  Preparing metadata (setup.py) ... done                                                                                                                                                                                                                                                                                                                
Requirement already satisfied: numpy in ./.conda/envs/Py38/lib/python3.8/site-packages (from pygsl) (1.20.3)                                                                                                                                                                                                                                                                 
Building wheels for collected packages: pygsl                                                                                                                                                                                                                                                                                                                               
  Building wheel for pygsl (setup.py) ... error                                                                                                                                                                                                                                                                                                                              
  error: subprocess-exited-with-error                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                
  × python setup.py bdist_wheel did not run successfully.                                                                                                                                                                                                                                                                                                                    
  │ exit code: 1                                                                                                                                                                                                                                        
  ╰─> [35 lines of output]                                                                                                                                                                                                                                                                      
      <swig_extension.SWIG_Extension('__callback') at 0x2b407a39bac0>                                                                                                                 sr                                                                                                                                                                                     
      Building testing ufuncs!                                                                                                                                                                                                                                                                                  
      #31 extension modules                                                                                                                                                                                                                                                                         
      running bdist_wheel                                                                                                                                                                                                                                                                   
      running gsl_wrappers                                                                                                                                                                                                                                                                      
      Exporting parser tree using swig: ['swig', '-I/home/berberic/.conda/envs/Py38/include', '-xml', '/tmp/pip-install-_0vu4scu/pygsl_3a4bfad3079e4faaa83f5ca8254cb235/testing/src/sf                                                                                                                                                                                       /sf.i']                                                                                                                                                                                                             
      /home/berberic/.conda/envs/Py38/include/gsl/gsl_sf_legendre.h:375: Error: Syntax error - possibly a missing semicolon.                                                                                                                                                                                                                                                 
      Traceback (most recent call last):                                                                                                                                                                                                                                                                                                                
        File "<string>", line 2, in <module>                                                                                                                                                                                                                                                                                                                            
        File "<pip-setuptools-caller>", line 34, in <module>                                                                                                                                                                                                                                                                                                                 
        File "/tmp/pip-install-_0vu4scu/pygsl_3a4bfad3079e4faaa83f5ca8254cb235/setup.py", line 259, in <module>                                                                                                                                                                                                                                                              
          setup (name = proj_name,                                                                                                                                                                                                                                                                                              
        File "/home/berberic/.conda/envs/Py38/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup                                                                                                                                                                                                                                                        
          return distutils.core.setup(**attrs)                                                                                                                                                                                                                                                                                                                               
        File "/home/berberic/.conda/envs/Py38/lib/python3.8/distutils/core.py", line 148, in setup                                                                                                                                                                                                                                                                           
          dist.run_commands()                                                                                                                                                                                                                                                                               
        File "/home/berberic/.conda/envs/Py38/lib/python3.8/distutils/dist.py", line 966, in run_commands                                                                                                                                                                                                                                                                    
          self.run_command(cmd)                                                                                                                                                                                                                                                                                     
        File "/home/berberic/.conda/envs/Py38/lib/python3.8/distutils/dist.py", line 985, in run_command                                                                                                                                                                                                                                                                     
          cmd_obj.run()                                                                                                                                                                                                                                                             
        File "/tmp/pip-install-_0vu4scu/pygsl_3a4bfad3079e4faaa83f5ca8254cb235/setup.py", line 189, in run                                                                                                                                                                                                                                                                   
          self.run_command('gsl_wrappers')                                                                                                                                                                                                                                                                                                                      
        File "/home/berberic/.conda/envs/Py38/lib/python3.8/distutils/cmd.py", line 313, in run_command                                                                                                                                                                                                                                                                      
          self.distribution.run_command(command)                                                                                                                                                                                                                                                                                                                             
        File "/home/berberic/.conda/envs/Py38/lib/python3.8/distutils/dist.py", line 985, in run_command                                                                                                                                                                                                                                                                     
          cmd_obj.run()                                                                                                                                                                                                                                                             
        File "/tmp/pip-install-_0vu4scu/pygsl_3a4bfad3079e4faaa83f5ca8254cb235/gsl_dist/gsl_CodeGenerator.py", line 107, in run
          self._create_ufunc_wrapper()
        File "/tmp/pip-install-_0vu4scu/pygsl_3a4bfad3079e4faaa83f5ca8254cb235/gsl_dist/gsl_CodeGenerator.py", line 93, in _create_ufunc_wrapper
          self._swig_create_xml_file(t_file)
        File "/tmp/pip-install-_0vu4scu/pygsl_3a4bfad3079e4faaa83f5ca8254cb235/gsl_dist/gsl_CodeGenerator.py", line 60, in _swig_create_xml_file
          subprocess.check_call(command)
        File "/home/berberic/.conda/envs/Py38/lib/python3.8/subprocess.py", line 364, in check_call
          raise CalledProcessError(retcode, cmd)                                                                                                                                      sr
      subprocess.CalledProcessError: Command '['swig', '-I/home/berberic/.conda/envs/Py38/include', '-xml', '/tmp/pip-install-_0vu4scu/pygsl_3a4bfad3079e4faaa83f5ca8254cb235/testing/src/sf/sf.i']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pygsl
  Running setup.py clean for pygsl
Failed to build pygsl 

I'm running pip in a conda environment with:

pip version = 22.0.4
swig version = 4.0.2
GSL version = 2.7.1
gcc version = 10.2.0

Any help would be much appreciated.

Fix pip/PyPI install

Newer versions of pip cannot install the latest pygsl from PyPI, because the version number in the package metadata (in

version = 2.3
) is inconsistent with the filename (pygsl-2.3.0.1.tar.gz). The fourth digit is not as prescribed by the "semantic versioning" system, so perhaps we should take this opportunity to remove it altogether, and do a new release with version number 2.3.1. This should solve the pip install issue.

The error message from pip is:

WARNING: Discarding https://files.pythonhosted.org/packages/17/fc/9c11163f017a0d6877141d4d4edb619b0f05990d865caab840a2d0463581/pygsl-2.3.0.1.tar.gz#sha256=b248a899a9df0b94996fd5fe070f8ecbd3d42ca07486a829dedcdfdd70a3337d (from https://pypi.org/simple/pygsl/). Requested pygsl from file:///home/clinssen/.cache/pip/wheels/4b/d0/ab/9f52c8f2cc5f2a785992894d4be820e6223cadbd70c1496862/pygsl-2.3.0-cp35-cp35m-linux_x86_64.whl has different version in metadata: '2.3.0'

Some tests fail

First some notes on the new release (2.3.4):

  • That version is not yet listed in pypi.
  • When looking into the releases I am used to see just the version and not the title of the changes.
  • The name of the package is also different from the previous releases, before it was pygsl-2.3.3.tar.gz and now it is pygsl-v.2.3.4.tar.gz (note the extra v.).

Now the main problem, when running pytest I get:

...
    del _shortname
E   NameError: name '_shortname' is not defined
=========================== short test summary info ============================
ERROR testing/tests/sf_test.py - NameError: name '_shortname' is not defined
ERROR testing/tests/test_airy_from_gsl_src.py - NameError: name '_shortname' ...
ERROR testing/tests/test_bessel_from_gsl_src.py - NameError: name '_shortname...
ERROR testing/tests/test_coulomb_from_gsl_src.py - NameError: name '_shortnam...
ERROR testing/tests/test_dilog_from_gsl_src.py - NameError: name '_shortname'...
ERROR testing/tests/test_gamma_from_gsl_src.py - NameError: name '_shortname'...
ERROR testing/tests/test_hermite_from_gsl_src.py - NameError: name '_shortnam...
ERROR testing/tests/test_hyperg_from_gsl_src.py - NameError: name '_shortname...
ERROR testing/tests/test_legendre_from_gsl_src.py - NameError: name '_shortna...
ERROR testing/tests/test_mathieu_from_gsl_src.py - NameError: name '_shortnam...
ERROR testing/tests/test_sf_from_gsl_src.py - NameError: name '_shortname' is...
!!!!!!!!!!!!!!!!!!! Interrupted: 11 errors during collection !!!!!!!!!!!!!!!!!!!
============================== 11 errors in 2.02s ==============================

So we have the same error repeated 11 times.

For example in testing/tests/sf_test.py the variable _shortname is defined inside the for cycle, since
from pygsl.testing import _ufuncs
is empty this will fail.

Now why do I get an empty import I have no idea. It worked in the pre-release.

I admit that the problem can be how I am calling pytest...

pypi release

Dear pygsl devs,

apologies if this is not the right forum to bring this up. I was wondering if it would be possible to have a new pypi release of pygsl in the next few weeks.

Many thanks,

Sergei

PyObject_GC_UNTRACK is deprecated

When trying to build pygsl from source one can encounter errors like the following:

INFO: gcc: swig_src/hankel_wrap.c
  swig_src/hankel_wrap.c:3096:3: error: implicit declaration of function '_PyObject_GC_UNTRACK' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    _PyObject_GC_UNTRACK(descr);

This is related to the fact that these macros have been removed from Python API as per:
https://docs.python.org/3/c-api/gcsupport.html#c.PyObject_GC_UnTrack

This can be fixed by regenerating the files in swig_src with swig >= 4.0. Not clear if this has impact on python<3.8

pygsl no longer compiles with python3.12

I tried to compile pygsl with python3.12 and got
python312 setup.py build
Traceback (most recent call last):
File "/giga/install/python312/pygsl-2.3.3/setup.py", line 99, in
from gsl_Extension import gsl_Extension
File "/giga/install/python312/pygsl-2.3.3/gsl_dist/gsl_Extension.py", line 19, in
import imp
ModuleNotFoundError: No module named 'imp'

After depreciating the modul imp.py has been removed in python3.12

Will there be any new version of pygsl? It's very useful.

gsl-config: not found

python setup.py config
and
python setup.py build
are giving:
gsl-config: not found

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.