Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment variable AMICI_DLL_DIRS to control DLL directories on Windows #1637

Merged
merged 2 commits into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/test_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@ jobs:

env:
AMICI_SKIP_CMAKE_TESTS: "TRUE"
openBLAS_version: "0.3.12"
openBLAS_version: "0.3.19"
AMICI_DLL_DIRS: "C:\\BLAS\\bin"

strategy:
matrix:
python-version: [ "3.8" ]

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- uses: actions/checkout@master
- run: git fetch --prune --unshallow

Expand Down Expand Up @@ -48,5 +58,7 @@ jobs:
shell: bash
run: pip install -v $(ls -t dist/amici-*.tar.gz | head -1)

- run: python -m amici

- name: Run Python tests
run: python -m pytest --ignore-glob=*petab* --ignore-glob=*special* python/tests
4 changes: 2 additions & 2 deletions documentation/python_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ by MSVC (see Visual Studio above). ``KERNEL32.dll`` is part of Windows and in

.. note::

Since Python 3.8, the library directory needs to be set as follows:
Since Python 3.8, the library directory needs to be set either from Python:

.. code-block:: python

Expand All @@ -277,7 +277,7 @@ by MSVC (see Visual Studio above). ``KERNEL32.dll`` is part of Windows and in
os.add_dll_directory("C:\\BLAS\\bin")
import amici

Adding it to ``PATH`` will not work.
or via the environment variable ``AMICI_DLL_DIRS``.

Further topics
++++++++++++++
Expand Down
2 changes: 1 addition & 1 deletion scripts/installOpenBLAS.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Write-Host 'script installOpenBLAS.ps1 started'
$version = '0.3.12'
$version = '0.3.19'
New-Item -Path 'C:\BLAS' -ItemType Directory -Force # create directory
# Enforce stronger cryptography
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
Expand Down
11 changes: 11 additions & 0 deletions swig/amici.i
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,17 @@ RDataReporting = enum('RDataReporting')

%template(SteadyStateStatusVector) std::vector<amici::SteadyStateStatus>;

%pythonbegin %{
import sys
import os

if sys.platform == 'win32':
for dll_dir in os.environ.get("AMICI_DLL_DIRS", "").split(os.pathsep):
os.add_dll_directory(dll_dir)

%}


// add module docstring and import additional types for typehints
%pythonbegin %{
"""
Expand Down